При обновлении pip ошибка

I wanted to install some libraries to learn machine learning. I say’s that i need to upgrade pip, but when i tried to install it

$ pip install --upgrade pip
Collecting pip
  Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 8.1.2
    Uninstalling pip-8.1.2:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 736, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 742, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 303, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip-8.1.2.dist-info/DESCRIPTION.rst'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

In summary, it seems I get into a loop where pip thinks I am using an outdated version of pip but when I try to upgrade it does NOT allow me. So I attempt an installation (from this question Jupyter Notebook can’t find modules for python 3.6):

(automl) brandomiranda~ ❯ pip3 install ipykernel --upgrade
python3 -m ipykernel install --user
Requirement already up-to-date: ipykernel in /usr/local/lib/python3.6/site-packages (5.1.3)
Requirement not upgraded as not directly required: jupyter-client in /usr/local/lib/python3.6/site-packages (from ipykernel) (5.3.4)
Requirement not upgraded as not directly required: traitlets>=4.1.0 in /usr/local/lib/python3.6/site-packages (from ipykernel) (4.3.3)
Requirement not upgraded as not directly required: appnope; platform_system == "Darwin" in /usr/local/lib/python3.6/site-packages (from ipykernel) (0.1.0)
Requirement not upgraded as not directly required: tornado>=4.2 in /usr/local/lib/python3.6/site-packages (from ipykernel) (6.0.3)
Requirement not upgraded as not directly required: ipython>=5.0.0 in /usr/local/lib/python3.6/site-packages (from ipykernel) (7.11.1)
Requirement not upgraded as not directly required: jupyter-core>=4.6.0 in /usr/local/lib/python3.6/site-packages (from jupyter-client->ipykernel) (4.6.1)
Requirement not upgraded as not directly required: pyzmq>=13 in /usr/local/lib/python3.6/site-packages (from jupyter-client->ipykernel) (18.1.1)
Requirement not upgraded as not directly required: python-dateutil>=2.1 in /usr/local/lib/python3.6/site-packages (from jupyter-client->ipykernel) (2.8.1)
Requirement not upgraded as not directly required: six in /usr/local/lib/python3.6/site-packages (from traitlets>=4.1.0->ipykernel) (1.11.0)
Requirement not upgraded as not directly required: ipython-genutils in /usr/local/lib/python3.6/site-packages (from traitlets>=4.1.0->ipykernel) (0.2.0)
Requirement not upgraded as not directly required: decorator in /usr/local/lib/python3.6/site-packages (from traitlets>=4.1.0->ipykernel) (4.4.1)
Requirement not upgraded as not directly required: backcall in /usr/local/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel) (0.1.0)
Requirement not upgraded as not directly required: pickleshare in /usr/local/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel) (0.7.5)
Requirement not upgraded as not directly required: pexpect; sys_platform != "win32" in /usr/local/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel) (4.7.0)
Requirement not upgraded as not directly required: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /usr/local/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel) (3.0.2)
Requirement not upgraded as not directly required: jedi>=0.10 in /usr/local/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel) (0.15.2)
Requirement not upgraded as not directly required: pygments in /usr/local/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel) (2.5.2)
Requirement not upgraded as not directly required: setuptools>=18.5 in /usr/local/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel) (39.0.1)
Requirement not upgraded as not directly required: ptyprocess>=0.5 in /usr/local/lib/python3.6/site-packages (from pexpect; sys_platform != "win32"->ipython>=5.0.0->ipykernel) (0.6.0)
Requirement not upgraded as not directly required: wcwidth in /usr/local/lib/python3.6/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=5.0.0->ipykernel) (0.1.8)
Requirement not upgraded as not directly required: parso>=0.5.2 in /usr/local/lib/python3.6/site-packages (from jedi>=0.10->ipython>=5.0.0->ipykernel) (0.5.2)
You are using pip version 10.0.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Installed kernelspec python3 in /Users/brandomiranda/Library/Jupyter/kernels/python3

ok fine, I will upgrade but then it thinks its already upgraded:

(automl) brandomiranda~ ❯ pip install --upgrade pip
Requirement already up-to-date: pip in ./miniconda3/envs/automl/lib/python3.7/site-packages (19.3.1)

but when I try the installation again it fails with the same message. It seems like a chicken and egg problem. Anyone know what’s going on?


Outdated:

I recently did a pip3 list to check what modules/projects I had installed in my virtual environment and I got a suggestion to upgrade pip. I tried but I can’t seem to make it update/upgrade. I did:

$ pip3 list
namespaces (4.2.0)
pip (8.0.2)
scikit-learn (0.18.1)
setuptools (19.4)
six (1.10.0)
wheel (0.26.0)
You are using pip version 8.0.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

so I tried doing that and it said it was working:

$ pip install --upgrade pip
Requirement already up-to-date: pip in /Users/user/home_simulation_research/hbf_tensorflow_code/venv/lib/python2.7/site-packages

since it said its alread there I did pip3 list again and it kept saying I didn’t actually have it upgraded. Since updating with the standard pip command didn’t work I instead tried using pip3 to do the update but it still didn’t work:

pip3 install --upgrade pip3
Collecting pip3
  Could not find a version that satisfies the requirement pip3 (from versions: )
No matching distribution found for pip3
You are using pip version 8.0.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Why doesn’t it work?


Just when I thought it didn’t work I tried using pip3 to upgrade pip and pip3 to upgrade pip3. For some reason the later doesn’t seem to work but the first one does. i.e. doing:

$ pip3 install --upgrade pip

worked (or at least pip3 list) stopped requesting me upgrade. Why is that? Is it just me or is this really strange behaviour?

  • smorman

Решил переустановить питон. Соответственно пришлось скачивать модули. Перед этим решил обновить pip:
pip install --upgrade pip
Выдало такую ошибку:

ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Отказано в доступе: 'C:\Users\Семья\AppData\Local\Temp\pip-uninstall-ciw3j_dd\pip.exe'
Consider using the `--user` option or check the permissions.


  • Вопрос задан

    более двух лет назад

  • 20076 просмотров

Скорее всего нет прав. Добавьте аргумент:--user

Надо запустить CMD от имени админа и ввести туда pip install —upgrade pip, работает. сам проверил

Пригласить эксперта

я пишу в эту тему, потому что оч долго пытался гуглить свою ошибку в инете, но эта информация не лежит на поверхности и первый источник по запросу эта тема.: наш любимый роскомик решил заблокировать неугодные ipшники и вместе с ними попал под раздачу https://files.pythonhosted.org/ . ERROR заключается в том, что при попытке обновить pip или скачать библиотеку через pip ( в моем случае до v20.3) нужен уже обновленный pip — маразм чистой воды. Но на https://habr.com/ru/info/welcome/feed/?back_link=h… (том же habr) я нашёл реальную причину. Можете прочесть но самый простой способ — vpn. Моя ошибка была следующей: ***4 раза error удаленный сервер не отвечает на запрос*** и WARNING: You are using pip version 20.2.1; however, version 20.3 is available. You should consider upgrading via the ‘C:pythonpython.exe -m pip install —upgrade pip’ command.

64542e0f6a655029613292.jpeg

сам cmd подсказывает как правильно., а именно от админа подать команду

python.exe -m pip install --upgrade pip


  • Показать ещё
    Загружается…

06 июн. 2023, в 14:37

1000 руб./за проект

06 июн. 2023, в 14:27

300 руб./за проект

06 июн. 2023, в 14:09

500 руб./в час

Минуточку внимания

If you’re programming in Python, its package manager, Pip is going to be your best friend. Pip makes installing Python packages a breeze by condensing the entire process to just a single command.

That said, Pip itself isn’t perfect and might run into random bugs or glitches from time to time. In this article, we’re taking a look at the “there was an error checking the latest version of pip” issue and giving you x ways to solve the problem. 

Also read: Top 7 Python IDEs and Text Editors for Data Science Applications


Solving Pip’s version issues

Every time you install a package using Pip, it first checks for the latest update for itself and if there’s one, Pip will update itself first before installing any packages. This ensures that the package manager gets the latest version of the package list and runs without any issues.

However, any problems during this update process can also hinder Pip’s functionality. If it can’t update itself before installing any other package, you’ll most likely not be able to install the final package as well.

Top 7 games for kids to learn coding | Candid.Technology

The main cause of this error is a bug in Pip version 22.1.1. If you’re using a Pip version before or after 22.1.1, you shouldn’t even run into this error at all. However, regardless of the installed version, the simplest solution to this problem is to just update Pip manually using this command.

python -m pip install --upgrade pip

Or

python3 -m pip install --upgrade pip

Wait for Python to finish updating Pip and once the process is complete, you shouldn’t see the error pop up anymore.

There’s also a chance that Pip’s dependencies may be causing problems. To make sure everything’s up to date, you can update setuptools and wheel using these commands once you’ve updated Pip.

pip install –upgrade wheel 
pip install –upgrade setuptools

Also read: How to solve the Tower of Hanoi problem using Python?

I am new to Linux and Ubuntu.

I was trying to upgrade pip but ran into this…

$ sudo pip install --upgrade pip
Cannot fetch index base URL https://pypi.python.org/simple/
Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-7.1.0-py2.py3-none-any.whl#md5=b108384a762825ec20345bb9b5b7209f
  Downloading pip-7.1.0-py2.py3-none-any.whl (1.1MB): 1.1MB downloaded
Installing collected packages: pip
  Found existing installation: pip 1.5.4
    Not uninstalling pip at /usr/lib/python2.7/dist-packages, owned by OS
Successfully installed pip
Cleaning up...

Any idea why?

Zanna's user avatar

Zanna

68.9k56 gold badges215 silver badges327 bronze badges

asked Jul 5, 2015 at 23:13

Spencer Lee's user avatar

4

Try install it with easy_install:

easy_install -U pip

Jens Erat's user avatar

Jens Erat

4,9637 gold badges30 silver badges37 bronze badges

answered Dec 9, 2015 at 7:33

NamPNQ's user avatar

NamPNQNamPNQ

3412 silver badges5 bronze badges

6

I had the same issue for a long time and figured out the solution today. When you install pip via python-pip, you download from the deprecated Linux server. You should download from the python server. To solve this, do the following:

sudo apt-get purge pip
sudo apt-get install python-setuptools
sudo apt-get install python-dev 
sudo easy_install pip 
pip install pip --upgrade 

xofer's user avatar

xofer

5684 silver badges7 bronze badges

answered Aug 29, 2017 at 19:00

user730924's user avatar

user730924user730924

711 silver badge1 bronze badge

4

This is caused by a conflict between a version of pip provided by a system package, like python-pip, and a version provided by PyPI through pip itself.

To fix this, simply remove python-pip with sudo apt-get purge python-pip.

If you had already used the old version of pip to install a newer version, this should leave the updated version in /usr/local/bin. If not, you can install the most recent version of Pip from scratch with:

Pip for Python 2.7:

curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | sudo python2.7

Pip for Python 3.x:

curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | sudo python3

Timothy C. Quinn's user avatar

answered Feb 7, 2017 at 14:21

Cerin's user avatar

CerinCerin

6,23912 gold badges68 silver badges96 bronze badges

1

Edit:

pip install -U pip

or

pip install --upgrade pip

-U is shorthand for --upgrade.


Old answer:

The apt system and PyPI uses two different mechanisms.

In Ubuntu’s repositories many modules of python are available as packages, but they are not much in numbers as compared to PyPI (The Python Package Index). To remain consistent about upgrading a package you need to consider the method you have used initially used to install it.

So if you have installed a package (module) from PyPI using pip then you should used pip to upgrade the package from PyPI (including pip itself). On the other hand if you have used apt system to install a module (as package) you need to use apt to upgrade that again.

In a nutshell, run the following to upgrade python-pip to the latest version :

sudo apt-get install python-pip

answered Jul 6, 2015 at 19:59

heemayl's user avatar

heemaylheemayl

89.8k20 gold badges198 silver badges264 bronze badges

4

Actually, you can edit your ‘pip’ script:

from root:

$ which pip  # -> prints 'pip' location

$ nano `which pip` # -> open with your editor, note the backticks!

replace the __requires__ with your latests pip version like:

__requires__ = 'pip==7.1.2'

than edit line with ‘load_entry_point’ call to:

load_entry_point(__requires__, 'console_scripts', 'pip')()

and:

$pip -V
pip 7.1.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)

also, i have to update my setuptools package, to install some packages.

answered Dec 7, 2015 at 16:17

s0rg's user avatar

s0rgs0rg

212 bronze badges

Use this link to upgrade. Basically:

  1. Download the file get-pip.py
  2. run python get-pip.py

answered Aug 26, 2016 at 17:23

Manish's user avatar

If python-pip installed from apt repositories with sudo user — run sudo -H install --upgrade pip , same for installing PIP modules .

Here the output from my console on 16.04

..... Successfully installed requests
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
:~$ pip install --upgrade pip
Collecting pip
  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 672kB/s 
Installing collected packages: pip
Successfully installed pip-8.1.1
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
:~$ sudo -H pip install --upgrade pip
Collecting pip
  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 692kB/s 
Installing collected packages: pip
  Found existing installation: pip 8.1.1
    Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed pip-9.0.1
:~$ 

also see What is the -H flag for pip? https://stackoverflow.com/questions/28619686/what-is-the-h-flag-for-pip

Community's user avatar

answered Apr 30, 2017 at 14:46

1

Try running sudo -H pip3 install --upgrade pip to upgrade your pip3 (for Python 3).
Conversely, you can do sudo -H pip2 install --upgrade pip to upgrade pip as well (for Python 2).

answered Jul 6, 2017 at 4:53

BhushanDhamale's user avatar

I ran into this problem when working on a remote machine I was ssh’d into. I had just installed python 3, and was unable to get pip to upgrade, even though I’d attempted to upgrade via both pip AND apt-get.

Logging out of the remote server and logging back in fixed it.

answered Nov 20, 2017 at 19:07

Teal Hobson-Lowther's user avatar

I’m only a beginner so I’m not sure but probably is something related to the differences between python 2 and 3. I think that is not necessary to be a superuser but you can do it easily using pip3 instead of pip also to upgrade pip :
pip3 install --upgrade pip

answered Jun 3, 2017 at 8:24

NBee's user avatar

I got similar problem on upgrading pip 9.0.3 to 18.0 version.

So on upgrading first uninstallation happens and then the latest version is installed. However, I found that on your first attempt it says «successfully uninstalled pip-9.0.3»

On subsequent attempts, we get the same error. This is because the pip-9.0.3 is uninstalled. As with the accepted answer, I installed pip as an admin in my windows 10 system, got thee latest version and then all was well.

Hope this helps.

answered Dec 27, 2018 at 10:38

Eswar's user avatar

EswarEswar

1214 bronze badges

Понравилась статья? Поделить с друзьями:
  • При обновлении gta 5 произошла ошибка диск поврежден
  • При обновлении nod32 выдает ошибку
  • При обновлении google play выдает ошибку
  • При обновлении miui произошла ошибка
  • При обновлении far cry 3 произошла ошибка