Why does it gives error while installing pip? [duplicate] - python

This question already has an answer here:
This is the result I get when trying to install pip3
(1 answer)
Closed 1 year ago.
I am getting error while installing pip. I have python 3.9.2 installed.
root#kali:~# sudo apt-get install python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
python3-pip : Depends: python3-distutils but it is not going to be installed
Depends: python3-setuptools but it is not going to be installed
Recommends: python3-dev (>= 3.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root#kali:~# ^C
enter image description here

Pip comes installed with Python 2 >=2.7.9 or Python 3 >=3.4.
First check it using:
python -m pip --version
To install it manually:
First, run this code to download get-pip.py using curl.
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Then, run this command in the folder that you have installed get-pip.py
python get-pip.py

It’s weird but I thought apt-get is supposed to retrieve any dependencies. Yet it tells you what it’s missing and refuses to install them. Have you tried to install the dependencies, then pip?
I’m not too familiar with apt-get but I recommend checking the error message to get to the bottom of why it refuses to install the dependencies. Your screen shot doesn’t have the whole message.
The last resort is the force install option. See if it understands --force as an argument. Note that this might put your package management system in a strange state if it isn’t already.
I’m not sure what “ig” is but I do not plan to link other social network applications to this one.

Related

unable to install python pdfinterp with pip cammand

when i am installing some module like pdfinterp with pip command gives below error please share any solution.
Could not find a version that satisfies the requirement pip (from versions: )
No matching distribution found for pip
From what I understand of your question, you are trying to install the pdfinterp module, which is a part of the pdfminer package.
So, to properly install pdfinterp, you would need to run:
sudo -H pip install pdfminer
However, pdfminer is only for Python2.7! You don't specify in your question, but if you are using Python3.6, you would need to run:
sudo -H pip3 install pdfminer3k
Which downloads pdfminer3k, a "Python 3 port of pdfminer" which should mean your pdfinterp module should be downloaded with.
Hope it helps!
EDIT
Before we begin, try upgrading your pip package by running:
pip install --upgrade pip
(Or python -m pip install --upgrade pip on Windows)
This will ensure your pip packages are up-to-date.
Then, according to errors reported on the pip GitHub repo concerning pdfminer, you should be able to run the install explained in the original answer above. The reason this error is occurring for you is because at one time PEP 440 was having issues with the declaration of "prerelease detection logic":
I'm guessing pip was confused by the old N[.N]+ spelling in the PEP,
that got clarified in recent editions to N(.N)*. SOURCE
This should fix the issue, if you still have problems comment below with the error it returns and we can go from there!
Here is some additional information about the issue that was raised in error #1555 of PyPa pip's GitHub Repo.
As a side note, my machine is running the most recent version of pip and is fully functioning with pdfminer and pdfminer3k!

Error Install Matplotlib for Python3 on Debian 9

I'm trying to install MatPlotLib for Python3 using Debian 8. The pip3
command asks for the missing dependency: libfreetype. However, this is what happens when I try to install this package!
debnub#debhub:~$ sudo apt-get install libfreetype6-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libfreetype6-dev : Depends: libfreetype6 (= 2.5.2-3+deb8u2) but 2.
6.3-3.2 is to be installed
E: Unable to correct problems, you have held broken packages.
debnub#debhub:~$
I've tried a lot of different solutions including using aptitude. Is there anything I might be missing in this case?
This was solved by running:
sudo aptitude -f install libfreetype6-dev
And then selecting no to downgrade the installed version of libfreetype6.

Can't install Twisted for Python3 on Fedora for some reason

For some reason, I just can't get it to work. After running pip3 install twisted, here is the error that I'm presented with: https://bpaste.net/show/3b73706ea448 Along with error: command 'gcc failed with exit status 1, it also said Failed building wheel for twisted at some point. I've tried sudo yum install python3-devel and I also have gcc installed already. The same error occurs, whether I'm in a virtualenv or not.
Solved using the following:
sudo yum install redhat-rpm-config
as seen here: G++ error:/usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
You might need sudo for that installation.
Try something along the lines of:
sudo python3 -m pip install twisted
It's common for me at least that I need sudo for the correct installation of python packages (especially when compilation is involved)
(Unfortunately I can't comment to your post so I posted it as an answer)

Installing MoviePy for Python 3.2 with pip

I am trying to install the Python module MoviePy onto my Raspberry Pi for use with Python 3.2.3 which came ready installed with the OS. I have tried every command line command that I can find and lots of possible permutations of certain words.
Following are the download instructions.
https://zulko.github.io/moviepy/install.html
After much effort, I eventually managed to download pip and installed moviepy, but it was the Python 2.7 version. 😡
I found a separate thing called pip3 and installed it using:
sudo apt-get install python3-pip --fix-missing
It appeared to be successful.
Eventually I found a command that should work with Python 3.2:
pip-3.2 install moviepy
But it gave the error:
Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement moviepy
No distributions at all found for moviepy
Storing complete log in /home/Pi/.pip/pip.log
What do I do?
I have no knowledge of CLI at all...
Do
sudo pip install ez_setup
sudo pip install moviepy
If it says like pip not found type
sudo apt-get install python
Python 3 is a little harder to setup so doing that command will give you 2.7
But there syntax is basicly the same.

How to `pip install` a package that has non-Python dependencies?

Many python packages have build dependencies on non-Python packages. I'm specifically thinking of lxml and cffi, but this dilemma applies to a lot of packages on PyPI. Both of these packages have unadvertised build dependencies on non-Python packages like libxml2-dev, libxslt-dev, zlib1g-dev, and libffi-dev. The websites for lxml and cffi declare some of these dependencies, but it appears that there is no way to do figure this out from a command line.
As a result, there are hundreds of questions on SO that take this general form:
pip install foo fails with an error: "fatal error: bar.h: No such file or directory". How do I fix it?
Is this a misuse of pip or is this how it is intended to work? Is there a sane way to know what build dependencies to install before running pip? My current approach is:
I want to install a package called foo.
pip install foo
foo has a dependency on a Python package bar.
If bar build fails, then look at error message and guess/google what non-Python dependency I need to install.
sudo apt-get install libbaz-dev
sudo pip install bar
Repeat until bar succeeds.
sudo pip uninstall foo
Repeat entire process until no error messages.
Step #4 is particularly annoying. Apparently pip (version 1.5.4) installs the requested package first, before any dependencies. So if any dependencies fail, you can't just ask pip to install it again, because it thinks its already installed. There's also no option to install just the dependencies, so you must uninstall the package and then reinstall it.
Is there some more intelligent process for using pip?
This is actually a comment about the answer suggesting using apt-get but I don't have enough reputation points to leave one.
If you use virtualenv a lot, then installing the python-packages through apt-get can become a pain, as you can get mysterious errors when the python packages installed system-wide and the python packages installed in your virtualenv try to interact with each other. One thing that I have found that does help is to use the build-dep feature. To build the matplotlib dependencies, for example:
sudo apt-get build-dep python-matplotlib
And then activate your virtual environment and do pip install matplotlib. It will still go through the build process but many of the dependencies will be taken care of for you.
This is sort what the cran repositories suggest when installing R packages in ubuntu.
For most popular packages, There is a workaround for recent ubuntu systems. For example, I want to install matplotlib. When you order pip install matplotlib, it usually fails because of a missing dependency.
You can use apt-get install python-matplotlib instead. For python3, you can use apt-get install python3-matplotlib

Categories