Questions tagged [virtualenv]

virtualenv is a tool that creates a sandboxed and isolated environment where Python packages can be installed without interfering with other packages on the same machine.

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 coexist together.

Basic usage:

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

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

$ virtualenv ENV --no-site-packages
150 questions
81
votes
4 answers

How to set up and use a virtual python environment in Ubuntu?

Python virtual environments are used to create isolated python environments to avoid dependency and version conflicts, and also indirectly take care of permission issues. But what is the easiest way to set it up, and use it, in Ubuntu?
Gerhard Burger
  • 9,359
  • 5
  • 41
  • 59
58
votes
8 answers

Error: Command '['/path/to/env/bin/python3.7', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1

I just installed python3.7 on my 18.04LTS via the deadsnakes ppa: sudo add-apt-repository ppa:deadsnakes/ppa sudo apt install python3.7 -y Now I want to create a virtual environment with python3.7 -m venv env but I get Error: Command…
user2740
  • 997
  • 1
  • 12
  • 23
46
votes
3 answers

Error installing scrapy in virtualenv using pip

pip install scrapy Downloading/unpacking scrapy Downloading Scrapy-0.24.2-py2-none-any.whl (502kB): 502kB downloaded Downloading/unpacking pyOpenSSL (from scrapy) Downloading pyOpenSSL-0.14.tar.gz (128kB): 128kB downloaded Running setup.py…
Lynob
  • 6,615
  • 16
  • 76
  • 108
25
votes
5 answers

Python virtualenvwrapper problem running the initialization hooks

On a fresh install of 16.04, I am trying to install virtualenvwrapper by following this great answer by Gerhard Burger. after configuring the .bashrc, whenever opening the terminal displays bash: /usr/local/bin/python2.7: No such file or…
18
votes
2 answers

Create a copy of virtualenv locally without pip install

Sometime there is a need to create a copy of exiting virtualenv to test extra features of our project. In such a case we need to create a copy of the existing environment and add few more requirements. One of the way to create a copy of existing…
Saurav Kumar
  • 14,746
  • 16
  • 62
  • 76
15
votes
2 answers

pyvenv vs venv vs python-virtualenv vs virtualenv and python 3

malikarumi@Tetouan2:~$ pip install virtualenv Collecting virtualenv Downloading virtualenv-12.0.7-py2.py3-none-any.whl (1.8MB) 100% |################################| 1.8MB 330kB/s malikarumi@Tetouan2:~$ pip freeze (a lot of stuff,…
Malik A. Rumi
  • 533
  • 3
  • 9
  • 16
13
votes
2 answers

Unable to create virtual environment with python 3.6

I'm installed python 3.6 on my Ubuntu 17.04. Now, I'm trying to create virtual environment with command: python3.6 -m venv env but I'm getting the following message: The virtual environment was not created successfully because ensurepip is…
Nikita Makeev
  • 133
  • 1
  • 1
  • 5
12
votes
1 answer

Cannot activate virtual environment with a shell script

I read similar questions and have tried their suggestions but I still cannot activate my virtual environment. The hierarchy of directories is: myproject -- virtualenv -- startvenv.sh startvenv.sh is: #!/bin/bash source virtualenv/bin/activate And,…
Heuyie
  • 169
  • 1
  • 3
  • 12
11
votes
4 answers

How do I install Pygame in virtualenv?

In installed python-virtualenv, because this question said I should use virtualenv to install pygame. However, I'm not really sure how that's accomplished. What I did (following these instructions): virtualenv --no-site-packages --distribute -p…
ananaso
  • 3,890
  • 4
  • 30
  • 50
11
votes
1 answer

Configure error: could not find the zlib library

I am trying to install lalsuite on ubuntu according to the instructions here: https://pycbc.org/pycbc/latest/html/install_lalsuite.html Everything went smoothly until I ran ./00boot ./configure --prefix=${VIRTUAL_ENV}/opt/lalsuite…
9
votes
3 answers

Virtualenv installs envs into local/bin instead of bin

Problem: The bin directory of my virtual environment produced with virtualenvwrapper (which uses virtualenv under the hood) is located in the subfolderlocal instead which leads to breakage across the board (mostly virtualenvwrapper and vscode for…
icezyclon
  • 436
  • 4
  • 13
8
votes
2 answers

Clean uninstall of virtualenv and virtualenvwrapper

Since I do not use them at this time I tried to uninstall virtualenv and virtualenvwrapper via the Ubuntu Software Center. Now whenever I open a console I get the following error message: Traceback (most recent call last): File "", line 1,…
hielsnoppe
  • 455
  • 3
  • 5
  • 13
8
votes
3 answers

Installing pygame with pip

I'm trying to install pygame using pip in a virtualenv. I'm following this tutorial on using Kivy. However, running pip install pygame returns Downloading/unpacking pygame Downloading pygame-1.9.1release.tar.gz (2.1MB): 2.1MB downloaded Running…
7
votes
1 answer

pkg-resources==0.0.0 in pip freeze bug

I am using Ubuntu 16.10, and I only installed virtualenv using aptitude. After creating a new environment, and listed installed packages using pip freeze I am always getting the output of pkg-resources==0.0.0 This is causing issues when I try to…
georoot
  • 173
  • 1
  • 5
7
votes
2 answers

run virtualenv in new terminal tab automatically

I am using virtualenv, so to start I have to say source some/long/path/bin/activate Sometimes (very often, in fact) I want to create another tab in terminal, to edit another script, or to run django shell etc. And after another tab's creation I…
polytheme
  • 71
  • 1
  • 2
1
2 3
9 10