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.

7398 questions
232
votes
6 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
  • 2,355
  • 2
  • 10
  • 6
221
votes
15 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
  • 4,739
  • 6
  • 29
  • 51
218
votes
3 answers

What is the relationship between virtualenv and pyenv?

I recently learned how to use virtualenv and virtualenvwrapper in my workflow but I've seen pyenv mentioned in a few guides but I can't seem to get an understanding of what pyenv is and how it is different/similar to virtualenv. Is pyenv a…
truth1ness
  • 4,831
  • 5
  • 21
  • 19
209
votes
8 answers

how to specify new environment location for conda create

the default location for packages is .conda folder in my home directory. however, on the server I am using, there is a very strict limit of how much space I can use, which basically avoids me from putting anything under my home directory. how can I…
linX
  • 2,199
  • 2
  • 13
  • 4
205
votes
11 answers

setting an environment variable in virtualenv

I have a Heroku project that uses environment variables to get its configuration, but I use virtualenv to test my app locally first. Is there a way to set the environment variables defined on the remote machine inside virtualenv?
Mahmoud Hanafy
  • 7,958
  • 12
  • 47
  • 62
204
votes
8 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
  • 4,446
  • 4
  • 23
  • 15
201
votes
14 answers

List all virtualenv created by virtualenvwrapper

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
  • 35,640
  • 39
  • 116
  • 167
194
votes
26 answers

How can I set up a virtual environment for Python in Visual Studio Code?

In my project folder I created a venv folder: python -m venv venv When I run command select python interpreter in Visual Studio Code, my venv folder is not shown. I went one level up like suggested here, but Visual Studio Code doesn't see my…
Hrvoje T
  • 3,365
  • 4
  • 28
  • 41
193
votes
8 answers

Ruby equivalent of virtualenv?

Is there something similar to the Python utility virtualenv? Basically it allows you to install Python packages into a sandboxed environment, so easy_install django doesn't go in your system-wide site-packages directory, it would go in the…
dbr
  • 165,801
  • 69
  • 278
  • 343
191
votes
33 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
  • 2,125
  • 2
  • 13
  • 12
190
votes
12 answers

How to source virtualenv activate in a Bash script

How do you create a Bash script to activate a Python virtualenv? I have a directory structure like: .env bin activate ...other virtualenv files... src shell.sh ...my code... I can activate my virtualenv…
Cerin
  • 60,957
  • 96
  • 316
  • 522
189
votes
6 answers

What's the difference between Docker and Python virtualenv?

From what I understand about Docker, it's a tool used for virtual environments. In their lingo, its called "containerization". This is more or less what Python's virtualenv does. However, you can use virtualenv in Docker. So, is it a virtual…
danielschnoll
  • 3,045
  • 5
  • 23
  • 34
180
votes
9 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
  • 4,133
  • 6
  • 28
  • 48
176
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,453
  • 3
  • 25
  • 19
174
votes
5 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
  • 47,306
  • 11
  • 48
  • 68