python ubuntu virtualenv -> error

python ubuntu virtualenv -> error

Newbie here, be kind.
The other day I am all:
sudo apt-get install python-virtualenv

And then I am (following instructions):
virtualenv env

And Ubuntu 10.10 is like:
Traceback (most recent call last):
File “/usr/local/bin/virtualenv”, line 5, in
from pkg_resources import load_entry_point
File “/usr/lib/python2.6/dist-packages/pkg_resources.py”, line 2675, in
parse_requirements(__requires__), Environment()
File “/usr/lib/python2.6/dist-packages/pkg_resources.py”, line 552, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: virtualenv==1.5.1

What gives?

Solutions/Answers:

Solution 1:

The python-virtualenv package should have installed virtualenv in /usr/bin/.

Instead, the traceback error message says you are running /usr/local/bin/virtualenv. Perhaps uninstall the /usr/local version of virtualenv, and try again.

Solution 2:

Had the same issue after upgrading to Ubuntu 11.04..

Turns out it was only because apt installed python-virtualenv 1.4, which was too old.

I removed the deb package and used pip install instead and it worked fine.

pip install virtualenv

References

Related:  OpenCV in Ubuntu 17.04