Julien Spronck
Julien Spronck

Reputation: 15433

Permission denied when attempting to create a virtualenv on a shared host

I'm on a shared host (siteground) without root access. I was trying to create a virtual environment. Here is what I have done so far:

# Download pip
wget https://bootstrap.pypa.io/get-pip.py

# install pip in my user directory
python get-pip.py --user

# add local path in my .bash_profile
PATH=$PATH:~/.local/bin
export PATH

# source it
source .bash_profile

# install virtualenv in my user directory
pip install --user virtualenv

# check that virtualenv was installed correctly
virtualenv --version
# 15.1.0

# attempt to create a virtual environment
cd ~/dev/
mkdir venvtest
cd venvtest
virtualenv -v venvtest

Doing that, I get the following error message:

Creating /home/blahblah/dev/venvtest/venvtest/lib/python2.7
Symlinking Python bootstrap modules
Traceback (most recent call last):
  File "/home/blahblah/.local/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/home/blahblah/.local/lib/python2.7/site-packages/virtualenv.py", line 713, in main
    symlink=options.symlink)
  File "/home/blahblah/.local/lib/python2.7/site-packages/virtualenv.py", line 925, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/home/blahblah/.local/lib/python2.7/site-packages/virtualenv.py", line 1127, in install_python
    for fn in os.listdir(stdlib_dir):
OSError: [Errno 13] Permission denied: '/chroot/python27/lib/python2.7'

Any idea what I should be doing differently? Thanks much!

Upvotes: 0

Views: 4311

Answers (1)

Martin Castro Alvarez
Martin Castro Alvarez

Reputation: 493

There are 2 cases: 1) The host admin has set a very restrictive set of permissions, in which case there is nothing you can do but to contact them and tell them about your issue. 2) You are trying to create the virtualenv inside a directory with bad permissions. Try moving to the /tmp directory.

Upvotes: 2

Related Questions