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.

Filter by
Sorted by
Tagged with
81 votes
4 answers
143k views

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 ...
Gerhard Burger's user avatar
67 votes
8 answers
99k views

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 ...
user2740's user avatar
  • 1,087
46 votes
3 answers
54k views

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 ...
Lynob's user avatar
  • 6,665
25 votes
5 answers
41k views

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: /...
All Іѕ Vаиітy's user avatar
18 votes
2 answers
63k views

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 ...
Saurav Kumar's user avatar
  • 14.9k
16 votes
1 answer
60k views

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 --...
MystMan's user avatar
  • 303
15 votes
2 answers
18k views

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 ...
Malik A. Rumi's user avatar
13 votes
2 answers
31k views

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 ...
Nikita Makeev's user avatar
12 votes
1 answer
15k views

Cannot activate virtual environment with a shell script [duplicate]

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:...
Heuyie's user avatar
  • 169
11 votes
4 answers
16k views

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): ...
ananaso's user avatar
  • 3,970
10 votes
3 answers
5k views

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 ...
icezyclon's user avatar
  • 466
9 votes
2 answers
37k views

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 ...
Md. Mursalatul Islam Pallob's user avatar
8 votes
3 answers
41k views

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....
David Y. Stephenson's user avatar
8 votes
2 answers
17k views

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 (...
hielsnoppe's user avatar
7 votes
1 answer
4k views

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-...
georoot's user avatar
  • 173
7 votes
1 answer
5k views

pyvenv-3.4 disappeared in Ubuntu 14.04.3?

This is what I was doing to create a venv in Python 3.4 on Ubuntu 14.04.3 LTS until last week: » pyvenv-3.4 --without-pip venv I was doing that because of this. But since yesterday: » pyvenv-3.4 --...
blueFast's user avatar
  • 818
7 votes
2 answers
10k views

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 ...
polytheme's user avatar
7 votes
1 answer
22k views

Trying to create a python virtual environment but getting OSError

I have installed python3.3, pip-1.5, ditribute-0.7.3, virtualenv-1.11. I am giving the below command to create virtual environment virtualenv --no-site-packages test I am getting the following ...
swamydkv's user avatar
7 votes
2 answers
8k views

What is the correct location for a maintained virtualenv service?

I will be installing and maintaining a Python 2.7-based server application on Ubuntu server (12.04). The model of maintenance will be to create a virtualenv and install application standard libraries (...
lofidevops's user avatar
  • 20.9k
7 votes
1 answer
9k views

Virtualenv permission denied

After a lot of struggle with virtualenv/virtualenvwrapper I decided to remove all virtualenvs and re-install the packages. root> su myuser myuser> sudo pip install virtualenv myuser> sudo ...
user avatar
6 votes
1 answer
20k views

"OSError: [Errno 13] Permission denied" error

I am trying to create a virtualenv environment but I am encountered by this error: user@mylaptop:~$ virtualenv -p ~/Public/Programming/project1/ Running virtualenv with interpreter /home/user/Public/...
Alireza Ghaffari's user avatar
6 votes
1 answer
14k views

Run python script in virtual environment on startup

I would like to start a python script from a virtual environment on startup. I have searched the whole forum and other sources but have not been able to make it work. The script should run at the ...
stekla79's user avatar
6 votes
2 answers
13k views

ModuleNotFoundError: No module named 'pip._vendor.six'

I'm new to Ubuntu (20.04.2.0 LTS) and trying to get Python3.9.6 and Pip to work with Virtualenv. I hope some of you experienced Ubuntu users can help me :) I have no problem using default Python (3.8....
Usagi-Dev's user avatar
5 votes
2 answers
7k views

Why psycopg2 is not able to install in a virtual environment?

Just installed ubuntu20.04. Installed python3.10 by sudo apt install python3.10 Then created virtualenv pip install virtualenv virtualenv -p python3.10 venv Now I'm trying to install requirement for ...
peter ignatiev's user avatar
5 votes
2 answers
21k views

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 ...
Gryu's user avatar
  • 7,559
5 votes
1 answer
13k views

Python3.8 venv without activate script

When I try to create a virtual environment, the created folder does not have the venv/bin/activate script. I tried to install and reinstall venv using sudo apt install python3-venv, but it always ...
Gabriel Maia Gondim's user avatar
5 votes
1 answer
3k views

Installing Latex on Virtualenv

I'm trying to install latex on virtualenv as a part of my project being uploaded to heroku. I used pip install texlive-latex-extra also easy_install texlive-latex-extra for packages texlive-base,...
optimista's user avatar
  • 153
5 votes
2 answers
23k views

Install Python 3.7 packages in Ubuntu 20.04

I recently upgraded to 20.04 from 19.10. Now i face issues since i need to use a virtual environment with Python 3.7 and cant seem to install the packages: - Python3.7-venv - Python 3.7-dev Seems ...
Raalph's user avatar
  • 55
5 votes
1 answer
2k views

Set virtualenv for file in Visual Studio Code python

I'm playing with Visual Studio Code on Ubuntu. One big problem is I can't figure out how to attach a virtualenv to a file. So, I open the file. On the lower left corner, I see the default path to the ...
user2413's user avatar
  • 14.3k
5 votes
1 answer
290 views

Is there an equivalent of virtual env but for the whole of ubuntu?

Python has a wonderful tool called a virtual environment, which lets you effectively hermetically seal various python libraries (which may conflict with each other!) from each other. Is there an ...
eriophora's user avatar
  • 151
5 votes
1 answer
10k views

Make virtualenv and activate it with shell script

I want to make shell script that makes virtualenv, activates it, install some libraries and run python script with it. But I have problem that I can't activate virtualenv in shell script unless i do "...
Kankarollo's user avatar
5 votes
1 answer
5k views

Problems installing Numpy in Virtualenv

I have numpy installed globally (I think via Django) but I'm trying to install it within a virtualenv. When I run pip install numpy (within my virtualenv), it gets stuck at Running setup.py install ...
bem's user avatar
  • 51
4 votes
1 answer
16k views

How to create virtualenv in Ubuntu 18.04

I have installed virtualenv: pip3 install --user virtualenv Then I was trying to create an environment for my folder with the next command: folder_name$ python -m venv ll_env But instead of the ...
Alex's user avatar
  • 457
4 votes
2 answers
970 views

How can I get diffuse to play well with a Python virtualenv?

Diffuse is installed on my workstation and plays well with Mercurial so I often use it for diff'ing. However, I also am using a Python virtualenv to use some different modules in a more controlled ...
Nick T's user avatar
  • 2,483
4 votes
1 answer
9k views

Open a new terminal and source scripts

I want to write a script to activate a virtual environment and run my server for Django project in a new terminal. My startProject.sh is: #!/bin/bash source virtualenv/bin/activate python manage.py ...
Heuyie's user avatar
  • 169
4 votes
3 answers
24k views

What can I do when a Python virtual environment doesn't find modules?

On Ubuntu 16.04 I created a virtual environment called venv and inside the venv/lib/python2.7/site-packages I have nltk and nltk-3.2.2.dist-info as normal. However, when I activate the virtual ...
N. Chalifour's user avatar
4 votes
1 answer
7k views

How to ensure matplotlib in a Python 3 virtualenv uses the TkAgg backend?

I am using Ubuntu 16.04 with Python 3. Using APT to install python3-matplotlib and then printing the matplotlib backend gives TKAgg, which is expected because Ubuntu has 16.04 has python3-tk installed....
edwinksl's user avatar
  • 23.8k
4 votes
1 answer
971 views

Development environment similar to virtualenv for C++

I am looking for a tool that lets me switch between different versions of the packages/builds I use for development purpose something similar to virtualenv for python. I am using install prefix at the ...
eyebies's user avatar
  • 51
4 votes
1 answer
278 views

How do I set PYTHONASYNCIODEBUG value in pipenv python?

I am running python 3.6 in a pipenv shell. I want to set the value of this python environment variable PYTHONASYNCIODEBUG to 1 without affecting my user environment variables that are outside of the ...
Sun Bear's user avatar
  • 2,274
3 votes
3 answers
8k views

Edit ZSH theme for virtualenv name

I use zsh theme intheloops. The theme looks like this when no virtual env. is active -- an empty line -- [sourabh@skynet] ~/Code/django_apps/cope (master) ⚡ ❯ and when an env. is active, (env ...
Sourabh's user avatar
  • 1,761
3 votes
2 answers
17k views

How to install pyzmq for iPython Notebook in a Python 3 virtual environment?

I wanted to use iPython Notebook in Python 3 on Ubuntu 14.04. Because I have both Python 2.7 and Python 3.4 installed on my system--and for other implementation-specific reasons--I decided to use a ...
Arthur's user avatar
  • 420
3 votes
1 answer
177 views

For every Framework new Python Env?

I'm very new to Linux so it could be that I think more in a Windows way. I want to develop something in Python, especially Django and Discord Bot. I have a folder PythonEnvironment where I set up a ...
黒성배's user avatar
3 votes
1 answer
1k views

Create a shortcut to a virtual enviroment

I have installed Spyder Python IDE in a virtual environment. For this purpose I used the following command: python3 -m venv spyder-env source spyder-env/bin/activate I have to switch to the virtual ...
freak11's user avatar
  • 131
3 votes
1 answer
2k views

pip install virtualenv, error on ubuntu 15.04

How to fix this issue? and how to install pip and virtualenv on ubuntu 15.04 pip install virtualenv Traceback (most recent call last): File "/usr/bin/pip", line 9, in <module> ...
Ivan's user avatar
  • 769
3 votes
1 answer
14k views

Why is "virtualenv venv" not working on Ubuntu 18.04? [duplicate]

I'm having trouble creating a virtual environment for python on my Ubuntu desktop. I have installed virtualenv by: sudo pip3 install virtualenv and verifying it gives the following output: $ pip3 show ...
Kingsley's user avatar
  • 131
3 votes
1 answer
5k views

How do I create a Python virtual environment in the Ubuntu on Windows App using 'venv' rather than 'virtualenv'?

I am using the Ubuntu on Windows App running on Windows Subsystem for Linux. So an initial question is if Python virtual environments is supported. Given my as yet limited understanding of Python ...
DavidG's user avatar
  • 31
2 votes
3 answers
8k views

How to install python-guestfs and libguestfs-tools in python virtual environment?

Can any one help me out to install python-guestfs and libguestfs-tools in python virtual environment? I tried to install those packages with the help of pip install but it fails to install because ...
user27's user avatar
  • 185
2 votes
1 answer
1k views

14.04 what is the difference between /usr/bin/python3 /usr/bin/python3.4

In /usr/bin there is a python3 and python3.4. What is the difference? If I am setting up virtualenv for 3.4 do I need to point it to the 3.4 file, or does the python3 act like a meta package?
Bill Rosmus's user avatar
2 votes
2 answers
3k views

Launching script containing virtual env through desktop icon

I want to launch Spyder with tensorflow environment activated directly through a desktop icon. For this purpose, I created a desktop icon launching a virtualenv and then my application. Many posts ...
ahstat's user avatar
  • 121
2 votes
3 answers
5k views

Python 3.4 on Ubuntu 16.04

I have just installed Python 3.4 on Ubuntu 16.04 using the ./configure, make, make install process. I am trying to install Flask, and am having issues using pip in virtualenv created with 3.4. Using ...
paliaso's user avatar
  • 21