I want to use python3.5 for development, but many times when I install the module for python 3.5, it always fails. The terminal tells me that a higher version is available, but it doesn't work when I upgrade it.
You are using pip3 to install flask-script which is associated with python 3.5. However, you are trying to upgrade pip associated with the python 2.7, try running pip3 install --upgrade pip.
It might be a good idea to take some time and read about virtual environments in Python. It isn't a best practice to install all of your packages to the base python installation. This would be a good start: http://docs.python-guide.org/en/latest/dev/virtualenvs/
To upgrade your pip3, try running:
sudo -H pip3 install --upgrade pip
Your pip may move from /bin to /usr/local/bin
To upgrade pip as well, you can follow it by:
sudo -H pip2 install --upgrade pip
Try this command:
pip3 install --upgrade setuptools pip
First decide which pip you want to upgrade, i.e. just pip or pip3.
Mostly it'll be pip3 because pip is used by the system, so I won't recommend upgrading pip.
The difference between pip and pip3 is that
NOTE: I'm referring to PIP that is at the BEGINNING of the command
line.
pip is used by python version 2, i.e. python2
and
pip3 is used by python version 3, i.e. python3
For upgrading pip3: # This will upgrade python3 pip.
pip3 install --upgrade pip
For upgrading pip: # This will upgrade python2 pip.
pip install --upgrade pip
This will upgrade your existing pip to the latest version.
The Problem
You use pip (the Python 2 one). Now you want to upgrade pip (the Python 3 one). After that, pip is the Python 3 one.
The solution
Use pip2 and pip3. This way it is explicit.
If you want to use pip, just check where it is (which pip) and change the link. For example:
$ which pip
/usr/local/bin/pip
$ pip --version
pip 9.0.1 from /usr/local/lib/python3.5/dist-packages (python 3.5)
$ which pip2
/usr/local/bin/pip2
$ sudo rm /usr/local/bin/pip
$ sudo ln -s /usr/local/bin/pip2 /usr/local/bin/pip
$ pip --version
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
for Python 3:
python3 -m pip install --upgrade pip
for Python 2:
python2 -m pip install --upgrade pip
What worked for me was the following command:
python -m pip install --upgrade pip
pip3 install --upgrade pip worked for me
In Ubuntu 18.04, below are the steps that I followed.
python3 -m pip install --upgrade pip
For some reason you will be getting an error, and that be fixed by making bash forget the wrongly referenced locations using the following command.
hash -r pip
If you have 2 versions of Python (eg: 2.7.x and 3.6), you need do:
add the path of 2.x to system PATH
add the path of 3.x to system PATH
pip3 install --upgrade pip setuptools wheel
for example, in my .zshrc file:
export PATH=/usr/local/Cellar/python#2/2.7.15/bin:/usr/local/Cellar/python/3.6.5/bin:$PATH
You can exec command pip --version and pip3 --version check the pip from the special version. Because if don't add Python path to $PATH, and exec pip3 install --upgrade pip setuptools wheel, your pip will be changed to pip from python3, but the pip should from python2.x
This worked for me (mac)
sudo curl https://bootstrap.pypa.io/get-pip.py | python
If you try to run
sudo -H pip3 install --upgrade pip3
you will get the following error:
WARNING: You are using pip version 19.2.3, however version 21.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
but if you upgrade using the suggested command:
pip install --upgrade pip
then, the legacy pip will be upgraded, so what I did is the following:
which pip3
and I located my pip3 installation (just in case the following command wouldn't upgrade the legacy pip. Then i changed to that directory and upgraded pip3 using the following commands: (your directory could be different)
cd /Library/Frameworks/Python.framework/Versions/3.8/bin
sudo -H pip3 install --upgrade pip
after this:
pip --version
will still show the legacy version, while
pip3 --version
will show pip 21.0.1
Related
I installed Python 3.10 today but when I try to run pip or pip3, the command prompt gives me an error. I tried following the instructions that the top answer in this question said. My complete path to the python interpreter is this:
C:\Users\User\AppData\Local\Microsoft\WindowsApps\python3.exe
In the WindowsApps directory, I'm supposed to have a Scripts folder. Strangely enough, I don't. Can someone please help me?
Check if pip3 is already installed
pip3 -v
if it is installed the output should be like that
C:\Python38\python.exe -m pip <command> [options]
Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
...
...
Pip3 Upgrade
python -m pip3 install --upgrade pip
Pip3 Downgrade
python -m pip3 install pip==19.0
You can try python -m pip to use pip if it is installed.
If pip is not installed, you can always use python -m ensurepip --upgrade to install pip for your python installation.
Take a look at the following post
How can I install pip on Windows?
py -3 -m ensurepip
Whenever I try to install the SpeechRecognition package within my Python environment it keeps telling me You are using pip version 10.0.1, however version 20.3.3 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command., However, when I check the pip version I can see that it's on the latest version. The package doesn't install and continues to show this message.
Also just an off question, what does the -m wildcard do for the pip install command?
Any ideas?
Thanks in advance,
-Yaseen
Try to upgrade the pip using this command:
python -m pip install --upgrade pip
I'm trying to upgrade pip on Centos 7. I pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7) installed.
When I run pip install --upgrade pip --user I get the following output:
Collecting pip
Using cached https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-8.1.2
You are using pip version 8.1.2, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
What I've tried
I've tried the following, which have all resulted in the same output and result as above:
pip install --upgrade pip --user
pip install -U pip --user --ignore-installed
pip install -U pip --user --ignore-installed --no-cache-dir
sudo yum update pip which returns
No Match for argument: pip
No package pip available.
No packages marked for update
sudo yum update python-pip which returns No packages marked for update
Observations
python -m pip --version outputs:
pip 19.3.1 from /home/deploy/.local/lib/python2.7/site-packages/pip (python 2.7)
pip --version outputs:
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
You need to update your PATH to include /home/deploy/.local/lib/python2.7/bin before /usr/lib/python2.7/bin if you want pip to resolve to the same location as python. Otherwise, python -m pip is the more proper usage pattern
Otherwise, you're looking at two completely separate python installations and pip is indeed upgraded in one of them
Note: Python2 is end of life, so probably best to remove the one in your home folder, anyway, and switch to using something like Pipenv or pyenv
I have been using Python2 and pip for a long time and recently installed Python3 and pip3. I want to migrate all pip packages to pip3. How to install all the package at one go?
Since my pip list shows a long list of packages installed using pip, it is very hectic to install them one by one using pip3.
First, save all the packages using pip freeze > requirements.txt then run pip3 install -r requirements.txt
Assuming you want to install all your python2 packages for python3, use
$ pip3 install --user `pip freeze`
My installation of pip seems to be convinced it is out of date:
$ sudo pip install editable .
<my stuff gets installed>
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
$ pip --version
pip 8.1.2 from /home/wash/.local/lib/python2.7/site-packages (python 2.7)
$ python --version
Python 2.7.11+
I am running Debian 8.0. I've tried running pip install --upgrade pip as it has requested.