1

I've delete all the content of the file /usr/local/lib/python3.5/dist-packages. Now, I'm struggling trying to install virtualenvwrapper with pip :

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 6, in <module>
    from pkg_resources import load_entry_point
ImportError: No module named 'pkg_resources'

How could I fix it?

J.Doe
  • 21

1 Answers1

2

You had installed a version of Python under /usr/local. You have now removed part of it. You're trying to use a part that's still present, but it isn't going to work without the part that you've removed.

Unless your installation was extremely messy in the first place, /usr/local/bin/pip runs /usr/local/bin/python which looks for library files under /usr/local/lib/python3.5 (assuming that it's Python version 3.5). If you want to run that version of Python, you can't remove /usr/local/lib/python3.5. If you don't want to run that version of Python then you need to remove all of its files. This means removing /usr/local/bin/python and all the files that were installed with it, such as /usr/local/bin/pip. There are probably files in other directories as well, such as under /usr/local/man or /usr/local/share/man.

Uninstalling applications from /usr/local is messy, which is why it's recommended to use a package manager — either get packages from a Linux distribution, or use stow. See Keeping track of programs Since in your case the damage has been done, you'll need to track down the files to remove manually. Look for files whose modification time is about the same.

Once you've purged that installation of Python under /usr/local, running pip will invoke /usr/bin/pip which comes with your distribution (assuming that you've installed your distribution's Python packages — if you haven't, do it).

  • Kept banging my head on every post result that happened to pop up on google but nothings seemed to work. The reason explained in the this answer was my exact problem. Thanks for your contribution, I'd have never thought of this in a 100 years! – Fr0zenFyr Jul 16 '18 at 12:10