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
156 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?
70
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
  • 1,147
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,775
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…
24
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…
19
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
  • 15,174
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,…
13
votes
2 answers

Unable to create venv with a different Python verison

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…
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
  • 167
12
votes
1 answer

How to activate a virtual environment in Ubuntu?

I installed virtualenv and I created a virtual environment inside my directory. Everything is OK, but I can't activate it. When I run: source /bin/activate it says: already: command not found Screenshot:
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
  • 4,080
  • 5
  • 32
  • 52
10
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
  • 501
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,…
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…
8
votes
2 answers

How to create python2.7 virtualenv on Ubuntu 20.04

I want to run an application that uses python2.7 version, but by default python2.7 is not installed. When I tried to use: $ virtualenv -p python2 flaskold It returned: RuntimeError: failed to find interpreter for Builtin discover of…
Gryu
  • 8,002
  • 9
  • 37
  • 53
1
2 3
10 11