How to install a python package via yum without all the dependencies - python

I have already compiled couchdb 1.2 and I am using it. I now need to use couchdb python and I am trying to do yum install python-couchdb, but yum wants to install couchdb 1.1.1 because it propably doesnt find my compiled version. How can I tell yum to install only the python-couchdb package without the deps?

Python installs with easy_install for getting python eggs like python-couchdb. However, I and many people prefer a wrapper called PIP that allows better management of eggs.
On linux you can install it like so.
Or if you prefer windows.
Once you have pip you can install python-couchdb by calling:
sudo pip install couchdb
That shouldn't bork your couch installation.

Related

How to install rpm and dependencies on RHEL?

I'm trying to install python3-gnupg on my RHEL EC2 server.
I used the command
wget https://download.fedoraproject.org/../python-gnupg-0.4.6-1.fc32.src.rpm
sudo rpm -i file.rpm
Get the error
error: Failed dependencies:
python(abi) = 3.8 is needed by python3-gnupg-0.4.6-1.fc32.noarch
rpmlib(PayloadIsZstd) <= 5.4.18-1 is needed by python3-gnupg-0.4.6-1.fc32.noarch
How do I download & install all dependencies at once?
You may want to use dnf or yum (if dnf is not available for some reason) to install your package instead of the rpm command.
Why ?
Because it will actually download dependencies. The rpm command does not comes with a 'remote repository' like yum or dnf, thus its incapacity to download missing dependencies.
Command for dnf:
sudo dnf install https://download.fedoraproject.org/../python-gnupg-0.4.6-1.fc32.src.rpm
Command for yum:
sudo yum install https://download.fedoraproject.org/../python-gnupg-0.4.6-1.fc32.src.rpm
(you can replace the URL by the path to your RPM file and you'll want to replace the URL by the correct one)
You may still have a problem with python.
Indeed, it requires a fixed version of python (the 3.8 version) and dnf/yum may refuse to install one.
You have two ways to fix this.
The first way
Install the python3-gnupg package directly from the RHEL repo (if available, I'm not quite sure) to directly install the correct dependencies (and the version corresponding to your distro that received the RHEL tests blessing)
So you may try
sudo dnf install python3-gnupg
Or
sudo yum install python3-gnupg
The second way
Try to install the corresponding version of python. Either with dnf or yum.
sudo dnf install python3.8
Or
sudo yum install python3.8
What I would recommend
IMHO, the first solution is better because you'll actually get the official RHEL version of the python3-gnupg, which has been build for your distro AND tested accordingly. But it may not be available. I actually tested those commands on my Fedora 33, because it uses the same tools as RHEL, but its dnf/yum repositories are actually different.

pip install paramiko comes out with error - ModuleNotFoundError: No module named 'zlib' [duplicate]

I was trying to install Django. Turns out that course's teacher said that we will be working with Python 3.6
I install Python 3.6. Now it's my default, it somewhat replaced the last version I had; which is Python 3.5.
Everything ok until that. But when I want to install Django doing
"pip3 install django", it tells me that the module is already satisfied and therefore installed.
I run "python3" command into my terminal. It runs Python 3.6. I try to import Django, and boom... "No module named 'django'".
Then I realized pip3 was actually installing my modules into Python 3.5 and not 3.6. So what I do is to install pip in Python 3.6.
I download get-pip.py and proceed to execute it with Python 3.6 typing in "python3.6 get-pip.py".
Here is when the damn "zipimport.ZipImportError: can't decompress data; zlib not available" goes in. I've tried a ton of things and no one of them fixed the %^$! problem. I'm really tired.
What I have already tried:
python3.6 -m pip install django, which output is "/usr/local/bin/python3.6: No module named pip"
apt install zlib, which output is "E: Unable to locate package zlib"
apt install zlib1g-dev, which says that it's already installed; the problem persists though.
I also came across this problem (while creating a simple installer for pyenv). Here's how I solved it for Mac and Linux:
Ubuntu 20.04, 18.04
You need the zlib development files, and probably zlib itself too:
sudo apt install -y zlib1g-dev zlibc
If you're missing zlib, it's likely that the next problem you'll run into is with openssl, so it's probably best to get that now as well:
sudo apt install -y libssl-dev
sudo apt install -y libssl1.1 || sudo apt install -y libssl1.0
macOS
I believe this comes with XCode CLI Tools (or at least I didn't have to custom install it Big Sur):
xcode-select --install
For me it worked in RHEL:
$ yum install zlib-devel
Suggested solutions (installing zlib1g-dev or zlib-devel) seem to resolve the issue in most cases. Here is one edge case I've encountered recently: whatever you are trying to run might use zlib via symlink which might be broken.
In my case I was trying to run a build of a 3rd-party software which already had python and all necessary libs being emebedded into it. It was packaged as a tar.gz archive. Unpacking the archive on a Windows machine and then copying the contents to another linux machine destroyed all the symlinks (if you do ls -l in a folder with symlinks you would see that all of them have size 0 and do not point to anything). Copying tar.gz to the linux machine directly and unpacking it there resolved the issue.
P.S. I know it's an edge case scenario but it took me and one more developer quite a while to figure it out so I think it's worth mentioning here, just in case someone gets as unlucky as I got.
Its solves my issue for centos 7.6 :-
yum install zlib-deve

How do I install NumPy in GIMP in Ubuntu 20.04?

I'm trying to install NumPy, so that I can use it in Python plug-ins for GIMP. Every time I try, it installs into the external Python, and the Python inside GIMP can't find it. How do I install NumPy, so that GIMP can find it?
If you are using the flatpak version, you can install numpy as a "user" package using your "general" pip installer (and not the apt kind) and it will be taken in account by Gimp's built-in runtime (just tested, it works). You may have to force a specific version to get a V2-compatible numpy:
pip install --user -I numpy==1.11.0
I cannot tell you how to install pip for your V2 python on 20.04. On my 19.04 apt install python-pip did the trick but on 20.04 it could be apt install python2-pip or you would have to install it by hand.

How to switch entirely from pip to brew

I have read elsewhere that brew is a better option than pip to install packages (and indeed I had less problems installing Python packages with brew than with pip). The problem is that when I run
brew update && brew outdated && brew upgrade --all
and then
pip-review -a
it seems like the same packages are installed twice (for example matplotlib, scipy, and the like).
How can I get rid of pip and switch entirely to brew, as to avoid double installations and potential conflicts?
You can't do that. You cannot expect all python packages available via brew.
pip is the python package manager, having an understanding of how the python packages should be installed by querying a remote server of python packages called PyPI.
Brew, on the other hand, is a general software installation system for your Mac. It is a project into existence only because Apple is lazy to provide a good package manager and package management system for installing Unix/ Mac software on Apple.
There are many Python packages which exist on brew as volunteers took the pain to convert it to brew formulae. But it certainly does not guarantee of 100% 1-1 mapping of brew package to pip installable package.
You still want to use pip, you just should be using Homebrew's copy of it, rather than some other variant. Homebrew's copy of pip is part of the python package, so if you brew install python you'll have pip all setup and ready to go.
To clean up any non-Homebrew-provided pip packages, just delete the folder the module is in directly. For example, if you manually installed pip, the modules are probably stored under /Library/Python/2.7/site-packages somewhere.

installing packages over pythonbrew

I installed python 2.7 with python brew. How do I install packages to work with it? I installed MySQLdb with synaptic, but I am unable to import it in python 2.7.
Switch to 2.7:
pythonbrew switch 2.7
Curl and run get-pip to get the correct version of pip for 2.7:
curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
python get-pip.py
This will install the version of pip for 2.7. Check it by doing:
pip --version
Turn off pythonbrew:
pythonbrew off
Check the version of pip again, and it should be using the one for your default Python:
pip --version
If all is good, then switch back to 2.7 in pythonbrew and install mysql-python for 2.7:
pythonbrew switch 2.7
pip install mysql-python
Check to see that it is installed for 2.7:
pip freeze
Pip freeze will give you a listing of all installed libraries for the current active version of Python.
You should try to install pip, which is a recursive acronym: Pip Installs Packages. This thread talks about installing it on windows, on Ubuntu I did sudo apt get install pip.
Ok, your problem is that "mysqldb" is not a python package. You need to use MySQLdb as a backend, or simply install sqlite3 and import that into Python, which is a module that mimics SQL. If you end up using an actual full-on database, like MySQLdb or PostgreSQL, you'll probably need to install SQLAlchemy, which is a Python module to interface with those.
You need to install a version of pip for each Python version. Do you have easy install available? If so you can do
easy_install-2.7 pip
Is there a specific reason that you are installing Python via home brew though? You do know that Ubuntu has as a package.
sudo apt-get install python2.7
Will give you a version of Python that is already nicely set up.
I also believe that you should be trying to install the Python package called mysql-python.
pip install mysql-python
MySQLDB is not a Python package. It's the actual database.
Agree with #leta-rogers. However, I didn't have to install pip separately. Installing python using pythonbrew installed pip (for python 2.7) for me as well:
pythonbrew install 2.7
pythonbrew switch 2.7
pip install mysql-python

Categories

Resources