Skip to content
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

Allow setting custom venv path #2096

Closed
DeD1rk opened this issue Jul 10, 2023 · 2 comments · Fixed by j178/pdm#1
Closed

Allow setting custom venv path #2096

DeD1rk opened this issue Jul 10, 2023 · 2 comments · Fixed by j178/pdm#1
Labels
⭐ enhancement Improvements for existing features

Comments

@DeD1rk
Copy link

DeD1rk commented Jul 10, 2023

Is your feature request related to a problem? Please describe.

I would like to install a venv outside of the project root, but need the location to still be easily predictable. Specifically, I need this in a Dockerfile so I can copy out the venv to a different stage. Installing in the project root is not practical for me, and the location generated when using a named venv (which includes the hash of the project location) is unpredictable, so I can't refer to it easily in the next stage of a multi-stage dockerfile.

Describe the solution you'd like

It would be great if we can specify a custom path of a venv to use. For example, it would be great if I can specify with e.g. pdm sync --venv-path /opt/venv that a venv should be used/created (although having to create it first with pdm venv create --venv-path /opt/venv would be fine too) at /opt/venv.

@DeD1rk DeD1rk added the ⭐ enhancement Improvements for existing features label Jul 10, 2023
@frostming
Copy link
Collaborator

Create it manually and point to it later:

python3 -m venv /path/to/my/venv
pdm use -f /path/to/my/venv

@DeD1rk
Copy link
Author

DeD1rk commented Jul 10, 2023

Oh wow, I had no idea that was possible, thanks! Might be nice to add a note to the documentation around https://pdm.fming.dev/latest/usage/venv/#create-a-virtualenv-yourself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ enhancement Improvements for existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants