I like to use pip to download the source of Python packages, without installing them. To download e.g. SciPy 1.4.1 I would use
python3 -m pip download --no-binary=:all: scipy==1.4.1
This generally works, but for at least SciPy 1.4.1 and pip 20.0, 20.0.1 and 20.0.2 it does not.
The SciPy source is in fact downloaded, but due to an error in the "Installing build dependencies" step, the SciPy source is being cleaned up. (I don't really want this build step, but even supplying --no-deps doesn't get rid of it. It doesn't actually install anything though.)
What's changed with pip, and (more importantly) how do I fix it?
It works if I add the --no-use-pep517 option:
python3 -m pip download --no-binary=:all: --no-use-pep517 scipy==1.4.1
This also could be fixed with
pip install -U virtualenv pip
virtualenv .venv --seeder pip
source .venv/bin/activate
python3 -m pip download --no-binary=:all: scipy==1.4.1
Related
I wrote pip install ppaquette-gym-doom
and it gives me a
error: legacy:install-failure
I tried pip install gensim pip install dlib --pre python -m pip install --upgrade pillow
python -m pip install --upgrade pip and python -m pip isntall --upgrade wheel
those codes didnt solved my problem
I am not familiar with gym-doom but based on some quick research it looks like you are getting this error because "ppaquette-gym-doom" is an obsolete version. From the github page "Note: This environment is not maintained anymore, and uses an old version of VizDoom."
It seems like the new version is simply "pip install gym-doom". This will also require something called Vizdoom.
Again this is based on quick research. I have never used these libraries.
I have a problem with the pip python 3.x installation.
I have pip version 19.0.3, but when i use pycharm, it keeps saying that i need the pip updated.
when i check the folder, I can see there is another version of pip pip-10.0.1-py3.7.egg in the folder.
I remember ticking the option to add the python in the environment path when i installed python.
When I tried to update/install pip again, i got the error.
(venv) C:\Users\ranic\PycharmProjects\ProjectDatabase>pip help install
You are using pip version 10.0.1, however version 19.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
(venv) C:\Users\r\PycharmProjects\ProjectDatabase>python -m pip install --upgrade pip
Requirement already up-to-date: pip in c:\users\r\pycharmprojects\projectdatabase\venv\lib\site-packages (19.0.3)
Thank you in advance.
If you check, I guarantee that pip is not in the same place as python.
Mine are, seen below:
C:\Users\adsmith>where pip
C:\Users\adsmith\AppData\Local\Programs\Python\Python36-32\Scripts\pip.exe
C:\Users\adsmith>where python
C:\Users\adsmith\AppData\Local\Programs\Python\Python36-32\python.exe
but I'm guessing your python is referring to Python2, and pip Python3 (or vice versa). If you find the version of Python that pip refers to, you should be able to do:
path/to/that/python -m pip install --upgrade pip
In a virtual env, after installing numpy without problems i run
pip3 install pandas
which returns:
EDIT:
Collecting pandas
Using cached https://files.pythonhosted.org/packages/08/01/803834bc8a4e708aedebb133095a88a4dad9f45bbaf5ad777d2bea543c7e/pandas-0.22.0.tar.gz
Installing build dependencies ... error
Complete output from command /home/bonzay/Desktop/Final_Project/venv/bin/python3.4 -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-4pcvmc12 https://files.pythonhosted.org/packages/81/30/e935244ca6165187ae8be876b6316ae201b71485538ffac1d718843025a9/wheel-0.31.1-py2.py3-none-any.whl#sha256=80044e51ec5bbf6c894ba0bc48d26a8c20a9ba629f4ca19ea26ecfcf87685f5f https://files.pythonhosted.org/packages/8c/10/79282747f9169f21c053c562a0baa21815a8c7879be97abd930dbcf862e8/setuptools-39.1.0-py2.py3-none-any.whl#sha256=0cb8b8625bfdcc2d43ea4b9cdba0b39b2b7befc04f3088897031082aa16ce186 https://files.pythonhosted.org/packages/70/25/1e1521e6ce2cf78ff4a8b06fbc2cd513ce004ec337000eddfe016fdf3fc6/Cython-0.28.2-cp34-cp34m-manylinux1_x86_64.whl#sha256=85f7432776870d65639fed00f951a3c05ef1e534bc72a73cd1200d79b9a7d7d0 https://files.pythonhosted.org/packages/fc/1b/a1717502572587c724858862fd9b98a66105f3a3443225bda9a1bd16ee14/numpy-1.9.3-cp34-cp34m-manylinux1_x86_64.whl#sha256=bff36563f9d6a06a81ae232f49d2946c84c05e391a7dff057496033c79507860 https://files.pythonhosted.org/packages/02/64/c6c1c24ff4dbcd789fcfdb782e343ac23c074f6b8b03e818ff60eb0f937f/numpy-1.12.1-cp34-cp34m-manylinux1_x86_64.whl#sha256=4eac5f2f624c5e7eecbdb51395ff39a099c48cab607a158f16f288c6fe39a2b3 https://files.pythonhosted.org/packages/1b/ee/f65826b2880f67652c21326565b4c166c7cdb1019f84b82af65e625475cd/numpy-1.13.1-cp34-cp34m-manylinux1_x86_64.whl#sha256=838e48df3703c8747f355cd6386e0680b906a2f7b2bbd304e8a2d531692484ce:
Double requirement given: numpy==1.12.1 from https://files.pythonhosted.org/packages/02/64/c6c1c24ff4dbcd789fcfdb782e343ac23c074f6b8b03e818ff60eb0f937f/numpy-1.12.1-cp34-cp34m-manylinux1_x86_64.whl#sha256=4eac5f2f624c5e7eecbdb51395ff39a099c48cab607a158f16f288c6fe39a2b3 (already in numpy==1.9.3 from https://files.pythonhosted.org/packages/fc/1b/a1717502572587c724858862fd9b98a66105f3a3443225bda9a1bd16ee14/numpy-1.9.3-cp34-cp34m-manylinux1_x86_64.whl#sha256=bff36563f9d6a06a81ae232f49d2946c84c05e391a7dff057496033c79507860, name='numpy')
Both numpy and pandas are installed globally with no problems. I tried re installing numpy, upgrading pip3, re installing setup tools. Nothing worked as expected, as i don't even understand the error message.
I had the same issue! [Ubuntu 16, python 3.5] After creating my virtual environment using python3 -m venv .env, I could not install pandas in my .env virtual environment. This is how I fixed it:
The pip version of my virtualenv was pip-8.1.1. I ran the following command to upgrade it to pip-20.0.2:
pip install --upgrade pip
Then, ran pip install pandas to install pandas successfully within my virtual env!
Successfully installed numpy-1.18.1 pandas-0.24.2 python-dateutil-2.8.1 pytz-2019.3 six-1.14.0
found this which did the job for me:
Double requirement given when trying to use pip install pandas
Double requirement given when trying to use pip install pandas
pip3 install 'pandas<0.21'
Not sure what is your problem. You should post what all you have done from the very beginning. Have you activated your virtualenv?
If you haven't this is how you can do it:
virtualenv venv
venv/bin/activate
I currently have installed pip 8.1.2.
So I want to upgrade it to the latest version (9.0.1) and I execute:
sudo pip install --upgrade pip
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 846kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.2
Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed pip-8.1.2
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
It seems that it correctly downloads 9.0.1 but then it refuses to uninstall the existing installation (8.1.2)
And then at the end it suggests me to upgrade using the same exact instruction I already provided!
Am I doing anything wrong?
The Ubuntu pip version has been patched to prevent self-upgrades (all installation into system-managed files are prevented, the patch is named hands-off-system-packages.patch). You are supposed to use the Ubuntu packaging system to upgrade instead. The feedback provided could be improved certainly.
As there is no Ubunutu package of pip 9.0.1 available yet for your Ubuntu version, you can't actually upgrade to a newer version this way (there is a version for Zesty however).
A (ugly) work-around is to use easy_install instead:
sudo easy_install -U pip
This works because easy_install has not been booby-trapped to prevent the upgrade. However, this'll replace system managed files with the newer pip version. If your package manager were to re-install the python-pip package, it'll happily overwrite those files and you could in theory end up with a broken installation. Also, easy_install adds more files than the package would, and those extra files could cause issues later down the line, especially when you upgrade python-pip later when a new version is packaged.
If you were to use a virtualenv, you are free to upgrade pip inside that, which works just fine.
If above are not working, please try this it works(I had similar situations and this works):
download get-pip.py:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Run the downloaded file: python get-pip.py
Above uninstalls the old version and install the latest ones.
Reference Link: https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py
Had a similar issue with pip not wishing to upgrade, though I'm not keen on replacing the package manager's version and as I'm always adding the --user option on installations via pip I figured "what's the harm?" in doing the same with pip on itself.
pip install --user --upgrade pip
It'll only work for one user but for some use cases that is just peachy.
I activated a virtualenv which has pip installed. I did
pip3 install Django==1.8
and Django successfully downloaded. Now, I want to open up the Django folder. Where is the folder located?
Normally it would be in "downloads", but I'm not sure where it would be if I installed it using pip in a virtualenv.
pip show <package name> will provide the location for Windows and macOS, and I'm guessing any system. :)
For example:
> pip show cvxopt
Name: cvxopt
Version: 1.2.0
...
Location: /usr/local/lib/python2.7/site-packages
pip list -v can be used to list packages' install locations, introduced in https://pip.pypa.io/en/stable/news/#b1-2018-03-31
Show install locations when list command ran with “-v” option. (#979)
>pip list -v
Package Version Location Installer
------------------------ --------- -------------------------------------------------------------------- ---------
alabaster 0.7.12 c:\users\me\appdata\local\programs\python\python38\lib\site-packages pip
apipkg 1.5 c:\users\me\appdata\local\programs\python\python38\lib\site-packages pip
argcomplete 1.10.3 c:\users\me\appdata\local\programs\python\python38\lib\site-packages pip
astroid 2.3.3 c:\users\me\appdata\local\programs\python\python38\lib\site-packages pip
...
This feature is introduced in pip 10.0.0b1. On Ubuntu 18.04 (Bionic Beaver), pip or pip3 installed with sudo apt install python-pip or sudo apt install python3-pip is 9.0.1 which doesn't have this feature.
Check https://github.com/pypa/pip/issues/5599 for suitable ways of upgrading pip or pip3.
pip when used with virtualenv will generally install packages in the path <virtualenv_name>/lib/<python_ver>/site-packages.
For example, I created a test virtualenv named venv_test with Python 2.7, and the django folder is in venv_test/lib/python2.7/site-packages/django.
Easiest way is probably
pip3 -V
This will show you where your pip is installed and therefore where your packages are located.
By default, on Linux, Pip installs packages to /usr/local/lib/python2.7/dist-packages.
Using virtualenv or --user during install will change this default location. If you use pip show make sure you are using the right user or else pip may not see the packages you are referencing.
In a Python interpreter or script, you can do
import site
site.getsitepackages() # List of global package locations
and
site.getusersitepackages() # String for user-specific package location
For locations third-party packages (those not in the core Python distribution) are installed to.
On my Homebrew-installed Python on macOS, the former outputs
['/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages'],
which canonicalizes to the same path output by pip show, as mentioned in a previous answer:
$ readlink -f /usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
/usr/local/lib/python3.7/site-packages
Reference: https://docs.python.org/3/library/site.html#site.getsitepackages
The safest way is to call pip through the specific python that you are executing. If you run pip show pip directly, it may be calling a different pip than the one that python is calling. Examples:
$ python -m pip show pip
$ python3 -m pip show pip
$ /usr/bin/python -m pip show pip
$ /usr/local/bin/python3 -m pip show pip
Here's an example showing how they can differ:
$ pip show pip
Location: /usr/local/lib/python3.9/site-packages
$ python -m pip show pip
Location: /Library/Python/2.7/site-packages
One can import the package then consult its help
import statsmodels
help(sm)
At the very bottom of the help there is a section FILE that indicates where this package was installed.
This solution was tested with at least matplotlib (3.1.2) and statsmodels (0.11.1) (python 3.8.2).