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
375
votes
14 answers

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-2.7.1.tar.gz cd Python-2.7.1 mkdir…
mik.ro
  • 4,381
  • 2
  • 18
  • 23
358
votes
4 answers

Comprehensive beginner's virtualenv tutorial?

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 for (ideally) a follow-along tutorial that can…
Dan Burton
  • 53,238
  • 27
  • 117
  • 198
349
votes
32 answers

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 run the virtualenv command, it returns: -bash:…
Arial
  • 4,844
  • 2
  • 18
  • 17
348
votes
13 answers

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 install -r requirements.txt, but this requires a lot…
Simon Walker
  • 5,523
  • 6
  • 30
  • 32
340
votes
18 answers

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 recent Virtualenv, but I could not activate it. I…
larry
  • 3,409
  • 3
  • 13
  • 5
319
votes
34 answers

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\ __init__.py two.py Inside two.py I have…
EMP
  • 59,148
  • 53
  • 164
  • 220
318
votes
20 answers

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 virtualenv's like: 0 3 * * * source…
John-Scott
  • 3,213
  • 3
  • 16
  • 7
308
votes
10 answers

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. My questions are: If I use Conda will it replace…
Kritz
  • 7,099
  • 12
  • 43
  • 73
297
votes
7 answers

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 root access. What I need now is to uninstall the…
Serjik
  • 10,543
  • 8
  • 61
  • 70
263
votes
4 answers

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 during the creation of virtualenv. It can't be…
TheMeaningfulEngineer
  • 15,679
  • 27
  • 85
  • 143
261
votes
23 answers

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 virtualenvwrapper with --no-site-packages, then…
Joe
  • 25,307
  • 12
  • 38
  • 35
260
votes
3 answers

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 also to isolate the python without touching…
channa ly
  • 9,479
  • 14
  • 53
  • 86
251
votes
26 answers

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 environments have stopped working, although their…
oxtay
  • 3,990
  • 6
  • 30
  • 43
250
votes
15 answers

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 virtualenv as follows: curl -O…
Matthew Rankin
  • 457,139
  • 39
  • 126
  • 163
240
votes
35 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
  • 2,403
  • 3
  • 14
  • 4