Questions tagged [python-venv]

Many questions here will have to do with how to setup virtual development environments for Python using the venv command (new as of Python 3.3), the differences between venv and other common packages, such as virtualenv, and the interaction between these virtual environments and other parts of your development system.

Python venv — Creation of virtual environments

The venv module provides support for creating lightweight “virtual environments” with their own site directories, optionally isolated from system site directories. Each virtual environment has its own Python binary (allowing creation of environments with various Python versions) and can have its own independent set of installed Python packages in its site directories.

Many questions here will have to do with how to setup virtual development environments for Python using the venv command (new as of Python 3.3), the differences between venv and other common packages, such as virtualenv, and the interaction between these virtual environments and other parts of your development system.

1349 questions
21
votes
4 answers

Install python3-venv module on linux mint

I was able to move to Linux mint 17.3 64 bit version from my Linux mint 16. This was long awaited migration. After moving to Linux Mint 17.3, I am not able to the install python3-venv module, which is said to be the replacement for virtualenv in…
Srikan
  • 2,161
  • 5
  • 21
  • 36
20
votes
10 answers

ModuleNotFoundError: No module named aws_cdk

When I run cdk deploy, I get the following error: Traceback (most recent call last): File "app.py", line 3, in from aws_cdk import core ModuleNotFoundError: No module named 'aws_cdk' I installed cdk with npm npm install -g aws-cdk I…
MoneyBall
  • 2,343
  • 5
  • 26
  • 59
20
votes
4 answers

How can I activate a virtual env with pyenv?

I followed this guide to install pyenv in order to manage all Python versions I have installed on my Mac. However, it is not clear to me what the pyenv global 3.7.3 command does and how I can activate a venv that uses Python 3.7. If I type: pyenv…
Py-ser
  • 1,860
  • 9
  • 32
  • 58
20
votes
3 answers

Why 'python3 -m venv myenv' installs older version of pip into myenv than any version of pip I can find anywhere on the system?

This is not causing me any problem that I can't solve by activating the virtual environment and running pip install -U pip, but I always wonder where the older version of pip is coming from. I'm using OS X 10.7.5. When I create a virtual…
dusty
  • 865
  • 9
  • 15
19
votes
2 answers

pip Install Editable Package Produces ModuleNotFoundError

Due to import issues, I've followed the steps shown here to install my Python project as an editable pip package. Basically this entails running pip install -e . from my project root directory. The name of the project is 'myproject', with the…
ThoseKind
  • 754
  • 2
  • 13
  • 22
19
votes
5 answers

How to run a cron job with pipenv?

To demonstrate the issue I'm having, I will use this simple function, which lives in /Users/X/Code/python/example/start.py: def say_hello(name): print("Saying hello to {}".format(name)) say_hello("John") I'm using pipenv to set up my packages…
19
votes
1 answer

When working with a venv virtual environment, which files should I be commiting to my git repository?

Using GitHub's .gitignore, I was able to filter out some files and directories. However, there's a few things that left me a little bit confused: GitHub's .gitignore did not include /bin and /share created by venv. I assumed they should be ignored…
Jakob
  • 479
  • 5
  • 12
18
votes
6 answers

VS Code: Python Interpreter can't find my venv

I've been stuck on this for a few days, kindly help me if you can. I have my venv folder on my root project folder. When I try to set the Python Interpreter, it shows me only the Python installed in my machine and not the one in my root folder. It…
Diego Fortes
  • 8,830
  • 3
  • 32
  • 42
18
votes
2 answers

How does activating a python virtual environment modify sys.path?

I create my python virtual environment using: python3 -m venv venv3 to activate, I source venv3/bin/activate. venv3/bin/activate doesn't appear to be all that complex: # This file must be used with "source bin/activate" *from bash* # you cannot run…
John
  • 2,551
  • 3
  • 30
  • 55
18
votes
1 answer

Does using virtualenvwrapper with Python3.3 mean I cannot (or should not) be using pyvenv?

Virtualenvwrapper is a user-friendly shell around Python's virtualenv. Python 3.3 ships with pyvenv built into the standard library, which aims to supercede virtualenv. But if I install Virtualenvwrapper on Python3.3, it still installs virtualenv,…
17
votes
3 answers

How can I upgrade pip inside a venv inside a Dockerfile?

While running $ sudo docker build -t myproj:tag . I am hit with the message You are using pip version 10.0.1, however version 18.0 is available. You should consider upgrading via the 'pip install --upgrade pip' command. and given recent…
Calaf
  • 10,113
  • 15
  • 57
  • 120
17
votes
2 answers

completely self-contained virtual environment

I create a python3 virtual environment (explicitly avoiding symlinks, with --copies): » python3 -m venv --without-pip --copies venv This is my complete virtual environment now: » tree venv/ venv/ ├── bin │   ├── activate │   ├── activate.csh │  …
blueFast
  • 41,341
  • 63
  • 198
  • 344
16
votes
3 answers

How to create python 2.7 virtual environment using python 3.7

I have Python 3.7 && I would like to create a python 2.7 virtual environment to run some code that only works on python 2.7 How do I create this python 2.7 virtual environment? python3 -m venv ?
letter Q
  • 14,735
  • 33
  • 79
  • 118
16
votes
6 answers

Python-dotenv could not parse statement starting at line 2

I have uninstalled and reinstalled python-dotenv still i get same error. Could anyone sort this?
16
votes
4 answers

Venv home key in pyvenv.cfg

For continous integration purposes, I am using the following builtin py3.6 venv command (not to be confused with virtualenv) (see pep 405). python -m venv --system-site-packages --without-pip I have found it to work great and I am getting…
Lior Cohen
  • 5,570
  • 2
  • 14
  • 30
1 2
3
89 90