3

I want to install virtualenv on a Linux machine where I don't have root privileges. I saw the screencast at nettuts(http://net.tutsplus.com/tutorials/python-tutorials/python-power-tools-virtualenv/) and tried to follow the steps but getting the following error.

Any help is appreciated.

/home/x01010/python/virtualenv-1.9.1 > which python
/opt/xpyv/bin/python

/home/x01010/python/virtualenv-1.9.1 > python virtualenv.py foo
PYTHONHOME is set. You *must* activate the virtualenv before using it
Traceback (most recent call last):
File "virtualenv.py", line 2577, in <module>
main()
File "virtualenv.py", line 979, in main
no_pip=options.no_pip)
File "virtualenv.py", line 1081, in create_environment
site_packages=site_packages, clear=clear))
File "virtualenv.py", line 1289, in install_python
writefile(site_filename_dst, SITE_PY)
File "virtualenv.py", line 445, in writefile
f = open(dest, 'wb')
IOError: [Errno 2] No such file or directory: 'foo/lib/python26.zip/site.py'</module>

Thanks

Amit
  • 19,780
  • 6
  • 46
  • 54

2 Answers2

1

The problem is you can't create a virtualenv if PYTHONHOME is set.

If you're using a custom python build, you should install it (you can use --prefix to install it somewhere that doesn't need root access) and run:

/path/to/install/bin/python virtualenv.py foo
Guillaume
  • 10,463
  • 1
  • 33
  • 47
1

You have to activate virtual environment after creating it.

virtualenv --no-site-packages </path/to/new/environment>
source </path/to/new/environment>/bin/activate  

Just try after activating virtual environment.

Amit K.
  • 549
  • 2
  • 5
  • 11