Forums

Accessing a VirtualEnv environment

Hi,

Hope you can help.

I am currently running my Django site using VirtualEnv so I can run the combination of Python 2.7 and Django 1.6.

The next update to my site requires an install of "sorl-thumbnail" but I am not sure how I go about this? I know I need to run the pip install command in my VirtualEnv but I am not sure how I can get to the VirtualEnv to run this command.

In addition I have noticed when I installed "sorl-thumbnail" via pip on my local PC I had to use sudo, will that be possible here?

Thanks in advance.

Regards

Ian

You need to "activate" a virtualenv in the bash console session before you can pip install.

How did you create your virtualenv? Did you follow our guide and use virtualenvwrapper? If so, you probably need to do this:

source virtualenvwrapper.sh
workon your-virtualenv-name
# at this point you'll see the prompt changes to say (your-virtualenv-name) $ instead of just $
pip install sorl-thumbnail

If you didn't use virtualenvwrapper, then you need to find the folder where your virutalenv is stored -- assuming you've got it working in your web app, it'll be in the activate_this invocation at the top of your wsgi file. Then you run

source /path/to/your-virtualenv/bin/activate

and that will give you the (your-virtualenv) $ prompt, and then you can do the pip install.

You never need to use sudo when you're using pip in a virtualenv.

Hi Harry,

Thanks for the prompt response.

Yes I installed virtualenv using your excellent documentation and following your response have got sorl-thumbnail installed.

Thanks again for your help, much appreciated!

Regards

Ian

:-)