Questions tagged [virtualenv]

virtualenv is a tool that creates sandboxed Python environments.

virtualenv
Filter by
Sorted by
Tagged with
2586 votes
16 answers
2.4m views

How to leave/exit/deactivate a Python virtualenv

I'm using virtualenv and the virtualenvwrapper. I can switch between virtualenv's just fine using the workon command. me@mymachine:~$ workon env1 (env1)me@mymachine:~$ workon env2 (env2)me@mymachine:~$...
Apreche's user avatar
  • 31.2k
2111 votes
8 answers
622k views

What is the difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv, etc?

Python 3.3 includes in its standard library the new package venv. What does it do, and how does it differ from all the other packages that match the regex (py)?(v|virtual|pip)?env?
Flimm's user avatar
  • 143k
1791 votes
17 answers
2.8m views

How can I install packages using pip according to the requirements.txt file from a local directory?

Here is the problem: I have a requirements.txt file that looks like: BeautifulSoup==3.2.0 Django==1.3 Fabric==1.2.0 Jinja2==2.5.5 PyYAML==3.09 Pygments==1.4 SQLAlchemy==0.7.1 South==0.7.3 amqplib==0.6....
kakarukeys's user avatar
  • 22.1k
1748 votes
42 answers
2.0m views

Use different Python version with virtualenv

How do I create a virtual environment for a specified version of Python?
Ulf's user avatar
  • 18.2k
1268 votes
34 answers
1.4m views

How do I remove all packages installed by pip?

How do I uninstall all packages installed by pip from my currently activated virtual environment?
blueberryfields's user avatar
932 votes
23 answers
2.4m views

How do I update/upgrade pip itself from inside my virtual environment?

I'm able to update pip-managed packages, but how do I update pip itself? According to pip --version, I currently have pip 1.1 installed in my virtualenv and I want to update to the latest version. ...
zakdances's user avatar
  • 22.7k
880 votes
23 answers
1.1m views

Using Python 3 in virtualenv

Using virtualenv, I run my projects with the default version of Python (2.7). On one project, I need to use Python 3.4. I used brew install python3 to install it on my Mac. Now, how do I create a ...
Prometheus's user avatar
823 votes
23 answers
1.4m views

How do I remove/delete a virtualenv?

I created an environment with the following command: virtualenv venv --distribute Trying to remove it with the following command: rmvirtualenv venv does not work. I do an lson my current directory and ...
wulymammoth's user avatar
  • 8,531
777 votes
10 answers
1.2m views

Where does pip install its packages?

I activated a virtualenv which has pip installed. I did pip3 install Django==1.8 and Django successfully downloaded. Now, I want to open up the Django folder. Where is the folder located? Normally it ...
SilentDev's user avatar
  • 22k
719 votes
37 answers
726k views

How to install psycopg2 with "pip" on Python?

I'm using virtualenv and I need to install "psycopg2". I have done the following: pip install http://pypi.python.org/packages/source/p/psycopg2/psycopg2-2.4.tar.gz#md5=...
André's user avatar
  • 25.2k
655 votes
11 answers
1.2m views

How can I upgrade specific packages using pip and a requirements file?

I'm using pip with a requirements file, in a virtualenv, for my Django projects. I'm trying to upgrade some packages, notably Django itself, and I'm getting an error about source code conflicts: ...
gcaprio's user avatar
  • 6,607
610 votes
38 answers
846k views

No module named pkg_resources

I'm deploying a Django app to a dev server and am hitting this error when I run pip install -r requirements.txt: Traceback (most recent call last): File "/var/www/mydir/virtualenvs/dev/bin/pip", ...
igniteflow's user avatar
  • 8,862
520 votes
19 answers
393k views

How to determine if Python is running inside a virtualenv?

Is it possible to determine if the current script is running inside a virtualenv environment?
miracle2k's user avatar
  • 30.8k
418 votes
8 answers
212k views

Is it bad to have my virtualenv directory inside my git repository?

I'm thinking about putting the virtualenv for a Django web app I am making inside my git repository for the app. It seems like an easy way to keep deploy's simple and easy. Is there any reason why I ...
Lyle Pratt's user avatar
  • 5,856
400 votes
14 answers
710k views

No acceptable C compiler found in $PATH when installing python

I'm trying to install a new Python environment on my shared hosting. I follow the steps written in this post: mkdir ~/src wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz tar -zxvf Python-...
mik.ro's user avatar
  • 4,643
397 votes
9 answers
611k views

What is the purpose of "pip install --user ..."?

From pip install --help: --user Install to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%\Python on Windows. (See the Python documentation for ...
Rob Truxal's user avatar
  • 6,106
366 votes
13 answers
499k views

Upgrade Python in a virtual environment

Is there a way to upgrade the version of Python used in a virtual environment (e.g. if a bugfix release comes out)? I could pip freeze --local > requirements.txt, then remove the directory and pip ...
Simon Walker's user avatar
  • 5,731
358 votes
4 answers
150k views

Comprehensive beginner's virtualenv tutorial? [closed]

I've been hearing the buzz about virtualenv lately, and I'm interested. But all I've heard is a smattering of praise, and don't have a clear understanding of what it is or how to use it. I'm looking ...
Dan Burton's user avatar
  • 53.5k
356 votes
32 answers
612k views

Virtualenv Command Not Found

I couldn't get virtualenv to work despite various attempts. I installed virtualenv on MAC OS X using: pip install virtualenv and have also added the PATH into my .bash_profile. Every time I try to ...
Arial's user avatar
  • 4,914
346 votes
19 answers
1.1m views

How can I activate a virtualenv in Linux?

I have been searching and tried various alternatives without success and spent several days on it now; it is driving me mad. I am running on Red Hat Linux with Python 2.5.2. I began using the most ...
larry's user avatar
  • 3,469
333 votes
35 answers
471k views

PyLint "Unable to import" error - how to set PYTHONPATH?

I'm running PyLint from inside Wing IDE on Windows. I have a sub-directory (package) in my project and inside the package I import a module from the top level, ie. __init__.py myapp.py one.py subdir\ ...
EMP's user avatar
  • 60.6k
323 votes
20 answers
180k views

Cron and virtualenv

I am trying to run a Django management command from cron. I am using virtualenv to keep my project sandboxed. I have seen examples here and elsewhere that show running management commands from within ...
John-Scott's user avatar
  • 3,263
312 votes
10 answers
165k views

Does Conda replace the need for virtualenv?

I recently discovered Conda after I was having trouble installing SciPy, specifically on a Heroku app that I am developing. With Conda you create environments, very similar to what virtualenv does. ...
Kritz's user avatar
  • 7,211
302 votes
7 answers
561k views

How to uninstall a package installed with pip install --user

There is a --user option for pip which can install a Python package per user: pip install --user [python-package-name] I used this option to install a package on a server for which I do not have ...
Serjik's user avatar
  • 10.7k
269 votes
4 answers
162k views

Make virtualenv inherit specific packages from your global site-packages

I'm looking for a way to make a virtualenv which will contain just some libraries (which I chose) of the base python installation. To be more concrete, I'm trying to import my matplotlib to virtualenv ...
TheMeaningfulEngineer's user avatar
266 votes
3 answers
148k views

What is the difference between pyenv, virtualenv, anaconda?

I am a ruby programmer trying to learn python. I am pretty familiar with pyenv since it is like a copy and paste from rbenv. Pyenv helps allow to have more than one version of python in a system and ...
channa ly's user avatar
  • 9,667
261 votes
21 answers
287k views

How to use MySQLdb with Python and Django in OSX 10.6?

This is a much discussed issue for OSX 10.6 users, but I haven't been able to find a solution that works. Here's my setup: Python 2.6.1 64bit Django 1.2.1 MySQL 5.1.47 osx10.6 64bit I create a ...
Joe's user avatar
  • 25.9k
257 votes
37 answers
664k views

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 ...
user1157538's user avatar
  • 2,573
251 votes
26 answers
122k views

Broken references in Virtualenvs

I recently installed a bunch of dotfiles on my Mac along with some other applications (I changed to iTerm instead of Terminal, and Sublime as my default text editor) but ever since, all my virtual ...
oxtay's user avatar
  • 4,000
250 votes
15 answers
159k views

What's the proper way to install pip, virtualenv, and distribute for Python?

Short Question What is the proper way to install pip, virtualenv, and distribute? Background In my answer to SO question 4314376, I recommended using ez_setup so that you could then install pip and ...
Matthew Rankin's user avatar
235 votes
6 answers
335k views

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 ...
vineeth kanaparthi's user avatar
231 votes
15 answers
843k views

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 ...
pandita's user avatar
  • 4,879
225 votes
8 answers
352k views

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 ...
linX's user avatar
  • 2,359
220 votes
3 answers
67k views

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 ...
truth1ness's user avatar
  • 4,921
213 votes
9 answers
178k views

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's user avatar
  • 4,586
212 votes
11 answers
289k views

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 ...
Mahmoud Hanafy's user avatar
212 votes
30 answers
697k views

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 ...
Hrvoje T's user avatar
  • 3,553
206 votes
14 answers
497k views

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 ...
Calvin Cheng's user avatar
  • 36.1k
201 votes
6 answers
74k views

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 ...
danielschnoll's user avatar
198 votes
35 answers
928k views

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 ...
Graham Smith's user avatar
  • 2,195
198 votes
12 answers
286k views

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....
Cerin's user avatar
  • 63.2k
197 votes
8 answers
76k views

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 ...
dbr's user avatar
  • 168k
185 votes
20 answers
224k views

pyvenv-3.4 returned non-zero exit status 1

I'm in Kubuntu 14.04 , I want to create a virtualenv with python3.4. I did with python2.7 before in other folder. But when I try: pyvenv-3.4 venv I've got: Error: Command '['/home/fmr/projects/ave/...
kahonmlg's user avatar
  • 3,959
183 votes
9 answers
167k views

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 ...
dolma33's user avatar
  • 4,213
180 votes
25 answers
366k views

'virtualenv' won't activate on Windows

Essentially I cannot seem to activate my virtualenv environment which I create. I'm doing this inside of Windows PowerShell through using scripts\activate but I get an error message: "cannot be ...
SScode's user avatar
  • 1,895
179 votes
12 answers
95k views

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 ...
Riley Watkins's user avatar
178 votes
32 answers
198k views

pyvenv not working because ensurepip is not available

I upgraded from ubuntu 14.04 to ubuntu 16.04 a few days ago. When I try to create a virtual env by using pyvenv .venv or python3 -m venv .venv There is an error: The virtual environment was not ...
Louis M's user avatar
  • 4,184
175 votes
5 answers
190k views

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 ...
Chris Lawlor's user avatar
165 votes
6 answers
122k views

How to enable a virtualenv in a systemd service unit?

I want to "activate" a virtualenv in a systemd service file. I would like to avoid having a shell process between the systemd process and the python interpreter. My current solution looks ...
guettli's user avatar
  • 27.5k
161 votes
19 answers
443k views

ImportError: No module named 'encodings'

I recently reinstalled ubuntu and did upgrade to 16.04 and cannot use python: $ python manage.py runserver Could not find platform independent libraries <prefix> Could not find platform ...
codyc4321's user avatar
  • 9,362

1
2 3 4 5
150