Upgrading pip3 for newer python version - python

I upgraded python from 3.6.1 to 3.9.2. However, and when I check the pip3 version, it's still using the old python:
$ pip3 --version
pip 21.0.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
My objective would be to upgrade pip but, more importantly, that pip3 pointed to /usr/local/lib/python3.9/site-packages/pip in order to use the upgraded python.
P.S. Erasing and reinstalling pip3 did not work, it still takes the old python3.

Related

update pip to be consistent with python in ubuntu 20.04

I have python 3.8 as the default install with ubuntu 20.04.
I have upgraded to python 3.11.
However, if i do pip3 --version is see this:
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
In windows i just do pip install <package> and i want to achieve the same level of simplicity in ubuntu.
How to get this to upgrade too (python 3.11) or whatever the latest version of python is in Ubuntu ?

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

AWS cloud9 pip install goes to python 2.7 instead of 3.6

this question is specifically for aws cloud9. Everything looks fine prima-facie, but it's creating a lot of problems.
When i am checking python version, it's showing the correct version (without using python3)
xxxx#yyyyy.zzz:~/environment $ python --version
Python 3.6.8
When i am using which python, it's showing the correct (desired) python version
xxxx#yyyy.zzz:~/environment $ which python
alias python='python36'
/usr/bin/python36
When i am checking pip version, it's showing pip version for python 3.6, but showing a very old version of pip.
xxxx#yyyy.zzz:~/environment $ python -m pip --version
pip 9.0.3 from /usr/lib/python3.6/dist-packages (python 3.6)
When i try to upgrade pip to new version, it goes to python2.7 now (undesirable)
xxx#yyyy.zzz:~/environment $ pip install --upgrade pip
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Requirement already up-to-date: pip in /usr/local/lib/python2.7/site-packages (20.0.2)
so, when i do a pip install of a desired package, it gets installed, but cannot use it in my program as it installs for python 2.7.
I have gone past this issue on my local windows computer a long time ago. However, this is a ec2 default environment that comes when setting up cloud9, and is a linux ubuntu dist (afaik).
Have tried to find out online, but couldn't get a simple answer. I could find answers relating to using virtualenv for these kind of issues. I am wondering if there is a simpler solution to this.
I finally resolved it by unaliasing "python" with python36.
unalias python
Then when i went to ask python version, it gave python 2.7 (as expected)
then i went for
sudo python3 -m pip install --upgrade pip
it finally worked and upgraded pip to latest.
then i could download other libraries using
python3 -m pip install <library-name>
Thanks Arun for your extensive help.
This solution may be a workaround, but it finally made it work. If anyone wants me to find the solution further, i am ready to engage.
python is an alias to point to python36. Looks like you have python 2 and python 3 installed.
python -m pip --version is returning the pip version pointing to python3 because python here refers to python3. If you try python2.7 -m pip --version it will return the pip version corresponding to python2.7
You should rather check pip --version to see the version of pip.
You could install your packages using pip3 install <package-name> or set an alias for pip to point to pip3
which pip3
Once you get the path of pip3, then you can create the alias
alias pip=`<path to pip3>

MacOS - Are my pip and pip3 locations correct?

I am new to python (not new to programming) and unfortunately butchered my previous python 3.7 installation while figuring things out. Long story short, I ended up deleting and reinstalling pip3, which in turn made the standard pip command (for the 2.7 pre-installed version of python o macOS) not exist. I've managed to get both installed again but am concerned with their locations.
My question is regarding the locations of both pip and pip3 when running the pip --version as well as the pip3 --version command.
Below is the output for these commands:
pip --version
pip 19.3.1 from /Users/Wyatt/Library/Python/2.7/lib/python/site-packages/pip (python 2.7)
pip3 --version
pip 19.2.3 from /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)
I believe pip3 is in the correct location, but feel that the pip command should not be located inside of my user library, but the system library like pip3. Is this correct, and if not, how can I fix this?
On my local machine MacOs the default pip resides at the following location
pip --version
pip 19.3.1 from /Library/Python/2.7/site-packages/pip-19.3.1-py2.7.egg/pip (python 2.7)
And after installing python3 using HomeBrew brew install python3, pip3 location is the following.
pip3 --version
pip 19.3.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)

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.

Categories

Resources