pip freeze gives different version from pip --version - python

I am on Windows 10 and just installed Python 3.7.4. I installed virtualenv using pip install virtualenv, and i got the message that i installed 16.7.2 while 19.2.1 is available. I then used python -m pip install --upgrade pip to upgrade.
Here is the issue: when i type pip freeze on Powershell, i am getting this:
virtualenv==16.7.2
but when i type pip --version, i am getting this:
pip 19.2.1 from c:\users\user1\python\lib\site-packages\pip (python 3.7)
Can you please let me know why pip freeze still shows the old version?
Thanks.

pip and virtualenv are 2 different cases where pip is mainly used for installing python packages and virtualenv for utilizing virtual environments while development.
The following command updates only pip not virtual env
python -m pip install --upgrade pip
If you think you still need to upgrade virtualenv (of course if a new version is available). Please follow the following syntax without specifying a version.
pip install [package] --upgrade

Related

How can I change pip version

I'm using python3.8.6 and I need to upgrade to 3.9.x. After upgrade the python, myproject.py cannot find a module that already installed using pip3 install opencv-python.
when run python3 myproject.py occurs error that ModuleNotFoundError tensorflow, and tensorflow should be 2.5.x so I'm trying to install python 3.9.x.
pip --version shows pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
How can I change that (python3.8) to (python3.9)?
sorry for my bad English..
python -m pip install –upgrade pip.
If you type pip list it will show you every package installed and should say something like WARNING: You are using pip version 21.2.3; however, version 21.2.4 is available.
You should consider upgrading via this command:
c:\users\x\python.exe -m pip install --upgrade pip

Upgrading pip for different versions of python

I have two versions of python installed on my computer (3.6 and 3.7). Just upgraded pip to the latest version (19.0.1) using the command python -m pip install --upgrade pip however i think it only upgraded the pip for python version 3.6. When attempting to install a package specifically for python version 3.7 with the following command pip3.7 install scipy i got the message saying You are using pip version 18.1, however version 19.0.1 is available. Clearly only the pip for version 3.6 was upgraded. I cannot figure out a command to upgrade 3.7 pip as well. I tried the following:
python -m pip3.7 install --upgrade pip
This did not work (Trying to use the logic of how packages are handled for different versions of python). Could not find a question that addressed this specific issue. Any help would be greatly appreciated.
Use the python 3.7 interpreter to run the command:
python3.7 -m pip install --upgrade pip
Or use the pip3.7 binary directly:
pip3.7 install --upgrade pip
export LD_LIBRARY_PATH=/usr/lib64
activate pip3
I ran into the same problem. If you have Microsoft Visual also installed the best command to use is
py -m pip install --upgrade pip --user
I used that command, and it worked like a charm.

How to upgrade pip in virtual environment?

This question has already been asked here, though there is no answer solving this problem.
pip upgrade fails inside virtual environment
The above question is duplicate and the references following answer:
gaierror: [Errno -2] Name or service not known
But this answer doesnot contain anything valid. The former answer also does not contain any helpful info!
My problem is exactly what is described in first link. I try upgrade pip from 10.0.1 to 18.1 but unable to. As a consequence I am unable to install Tensorflow. This Virtual environment is actually connected to pycharm and I am referencing it through command line. Here is the input and corresponding commandline output:
(venv) G:\Ashish\Tensorflow\venv\Scripts>pip install --upgrade pip
ERROR: To modify pip, please run the following command:
G:\Ashish\Tensorflow\venv\Scripts\python.exe -m pip install --upgrade pip
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.
(venv) G:\Ashish\Tensorflow\venv\Scripts>G:\Ashish\Tensorflow\venv\Scripts\python.exe -m pip install --upgrade pip
Requirement already up-to-date: pip in g:\ashish\tensorflow\venv\lib\site-packages (18.1)
(venv) G:\Ashish\Tensorflow\venv\Scripts>pip --version
pip 10.0.1 from g:\ashish\tensorflow\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip (python 3.7)
(venv) G:\Ashish\Tensorflow\venv\Scripts>pip install --upgrade pip
ERROR: To modify pip, please run the following command:
G:\Ashish\Tensorflow\venv\Scripts\python.exe -m pip install --upgrade pip
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.
(venv) G:\Ashish\Tensorflow\venv\Scripts>
I tried uninstalling the pip from virtual environment. I did not work. I am sorry if this is basic or involves basic knowledge about virtual env, This is my learning phase and some time before I can start to contribute to this awesome community.
Ok, solved the problem, thanks to suggestions of #hoefling and#Rahul Bhardwaj
For python environment showing 10.0.1 and 18.1:
pip in your virtual environment is 18.1 while the global pip is 10.0.1. So the issue is solved, simply upgrade global pip
For tensorflow not installing:
Install python 3.6
Add that to path
Create a virtual environment in pycharm using python 3.6
Install tensorflow
Done! Python 3.7 is yet to support tensorflow

inconsistent pip version in PyCharm

I'm using PyCharm on Windows. I have a project setup for small experiments with algorithms that uses it's own virtual environment. I was trying to install tensorflow and I got an error that I'm running pip 10.0.1 and should upgrade to 18.1, which I did through "File/Settings/Project Interpreter". It now says 18.1. But I'm still getting warnings about using version 10.0.1.
(venv) C:\users\xxx\pycharmprojects\so> pip list
...
pip 10.0.1
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.
(venv) C:\users\xxx\pycharmprojects\so>python -m pip install --upgrade pip
Requirement already up-to-date: pip in c:\users\xxx\pycharmprojects\so\venv\lib\site-packages (18.1)
(venv) C:\users\xxx\pycharmprojects\so> pip list
...
pip 10.0.1
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.
(venv) C:\users\xxx\pycharmprojects\so>python -m pip list
...
pip 18.1
After a bit of discussion, we've got the problem solved.
Here's what was wrong:
PyCharm is unable to properly update pip under Windows while using virtualenv (possible bug/issue)
The reason why installation of Tensorflow was failing at first place was that it strictly requires Python3.5 under Windows, while the problem occured with Python3.7, so switching to Python3.5 VirtualEnv in PyCharm solved the issue.
NOTE: No pip update was required in order to install Tensroflow with Pycharm + Python3.5 venv
It has happened to me after upgrading to Python 3.7.1 and pip 19.0.3.
It was solved after making sure that both new Python installation folder and corresponding Scripts folder are included in the PATH environment variable prior to creating a new virtual environment for my project.

Pip install results in error "no such option: -E"

I just cleaned up my mac after a mavericks install (yeah, i'm late to the party).
I'm using homebrew Python but I've confirmed this error with the stock apple python as well. I've got pip 1.5.6 installed system-wide and also in my virtualenv.
I can pip-sys install for system-wide pip installs no problem. When In a virtualenv though, I get the following error, even with which pip.
pip install -U -r requirements/dev.pip
Usage:
pip <command> [options]
no such option: -E
Seems there is something wrong with the pip install within the virtualenv. Pip is not working but pip2 install works fine. So maybe there's a version conflict where pip installs thinking it's a different python version from what was installed.
To recap
pip install south
fails with above error
pip2 install south
works fine.

Categories

Resources