How to set the full name of the virtualenv created
See original GitHub issueWhen using inside my project directory PROJECTDIR
pipenv install
pipenv
creates a virtualenv named "PROJECTDIR-<someid>"
. How can I specify this full name myself, say to call the virtualenv just "PROJECTDIR"
?
And how can I tell pipenv
to use an existing virtualenv for this directory and just add the new packages from the requirements.txt
?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:24
- Comments:14 (2 by maintainers)
Top Results From Across the Web
venv — Creation of virtual environments — Python 3.11.1 ...
Running this command creates the target directory (creating any parent directories that don't exist already) and places a pyvenv.cfg file in it with...
Read more >Name Your Virtual Environments - Set Up a Python Environment
You can, of course, name your virtual environments however you wish. ... Create a file called .gitignore with the following contents:
Read more >Python Virtual Environments: A Primer
In this tutorial, you'll learn how to work with Python's venv module to create and manage separate virtual environments for your Python ...
Read more >Pipenv & Virtual Environments
The name of the current virtual environment will now appear on the left of the prompt (e.g. (venv)Your-Computer:project_folder UserName$ ) to let you...
Read more >Command Reference - Virtualenvwrapper - Read the Docs
Create a new virtualenv in the WORKON_HOME directory. ... A unique virtualenv name is generated. If -c or --cd is specified the working...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This has been discussed multiple times in the past. You can search the issue tracker for similar entries. To sum things, it is not possible (at this time; can’t say for the future) to specify the name of the virtualenv, since Pipenv relies on this information to associate it to your project. The alternative is to set environment variable
PIPENV_VENV_IN_PROJECT
to tell Pipenv to look for the a directory named.venv
inside your project (the same level asPipfile
).To import dependencies from
requirements.txt
, usepipenv install -r
. This converts the requirements file to a Pipfile, and use it to create the environment. There is not way to specify an existing virtualenv (unless you name it exactly the same as Pipenv would).Most of the above is mentioned in detail in the documentation. Please check out relevant sections for more information.
https://docs.pipenv.org
One of my main issues with not being able to choose a name for the virtual environment is that it doesn’t take into account varying folder structures. I usually follow a common convention and like to nest my source code inside a
/src
directory of my main project folder. In the/Users/NAME/.local/share/virtualenvs
directory every virtual env looks like:This makes it a little harder to distinguish between them.
This is also problematic when you have a
frontend
andbackend
in your repo, each with separate Pipenv files for separate dependencies. Again, I’d ideally like to name the projectPROJECT-frontend
andPROJECT-backend
. With the hash suffix on both of those.It would be nice to have a little control on the virtual environment naming.