Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pip cannot find metadata file - EnvironmentError

Whenever I run pip to install the Flask packages like virtualenv in Ubuntu 16.04, I get this error:

pip install virtualenv

Requirement already satisfied: virtualenv in ./.local/lib/python3.5/site-packages (16.1.0) No metadata found in ./.local/lib/python3.5/site-packages Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/usr/.local/lib/python3.5/site-packages/virtualenv-16.1.0.dist-info/METADATA'

Here are my pip and python versions:

pip --version pip 19.0.1 from /usr/.local/lib/python3.5/site-packages/pip (python 3.5)

python3 --version Python 3.6.8

I already tried almost all that I get from the internet to solve this issue like:

/usr/.local/bin/pip install virtualenv

But I still get the same error.

I also go into the dist folder to copy the metadata.json with METADATA, but there's no metadata.json file inside.

cd /usr/.local/lib/python3.5/site-packages/virtualenv-16.1.0.dist-info/ cp metadata.json METADATA

cp: cannot stat 'metadata.json': No such file or directory

Please help me, I'm stucked with this issue for days. Thanks!

like image 535
Zhanrah Avatar asked Feb 06 '19 11:02

Zhanrah


2 Answers

I meet the same problem

ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/root/anaconda3/lib/python3.6/site-packages/tornado-6.0.4.dist-info/METADATA

then I cd /root/anaconda3/lib/python3.6/site-packages/tornado-6.0.4.dist-info/ && ls

DESCRIPTION.rst  LICENSE.txt  metadata.json

finally, I did cp metadata.json METADATA solved the problem. maybe this is helpful to you.

like image 169
Stephen Avatar answered Sep 28 '22 02:09

Stephen


I encountered the same problem recently.

Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '~/.local/lib/python3.7/site-packages/pip-19.0.1.dist-info/METADATA'

In the folder

~/.local/lib/python3.7/site-packages/pip-19.0.1.dist-info/

I found another one named pip-19.0.1.dist-info, and the last one contained all the required files for the pip.

I just used

cd ~/.local/lib/python3.7/site-packages/pip-19.0.1.dist-info/
cp -r ./pip-19.0.1.dist-info/* ./
rm -r ./pip-19.0.1.dist-info

Obviously that you need to replace python version with your own and also check if files

entry_points.txt  INSTALLER  LICENSE.txt  METADATA  RECORD  top_level.txt  WHEEL

are in here.

Maybe it will help you, luck.

like image 39
Alexandr Vasilyev Avatar answered Sep 28 '22 03:09

Alexandr Vasilyev