WebQube WebQube - 1 month ago 22
Python Question

failed to uninstall a pip

trying uninstall a pip

pip install -r requirements.txt
Requirement already satisfied (use --upgrade to upgrade): pika==0.9.14 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): pymongo==2.8 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 2))
Collecting requests==2.5.1 (from -r requirements.txt (line 3))
Using cached requests-2.5.1-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): flask-restful==0.3.3 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): pyaml==15.5.7 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 5))
Requirement already satisfied (use --upgrade to upgrade): graypy==0.2.11 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 6))
Requirement already satisfied (use --upgrade to upgrade): boto3==1.2.3 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 7))
Requirement already satisfied (use --upgrade to upgrade): raven==5.27.1 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 8))
Requirement already satisfied (use --upgrade to upgrade): Flask>=0.8 in /usr/local/lib/python2.7/dist-packages (from flask-restful==0.3.3->-r requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): pytz in /usr/local/lib/python2.7/dist-packages (from flask-restful==0.3.3->-r requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): six>=1.3.0 in /usr/local/lib/python2.7/dist-packages (from flask-restful==0.3.3->-r requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): aniso8601>=0.82 in /usr/local/lib/python2.7/dist-packages (from flask-restful==0.3.3->-r requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): PyYAML in /usr/local/lib/python2.7/dist-packages (from pyaml==15.5.7->-r requirements.txt (line 5))
Requirement already satisfied (use --upgrade to upgrade): futures<4.0.0,>=2.2.0; python_version == "2.6" or python_version == "2.7" in /usr/local/lib/python2.7/dist-packages (from boto3==1.2.3->-r requirements.txt (line 7))
Requirement already satisfied (use --upgrade to upgrade): botocore<1.4.0,>=1.3.0 in /usr/local/lib/python2.7/dist-packages (from boto3==1.2.3->-r requirements.txt (line 7))
Requirement already satisfied (use --upgrade to upgrade): jmespath<1.0.0,>=0.7.1 in /usr/local/lib/python2.7/dist-packages (from boto3==1.2.3->-r requirements.txt (line 7))
Requirement already satisfied (use --upgrade to upgrade): contextlib2 in /usr/local/lib/python2.7/dist-packages (from raven==5.27.1->-r requirements.txt (line 8))
Requirement already satisfied (use --upgrade to upgrade): Werkzeug>=0.7 in /usr/local/lib/python2.7/dist-packages (from Flask>=0.8->flask-restful==0.3.3->-r requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in /usr/local/lib/python2.7/dist-packages (from Flask>=0.8->flask-restful==0.3.3->-r requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): itsdangerous>=0.21 in /usr/local/lib/python2.7/dist-packages (from Flask>=0.8->flask-restful==0.3.3->-r requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /usr/local/lib/python2.7/dist-packages (from aniso8601>=0.82->flask-restful==0.3.3->-r requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): docutils>=0.10 in /usr/local/lib/python2.7/dist-packages (from botocore<1.4.0,>=1.3.0->boto3==1.2.3->-r requirements.txt (line 7))
Requirement already satisfied (use --upgrade to upgrade): markupsafe in /usr/local/lib/python2.7/dist-packages (from Jinja2>=2.4->Flask>=0.8->flask-restful==0.3.3->-r requirements.txt (line 4))
Installing collected packages: requests
Found existing installation: requests 2.8.0
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 736, in install
requirement.uninstall(auto_confirm=True)
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 695, in uninstall
for path in pip.wheel.uninstallation_paths(dist):
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 535, in unique
for item in fn(*args, **kw):
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 554, in uninstallation_paths
r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD')))
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1477, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1469, in get_metadata
return self._get(self._fn(self.egg_info, name))
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1580, in _get
with open(path, 'rb') as stream:
IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/requests-2.8.0.dist-info/RECORD'
Build step 'Execute shell' marked build as failure
Finished: FAILURE


can't seem to find a workaround or how to convince a pip that this is not installed.

Answer

Solved it by removing the directory :

sudo rm -rf /usr/local/lib/python2.7/dist-packages/requests-2.8.0.dist-info/

that way, it's not trying to uninstall anything