-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set the full name of the virtualenv created #1226
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 To import dependencies from Most of the above is mentioned in detail in the documentation. Please check out relevant sections for more information. |
I know that I can set |
@kmpf I believe the goal of the project is really to remain as simple and straightforward as possible and to avoid introducing additional setup complexity or configuration overhead. By sticking firmly to deterministic hashing of project paths and providing the alternative of .venv directories, there is never any ambiguity about where pipenv-managed environments will be stored. I understand what you want and I get why you want it, I'll go even further and say that I don't even think it's unreasonable. However I do think it is out of scope -- it is something that has been requested a few times though, and this is an open source project. I would strongly encourage anyone who needs additional layers of functionality to feel free to build and publish tools that provide that Thanks for the report, and thanks for using our tools :) |
My workaround: Current versions of pipenv respect an existing virtualenv, so if you want to control the name you could (with virtualenvwrapper)
pipenv install will notify that it will use the existing virtualenv. In order to keep using it, you'll have to remember to |
Is there a way to retrieve the name of the venv associated with a project? I mean, when I am not directly in the project path, can I figure out the name of the venv associated with it? |
The venv name is deterministic and based on the path to the Pipfile. It is just This one-liner will get you the hash:
|
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
This makes it a little harder to distinguish between them. This is also problematic when you have a It would be nice to have a little control on the virtual environment naming. |
So you bought 10 red Ferrari's and now, looking at your garage, you don't know any more which one you used yesterday. There are a few cases where this is inconvenient (like, which one did I put the dead guy in), but most of the time, you just want to get from A to B in style. Given your approach of looking at the virtualenv home, a quick look in All I see here, is cosmetics and minor inconvenience for things not done often. Can we move on? |
This is what I use. I just fork pipenv, add 3 lines, install it local. (
|
Thanks @darelf! Good idea. |
@darelf Care to open a PR patch against the main library since it seems that more than a couple users would like this feature? With all due respect to @techalchemy 's 2017 comment about it that closed the issue, I think it could be supported and may even reduce the number of support tickets if people can have predictable .virtualenv names configured as needed, non-default. |
This is finally fixed ❤️. Thank you for your feedback and involvement. |
New pipenv release |
When using inside my project directory
PROJECTDIR
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 therequirements.txt
?The text was updated successfully, but these errors were encountered: