question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgrading to pip 10: It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

See original GitHub issue
  • Pip version: 10.0.0
  • Python version: 2.7
  • Operating system: Amazon ECS-Optimized Amazon Linux AMI 2017.09.i

Description:

I am trying to install docker-py, it is a usual part of our infrastructure setup workflow and we run it for quite some time. I get the following error for some packages:

Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Everything works as expected with pip 9.0.2. Did something change? What can I do to fix this? (except pinning the version of pip to 9.0.2 or 9.0.3)

What I’ve run:

First installation attempt with pip 10

# /usr/local/bin/pip2 install docker-py
Collecting docker-py
  Using cached docker_py-1.10.6-py2.py3-none-any.whl
Requirement already satisfied: six>=1.4.0 in /usr/local/lib/python2.7/site-packages (from docker-py) (1.11.0)
Requirement already satisfied: backports.ssl-match-hostname>=3.5; python_version < "3.5" in /usr/local/lib/python2.7/site-packages (from docker-py) (3.5.0.1)
Requirement already satisfied: ipaddress>=1.0.16; python_version < "3.3" in /usr/local/lib/python2.7/site-packages (from docker-py) (1.0.22)
Requirement already satisfied: websocket-client>=0.32.0 in /usr/local/lib/python2.7/site-packages (from docker-py) (0.47.0)
Collecting requests!=2.11.0,>=2.5.2 (from docker-py)
  Using cached requests-2.18.4-py2.py3-none-any.whl
Collecting docker-pycreds>=0.2.1 (from docker-py)
  Using cached docker_pycreds-0.2.2-py2.py3-none-any.whl
Requirement already satisfied: idna<2.7,>=2.5 in /usr/local/lib/python2.7/site-packages (from requests!=2.11.0,>=2.5.2->docker-py) (2.6)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/lib/python2.7/site-packages (from requests!=2.11.0,>=2.5.2->docker-py) (1.22)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/site-packages (from requests!=2.11.0,>=2.5.2->docker-py) (2018.1.18)
Collecting chardet<3.1.0,>=3.0.2 (from requests!=2.11.0,>=2.5.2->docker-py)
  Using cached chardet-3.0.4-py2.py3-none-any.whl
Installing collected packages: chardet, requests, docker-pycreds, docker-py
  Found existing installation: chardet 2.0.1
Cannot uninstall 'chardet'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Downgraded to pip 9.0.3 and then got this:

# /usr/local/bin/pip2 install docker-py
Collecting docker-py
  Cache entry deserialization failed, entry ignored
  Cache entry deserialization failed, entry ignored
  Downloading docker_py-1.10.6-py2.py3-none-any.whl (50kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 51kB 4.8MB/s
Requirement already satisfied: six>=1.4.0 in /usr/local/lib/python2.7/site-packages (from docker-py)
Requirement already satisfied: backports.ssl-match-hostname>=3.5; python_version < "3.5" in /usr/local/lib/python2.7/site-packages (from docker-py)
Requirement already satisfied: ipaddress>=1.0.16; python_version < "3.3" in /usr/local/lib/python2.7/site-packages (from docker-py)
Requirement already satisfied: websocket-client>=0.32.0 in /usr/local/lib/python2.7/site-packages (from docker-py)
Collecting requests!=2.11.0,>=2.5.2 (from docker-py)
  Cache entry deserialization failed, entry ignored
  Cache entry deserialization failed, entry ignored
  Downloading requests-2.18.4-py2.py3-none-any.whl (88kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 92kB 8.2MB/s
Collecting docker-pycreds>=0.2.1 (from docker-py)
  Cache entry deserialization failed, entry ignored
  Cache entry deserialization failed, entry ignored
  Downloading docker_pycreds-0.2.2-py2.py3-none-any.whl
Requirement already satisfied: idna<2.7,>=2.5 in /usr/local/lib/python2.7/site-packages (from requests!=2.11.0,>=2.5.2->docker-py)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/lib/python2.7/site-packages (from requests!=2.11.0,>=2.5.2->docker-py)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/site-packages (from requests!=2.11.0,>=2.5.2->docker-py)
Collecting chardet<3.1.0,>=3.0.2 (from requests!=2.11.0,>=2.5.2->docker-py)
  Cache entry deserialization failed, entry ignored
  Cache entry deserialization failed, entry ignored
  Downloading chardet-3.0.4-py2.py3-none-any.whl (133kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 143kB 7.7MB/s
Installing collected packages: chardet, requests, docker-pycreds, docker-py
  Found existing installation: chardet 2.0.1
    DEPRECATION: Uninstalling a distutils installed project (chardet) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling chardet-2.0.1:
      Successfully uninstalled chardet-2.0.1
  Found existing installation: requests 1.2.3
    Uninstalling requests-1.2.3:
      Successfully uninstalled requests-1.2.3
Successfully installed chardet-3.0.4 docker-py-1.10.6 docker-pycreds-0.2.2 requests-2.18.4
You are using pip version 9.0.3, however version 10.0.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

I also noticed issues with installing awscli, it complains some packages are not installed. (Installing them first fixes the issue though).

If i try to forcereinstall awscli for example, I get the same error for PyYAML:

 It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall. ```

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:14
  • Comments:41 (10 by maintainers)

github_iconTop GitHub Comments

207reactions
wangxf1987commented, Dec 20, 2018

I used follow steps and resolved this problem

  1. Reduced version: pip install --upgrade --force-reinstall pip==9.0.3
  2. Tried to re-install package: pip install xxx --disable-pip-version-check
  3. At last, recover the latest version for pip: pip install --upgrade pip
118reactions
JohnBDonnercommented, Aug 23, 2018

This seems to fix the issue for me: https://github.com/blockstack/blockstack-core/issues/504

In the orignal case above, that’d be:

pip install docker-py --ignore-installed PyYAML
Read more comments on GitHub >

github_iconTop Results From Across the Web

pip cannot uninstall <package>: "It is a distutils installed project"
It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a...
Read more >
[Solved] Cannot uninstall 'PyYAML'. It is a distutils installed ...
It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a...
Read more >
Python dependent library installation troubleshooting
It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a...
Read more >
error: cannot uninstall 'six'. it is a distutils installed project and ...
This error means that this package's metadata doesn't include a list of files that belong to it. Most probably, you have installed this...
Read more >
Pylint Cannot Run in Python Environment Created by...
It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found