I\'m trying to use virtualenv in Ubuntu to install a local virtual Python environment. When I run the shell command:
$ virtualenv ./virt_python
<
The problem is that recent versions never download neither setuptools (distribute) nor pip and expect to find their wheels locally. Usually virtualenv says something like
Cannot find a wheel for setuptools
Cannot find a wheel for pip
and fails with the ImportError after that. This is documented:
If no satisfactory local distributions are found, virtualenv will fail. Virtualenv will never download packages.
You may want to check if you have VIRTUALENV_EXTRA_SEARCH_DIR
set in your environment or the corresponding option in virtualenv's config file and disable this.
To find out where virtualenv actually searches for the packages you can temporarily add either print statements in /usr/local/lib/python2.6/dist-packages/virtualenv.py
or somethig like import pdb; pdb.set_trace()
. The function in question is find_wheels
and you make it look something like this:
def find_wheels(projects, search_dirs):
# … skipping docstring and comments
for project in projects:
for dirname in search_dirs:
print '*** search_dir:', dirname
files = glob.glob(os.path.join(dirname, project + '-*.whl'))
if files:
wheels.append(os.path.abspath(files[0]))
break
else:
logger.fatal('Cannot find a wheel for %s' % (project,))
return wheels