How to update Python pip? - python

I've had to install Python packages and libraries using pip, but every time I do, it says I'm using an older version of pip, and that v18.1 is available by running the command
python -m pip install --upgrade pip
When I run this command, it just says the same thing. It apparently can't update itself because it's outdated. Is there any way to get around this, maybe by manually updating it?
Thanks in advance, community!
Update: The OS I'm using is currently Windows 10 and Python 3.6.4. The following screenshot is what outputs when running the command.

Upgrading pip
On Linux or macOS:
pip install -U pip
On Windows:
python -m pip install -U pip

Try with "python -m pip install --upgrade pip --user"
It worked with me and I am with Win10.

If you are on linux try this -
sudo su root
apt-get purge -y python-pip
wget https://bootstrap.pypa.io/get-pip.py
python ./get-pip.py
apt-get install python-pip
or
sudo -H pip3 install --upgrade pip
sudo -H pip2 install --upgrade pip

On OS X this worked for me
python -m pip install --upgrade pip

Related

How do I install pip on linux for Python 3.10.9

I was using sudo apt-get install python3-pip to get pip with older versions of Python, but as I understand I have to install a newer version of pip using some different approach because it is not uptodate using apt. I am using an Ubuntu pc and a Raspberry pi for reference, Many posts about this but what is the currently accepted approach as of Jan 2023? Thanks!
EDIT:
Using pip -V informes that it is using pip 20.3.4 (python 3.9)
I have Python 3.10.9 installed, and the console informs me version 22.3.1 is also installed
Requirement already satisfied: pip in /usr/local/lib/python3.10/site-packages (22.3.1)
Anyone know how to use version 22.3.1 ?
did you tested get-pip.py?
simply download it from here, and run
python get-pip.py
Based on my experience with Raspberry Pi, it should be straightforward with apt install.
sudo apt update
sudo apt install python3-pip
Verify the version:
pip3 --version
Odoo Forum Reference: https://www.odoo.com/forum/help-1/how-to-install-pip-in-python-3-on-ubuntu-18-04-167715
sudo apt-get install python3-pip and then use
python3 -m pip install --upgrade pip to upgrade pip
or you can do that.
sudo python3.10.9 -m pip install pip

How to install pip globally on Ubuntu 20.04, so that all users can use it the same way?

I set up a VMware machine under Windows 10, running Ubuntu 20.04.
The first thing I did after the installation was to install pip:
sudo apt install python3-pip
I then did:
sudo pip3 install --upgrade pip3
to which I got an error saying that the package pip3 doesn't exist. So I did:
sudo pip3 install --updgrade pip
which finished and installed pip 21.0.1
Now if I run pip3 with sudo, I have to type sudo pip3, but for a non-root user I have to use pip insted of pip3
sudo pip3 --version and sudo pip --version and pip --version return the same:
pip 21.0.1 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8)
But pip3 --version returns: bash: /usr/bin/pip3: No such file or directory
I just want to use the command pip3 both with and without root privilige and I don't understand what's happening here.
bash: /usr/bin/pip3: No such file or directory
This is because bash still remembers where it saw pip3 last time and the place was changed from /usr/bin/pip3 to /usr/local/bin/pip3. To clear its memory run hash -r. See command hash in bash manual.

Pip Install keeps installing libraries to Python2.7 rather than Python3

I'm trying to install modules such as gitpython into my Python3 directory however when I run:
Pip install gitpython it automatically downloads it into python2.7
I've tried specify the Python3 directory but it says the the library has already been installed.
Requirement already satisfied: gitpython in /usr/local/lib/python2.7/dist-packages (2.1.11)
Problem is when I try to call from git import repo my Python3 can't find the module.
Is there anyway to get pip to install my libraries to Python3 as a default, can I just uninstall Python 2.7 to save problems?
I run
sudo apt install python3-pip
and it states it is already installed, so I run sudo pip3 install gitpython and it says Command 'pip3' not found, but can be installed with:
sudo apt install python3-pip
SOLUTION
sudo apt-get remove python3-pip; sudo apt-get install python3-pip
It depends of your version of pip. But I think that python3-pip may do the trick.
sudo apt-get install python3-pip
sudo pip3 install MODULE_NAME
You should use pip3 to install your packages in your python3 environment. thus instead of installing with pip use pip3 install gitpython
You can try to see the version of python with:
python --version
if the result is python 2.7, that means that your environment variable for python3 needs to be set.
After that you can try:
python -m pip install package_name
I hope it will help you =)
Adrien
You should use python3 venv Python 3 venv
python3 -m venv /path/virtual/environment
source /path/virtual/environment/bin/activate
or use pip3 to installing any libraries for python 3
$ pip3 install 'some library'
You should create virtual environment for python3. using:
virtualenv -p /usr/bin/python3 <VIRTUAL_ENV NAME>
Then activate it using:
source <VIRTUAL_ENV NAME>/bin/activate
Then install your dependency(gitpython in your case) into that.

Unable to upgrade pip through cmd

This is the error I am getting in cmd
the pic of the error I am getting.
Try
python -m pip install --upgrade pip
pip3 install -U pip (for Python 3.x)
pip install -U pip (for Python 2.7)
easy_install -U pip
Try this:
python -m pip install --upgrade pip --user
It's permission issue. Need to add --user flag to the command.

unable to install scrapy-deltafetch

I am trying to install scrapy-deltafetch on ubuntu 14 using pip (v8.1.2 on python 2.7). When I run (sudo) pip install scrapy-deltafetch, I get the following error:
Update:
Complete output from command python setup.py egg_info:
Can't find a local Berkeley DB installation.
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-TVr3UZ/bsddb3/
Any thoughts on how to resolve this?
I have already ran the following:
sudo python ez_setup.py
pip install --upgrade setuptools
as well as
sudo apt-get install python-setuptools
I do have both python3 and python 2.7 on the computer.
I have tried installing bsdb3 but that does not work either. I will look into setting up berkeley db correctly and update here accordingly
Update:
Installing berkeley DB did not solve the issue.
scrapy-deltafetch requires bsddb3.
bsddb3 itself, on Ubuntu Trusty, depends on libdb5.3.
You can either install python-bsddb3 with apt-get, or only apt-get install libdb5.3. pip install scrapy-deltafetch should work after that.
Install libbd-dev first,
sudo apt-get install libdb-dev
then install deltafetch,
# for python2
sudo -H pip install scrapy-deltafetch
# for python3
sudo -H pip3 install scrapy-deltafetch

Categories

Resources