I need to update offline a library in Python.
I have downloaded the library with pip download and then I try to update the library with the command:
pip install --no-index --user --find-links /tmp/pip/ --upgrade Werkzeug==0.15.5
which gives:
Ignoring indexes: https://...
Collecting Werkzeug==0.15.5
Installing collected packages: Werkzeug
Successfully installed Werkzeug-0.11.15
and then the library stays in the same version!
pip freeze | grep Wer
Werkzeug==0.11.15
Any ideas why this happens?
UPDATE: After the comment from #hoefling I rerun with the -vvv option and this is what I got:
pip install --no-index --user --find-links /tmp/pip2/ -vvv Werkzeug==0.15.5
Ignoring indexes: https://pypi:pypi#..../simple/
Collecting Werkzeug==0.15.5
0 location(s) to search for versions of Werkzeug:
Skipping link /tmp/pip2/werk/ (from -f); not a file
Found link file:///tmp/pip2/werk/Werkzeug-0.15.5-py2.py3-none-any.whl, version:
0.15.5
Local files found: /tmp/pip2/werk/Werkzeug-0.15.5-py2.py3-none-any.whl
Using version 0.15.5 (newest of versions: 0.15.5)
Installing collected packages: Werkzeug
Successfully installed Werkzeug-0.11.15
Cleaning up...
Try this command:
pip install Werkzeug-0.15.5.tar.gz
and the result must be like this:
Processing ./Werkzeug-0.15.5.tar.gz
Installing collected packages: Werkzeug
Running setup.py install for Werkzeug ... done
Successfully installed Werkzeug-0.15.5
This behaviour can happen because pip by default works with system Python which is located in /usr/bin/ on Linux. When installing the package, by giving Python --user flag your package is installed in your user's version of Python, probably located somewhere in ~/.local/.
To solve the problem you can install the package to your system Python, which is generally not recommended without --user flag. Another option is to use virtual environments and have the distribution that is made specifically for your project. Currently the recommended way is using venv.
$ python -m venv env
$ source env/bin/activate
(env) $ pip install ... (packages you need to install without --user flag)
(env) $ pip freeze
# should give you the packages you installed
This can help you not only with this example, but it can always keep your system Python installation clean and if you mess something up, you will only mess the environment you are having for specific project.
I have a brand new installation of python 3.7.1 64-bit and I'm using the latest pyCharm as my IDE. I have no other installation of python on this machine.
I go to install numpy and I get this message:
(venv) C:\Users\John\PycharmProjects\project>pip install numpy
Requirement already satisfied: numpy in c:\users\john\pycharmprojects\pysims\venv\lib\site-packages (1.15.4)
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
So I run the suggested command but it's already up-to-date
(venv) C:\Users\John\PycharmProjects\project>python -m pip install --upgrade pip
Requirement already up-to-date: pip in c:\users\john\pycharmprojects\pysims\venv\lib\site-packages (18.1)
So I check the version but it's still the old version
(venv) C:\Users\John\PycharmProjects\pySIMS>pip -V
pip 10.0.1 from c:\users\john\pycharmprojects\pysims\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip (python 3.7)
I thought I'd try py -3 to upgrade and it works.
(venv) C:\Users\John\PycharmProjects\pySIMS>py -3 -m pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 10.0.1
Uninstalling pip-10.0.1:
Successfully uninstalled pip-10.0.1
Successfully installed pip-18.1
But the version is still old
(venv) C:\Users\John\PycharmProjects\pySIMS>pip -V
pip 10.0.1 from c:\users\john\pycharmprojects\pysims\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip (python 3.7)
WHAT IS GOING ON? Am I missing something totally obvious? I've never had an issue like this working in Python 2 but since I've moved to Python 3 it's been nothing but errors.
This is looking like you have multiple installation of pip, one that comes first in the PATH (pip) and another that is recognized by python (python -m pip).
Try running the command:
pip show pip
and
python -m pip show pip
And check if the path are the same.
If not i would suggest uninstalling the undesired one, or change your your PATH environment variable to have the folder containing the correct pip come before the folder with the wrong one.
When I got this error I had 2 pip version folders in site-packages. One pip-19.2.3.dist-info and another something like pip-10.0.1. I deleted the first one, leaving only the default version. Then running python -m pip install --upgrade pip fixed the problem
I had a similar issue where I was upgrading pip; however, my issue what that I had a pip.conf file that pointed to a repo that didn't have the version to upgrade to. I removed the pip.conf to allow it to go to the default repo and it was able to download the correct version and upgrade.
1.Open you project setting(File>Settings)
2.Project>Project Interpreter
3.find pip and lick the triangle on the right(in the red circle I draw)
I'm creating a virtualenv with pyvenv env but the installed pip version is outdated. I can manually update pip in the virtual env but I would like to have the correct version automatically.
Without venv activated:
~> pip -V
pip 7.1.2 from /usr/lib/python3.4/site-packages (python 3.4)
Installing the venv:
~> pyvenv env
~> source env/bin/activate.fish
With venv activated:
~> pip -V
pip 6.0.8 from /home/syntonym/test/env/lib/python3.4/site-packages (python 3.4)
I'm using arch and have pip managed by both, pip and pacman (the arch packet manager), which is probably not a good idea. I still have no idea from where pyvenv gets a 6.0.8 version of pip or how to fix it. Reinstalling with pacman did not help.
EDIT:
ensurepip claims it's already up to date:
~> python -m ensurepip --upgrade
Ignoring indexes: https://pypi.python.org/simple
Requirement already up-to-date: setuptools in /usr/lib/python3.4/site-packages
Requirement already up-to-date: pip in /usr/lib/python3.4/site-packages
You can upgrade pip in a virtual environment manually by executing
pip install -U pip
You are facing this problem, because venv uses ensurepip to add pip into new environments:
Unless the --without-pip option is given, ensurepip will be invoked to
bootstrap pip into the virtual environment.
Ensurepip package won't download from the internet or grab files from anywhere else, because all required components are already included into the package. Doing so would add security flaws and is thus unsupported.
Ensurepip is not designed to give you the newest pip, but just "a" pip. To get the newest one use the manual way at the beginning of this post.
I'm having troubles with installing packages in Python 3.
I have always installed packages with setup.py install. But now, when I try to install the ansicolors package I get:
importerror "No Module named Setuptools"
I have no idea what to do because I didn't have setuptools installed in the past. Still, I was able to install many packages with setup.py install without setuptools. Why should I get setuptools now?
I can't even install setuptools because I have Python 3.3 and setuptools doesn't support Python 3.
Why doesn't my install command work anymore?
Your setup.py file needs setuptools. Some Python packages used to use distutils for distribution, but most now use setuptools, a more complete package. Here is a question about the differences between them.
To install setuptools on Debian:
sudo apt-get install python3-setuptools
For an older version of Python (Python 2.x):
sudo apt-get install python-setuptools
EDIT: Official setuptools dox page:
If you have Python 2 >=2.7.9 or Python 3 >=3.4 installed from
python.org, you will already have pip and setuptools, but will need to
upgrade to the latest version:
On Linux or OS X:
pip install -U pip setuptools
On Windows:
python -m pip install -U pip setuptools
Therefore the rest of this post related to Distribute is obsolete (e.g. some links don't work).
EDIT 2022-02-04
From Python 3.10 Distutils is deprecated and will be removed in Python 3.12 - use setuptools:
The entire distutils package is deprecated, to be removed in Python 3.12. Its functionality
for specifying package builds has already been completely replaced by
third-party packages setuptools and packaging ...
Distribute (deprecated)
Distribute - is a setuptools fork which "offers Python 3 support". Installation instructions for distribute(setuptools) + pip:
curl -O http://python-distribute.org/distribute_setup.py
python distribute_setup.py
easy_install pip
Similar issue here.
UPDATE: Distribute seems to be obsolete, i.e. merged into Setuptools: Distribute is a deprecated fork of the Setuptools project. Since the Setuptools 0.7 release, Setuptools and Distribute have merged and Distribute is no longer being maintained. All ongoing effort should reference the Setuptools project and the Setuptools documentation.
You may try with instructions found on setuptools pypi page (I haven't tested this, sorry :( ):
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | python
easy_install pip
Make sure you are running the latest version of pip
I tried to install Ansible and it failed with
ModuleNotFoundError: No module named 'setuptools_rust'
python3-setuptools was already in place, so upgrading pip solved it.
pip3 install -U pip
I was doing this inside a virtualenv on Oracle Linux 6.4 using Python 2.6, so the apt-based solutions weren't an option for me, nor were the Python 2.7 ideas. My fix was to upgrade my version of setuptools that had been installed by virtualenv:
pip install --upgrade setuptools
After that, I was able to install packages into the virtualenv.
The solution which worked for me was to upgrade my setuptools:
python3 -m pip install --upgrade pip setuptools wheel
For others with the same issue due to a different reason: This can also happen when there's a pyproject.toml in the same directory as the setup.py, even when setuptools is available.
Removing pyproject.toml fixed the issue for me.
pip uninstall setuptools
and then:
pip install setuptools
This works for me and fixes my issue.
When there's a pyproject.toml in the same directory as the setup.py, it can be the cause of the issue. I renamed that file, but it didn't solve the issue, so I restablished the original file name, and did the following change.
Under the [build-system] section, I added "setuptools" to the requires= list, and it worked.
First step #1
You have to install setuptools
On Linux:
pip install -U pip setuptools
On Mac OS:
pip install -U pip setuptools
On Windows:
python -m pip install -U pip setuptools
Second step #2
Make sure you have made it accessible (make it available in environmental variables)
On Linux
export PATH="INSTALLATIONDIRECTORY:$PATH"
On Mac OS
Sorry, I don't know.
On Windows
Open the Start Search, type in “env”, and choose “Edit the system environment variables”
Click the “Environment Variable” button.
Set the environment variables as needed. The New button adds an additional variable.
Dismiss all of the dialogs by choosing “OK”. Your changes are saved!
The distribute package provides a Python 3-compatible version of setuptools: http://pypi.python.org/pypi/distribute
Also, use pip to install the modules. It automatically finds dependencies and installs them for you.
It works just fine for me with your package:
[~] pip --version
pip 1.2.1 from /usr/lib/python3.3/site-packages (python 3.3)
[~] sudo pip install ansicolors
Downloading/unpacking ansicolors
Downloading ansicolors-1.0.2.tar.gz
Running setup.py egg_info for package ansicolors
Installing collected packages: ansicolors
Running setup.py install for ansicolors
Successfully installed ansicolors
Cleaning up...
[~]
this is how my problem was solved => pip3 install setuptools-rust
If you want to check your list => pip3 list
i faced this problem while trying to install elastalert2
System informations
CentOS Linux release 7.9.2009 (Core)
Python 3.6.8
pip 21.3.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
I ran into this problem when my pip requirements.txt file contained an editable library that was built using poetry and contained a pyproject.toml file. Following the documentation for setuptools, my solution was to add setuptools to the build-system requirements in the pyproject.toml file as follows:
[build-system]
requires = ["poetry-core>=1.0.0", "setuptools"]
build-backend = "poetry.core.masonry.api"
If pip isn't installed, like for example if it's coming from the Deadsnakes PPA, or a Docker environment, the best way to fix this error is by bootstrapping it by running
python -m ensurepip
Windows 7:
I have given a complete solution here for Python Selenium WebDriver:
Setup easy install (Windows - simplified)
download ez.setup.py (https://bootstrap.pypa.io/ez_setup.py) from 'https://pypi.python.org/pypi/setuptools'
move ez.setup.py to C:\Python27\
open cmd prompt
cd C:\Python27\
C:\Python27\python.exe ez.setup.py install
I ran sudo python setup.py build_ext -i and it failed with No module named setuptools.
I solved it with this command:
<i>sudo apt-get install python-setuptools</i>
A few years ago I inherited a Python (2.7.1) project running under Django-1.2.3 and now was asked to enhance it with QR possibilities. I got the same problem and did not find pip or apt-get either. So I solved it in a totally different, but easy way.
I /bin/vi-ed the setup.py and changed the line
"from setuptools import setup"
into:
"from distutils.core import setup"
The PyPA recommended tool for installing and managing Python packages is pip. pip is included with Python 3.4 (PEP 453), but for older versions here's how to install it (on Windows):
Download https://bootstrap.pypa.io/get-pip.py
>c:\Python33\python.exe get-pip.py
Downloading/unpacking pip
Downloading/unpacking setuptools
Installing collected packages: pip, setuptools
Successfully installed pip setuptools
Cleaning up...
>c:\Python33\Scripts\pip.exe install pymysql
Downloading/unpacking pymysql
Installing collected packages: pymysql
Successfully installed pymysql
Cleaning up...
On macOS, if you have homebrew installed, simply run:
brew install rust
If you still find this issue, try this:
python3 -m pip install scrapy --upgrade --force --user
While trying to install socketIO I had the same issue. At my system (Windows 11) setupTools were there twice. At C:\Program Files\Python310\Lib\site-packages\ and at C:\Users\user\AppData\Roaming\Python\Python310\site-packages\
Had to uninstall one of them.
Working on Debian, sometime it can be because of older pip version. Therefore, update pip>
python -m pip install -U pip
I had such a problem to install pyunicorn. I wanted to install it on Google Colab. I tried installing pyunicorn directly from Github and it worked for me. For example in my case it was like this:
pip install git+https://github.com/pik-copan/pyunicorn.git#egg=pyunicorn
I have been following the instructions on http://docs.python-guide.org/en/latest/starting/install/osx/ but for some reason this is not going as I believe it would be expected.
I have python 2.7 running by default but had to get easy_install up-to-date by following the instructions on: https://superuser.com/questions/256717/easy-install-the-wrong-version-of-python-modules-mac-os and link it from /usr/local/bin/share to /usr/local/bin. It seems to be working fine.
The problem is that now when I install pip it seems to install to 2.6 and not 2.7.
darky:~ user$ easy_install --upgrade pip
Searching for pip
Reading http://pypi.python.org/simple/pip/
Reading http://pip.openplans.org
Reading http://www.pip-installer.org
Best match: pip 1.1
Processing pip-1.1-py2.6.egg
pip 1.1 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
Installing pip-2.6 script to /usr/local/bin
Using /Library/Python/2.6/site-packages/pip-1.1-py2.6.egg
Processing dependencies for pip
Finished processing dependencies for pip
After the comments from MartijnPieters this problem NO LONGER persists
darky:~ user$ /usr/local/share/python/easy_install-2.7 pip
Searching for pip
Best match: pip 1.1
Processing pip-1.1-py2.7.egg
pip 1.1 is already the active version in easy-install.pth
Installing pip script to /usr/local/share/python
Installing pip-2.7 script to /usr/local/share/python
Using /usr/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
darky:~ user$ pip install virtualenv --upgrade
Requirement already up-to-date: virtualenv in /Library/Python/2.6/site-packages
Cleaning up...
But pip still creates environments with python-2.6. So I have to point it to the proper pyhton interpreter.
darky:pytravisci pedrorodrigues$ virtualenv --python=/usr/local/bin/python2.7 ENV
Running virtualenv with interpreter /usr/local/bin/python2.7
New python executable in ENV/bin/python
Installing setuptools............................done.
Installing pip...............done.
You can use
easy_install-2.7
or if you don't have that alias:
python2.7 -m easy_install <stuff>
For pip:
pip2.7