Questions tagged [virtualenv]

virtualenv is a tool that creates sandboxed Python environments.

virtualenv allows you to create a sandboxed and isolated environment where Python packages can be installed without interfering with other packages on the same machine. With several virtualenvs, many different pieces of Python software with different and even mutually exclusive dependencies can live together.

The source code of this tool is hosted on GitHub.

Basic usage:

$ virtualenv ENV
$ source ENV/bin/activate
(ENV) $ easy_install (package)
(ENV) $ deactivate
$ ...

See the Command reference for a complete list of all available commands.

A virtualenv can also be set up to completely ignore the system's site-packages, to ensure that all dependencies are installed within the sandboxed environment.

$ virtualenv ENV --no-site-packages
6571 questions
167
votes
12 answers

Renaming a virtualenv folder without breaking it

I've created folder and initialized a virtualenv instance in it. $ mkdir myproject $ cd myproject $ virtualenv env When I run (env)$ pip freeze, it shows the installed packages as it should. Now I want to rename myproject/ to project/. $ mv…
Riley Watkins
  • 3,043
  • 2
  • 24
  • 17
166
votes
3 answers

Getting a 'source: not found' error when using source in a bash script

I'm trying to write (what I thought would be) a simple bash script that will: run virtualenv to create a new environment at $1 activate the virtual environment do some more stuff (install django, add django-admin.py to the virtualenv's path,…
Chris Lawlor
  • 41,304
  • 11
  • 45
  • 67
166
votes
12 answers

How to activate an Anaconda environment

I'm on Windows 8, using Anaconda 1.7.5 64bit. I created a new Anaconda environment with conda create -p ./test python=2.7 pip from C:\Pr\TEMP\venv\. This worked well (there is a folder with a new python distribution). conda tells me to type…
pandita
  • 3,881
  • 4
  • 23
  • 46
160
votes
11 answers

List all virtualenv

In virtualenvwrapper, is there a simple way to list all virtualenv on my machine? (like what yolk -l does to list all python packages in the current virtual environment?) CLARIFICATION: "ls -la" in my env directory does not count. I am looking for…
Calvin Cheng
  • 32,676
  • 29
  • 109
  • 162
156
votes
26 answers

Issue with virtualenv - cannot activate

I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try…
user1157538
  • 1,563
  • 2
  • 10
  • 4
152
votes
5 answers

Conda version pip install -r requirements.txt --target ./lib

What is the conda version of this? pip install -r requirements.txt --target ./lib I've found these commands: while read requirement; do conda install --yes $requirement; done < requirements.txt But it doesn't tell how to specify --target ./lib
vineeth kanaparthi
  • 1,541
  • 2
  • 8
  • 4
149
votes
8 answers

How to duplicate virtualenv

I have an existing virtualenv with a lot of packages but an old version of Django. What I want to do is duplicate this environment so I have another environment with the exact same packages but a newer version of Django. How can I do this?
dolma33
  • 3,485
  • 6
  • 24
  • 47
149
votes
12 answers

Is it possible to install another version of Python to Virtualenv?

I have a shared account in a web-hosting that has Python 2.4 installed, but my code is not compatible with 2.4. Is it possible to install Python 2.6 directly to Virtualenv? Note: I don´t have permission to install it in the shared server.
André
  • 21,421
  • 41
  • 110
  • 172
149
votes
7 answers

Is there a virtual environment for node.js?

I've searched the wiki modules page, but I can't find anything similar to virtualenv (python) or rvm. Anyone here separates node.js in their own env? I really don't like to install npm system-wide.
Frangossauro
  • 3,636
  • 4
  • 20
  • 14
147
votes
11 answers

How do I install from a local cache with pip?

I install a lot of the same packages in different virtualenv environments. Is there a way that I can download a package once and then have pip install from a local cache? This would reduce download bandwidth and time.
Matthew Rankin
  • 400,554
  • 38
  • 116
  • 156
145
votes
13 answers

virtualenv --no-site-packages and pip still finding global packages?

I was under the impression that virtualenv --no-site-packages would create a completely separate and isolated Python environment, but it doesn't seem to. For example, I have python-django installed globally, but wish to create a virtualenv with a…
ianw
  • 1,824
  • 2
  • 12
  • 7
141
votes
26 answers

How to repeat last command in python interpreter shell?

How do I repeat the last command? The usual keys: Up, Ctrl+Up, Alt-p don't work. They produce nonsensical characters. (ve)[kakarukeys@localhost ve]$ python Python 2.6.6 (r266:84292, Nov 15 2010, 21:48:32) [GCC 4.4.4 20100630 (Red Hat 4.4.4-10)] on…
kakarukeys
  • 16,427
  • 9
  • 28
  • 42
139
votes
24 answers

Where is virtualenvwrapper.sh after pip install?

I'm trying to setup virtualenvwrapper on OSX, and all the instructions and tutorials I've found tell me to add a source command to .profile, pointing towards virtualenvwrapper.sh. I've checked all the python and site-packages directories, and I…
zakdances
  • 16,715
  • 30
  • 94
  • 155
135
votes
26 answers

ImportError: No module named Crypto.Cipher

When I try to run app.py (Python 3.3, PyCrypto 2.6) my virtualenv keeps returning the error listed above. My import statement is just from Crypto.Cipher import AES. I looked for duplicates and you might say that there are some, but I tried the…
Graham Smith
  • 1,565
  • 2
  • 9
  • 11
132
votes
1 answer

How to install a specific version of a package with pip?

Possible Duplicate: Installing specific package versions with Pip I am a bit new to pip install and virtualenv in general. I have setup an virtualenv on my server as well as on my local dev environment. On the server the package…
Houman
  • 58,044
  • 75
  • 235
  • 407