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

Use already activated venv #11014

Closed
khamaileon opened this issue Jan 28, 2025 · 2 comments
Closed

Use already activated venv #11014

khamaileon opened this issue Jan 28, 2025 · 2 comments
Labels
question Asking for clarification or support

Comments

@khamaileon
Copy link

Question

I am in the process of switching from virtualenvwrapper + piptools to uv. The only thing stopping me from fully switching is the ability to activate a virtual environment and run some hooks (like cd ~/workspace/myproject). I've seen that's already a popular request so I decided to keep virtualenvwrapper for now.

However, when I run uv sync, I get this warning:

`VIRTUAL_ENV=/Users/me/.virtualenvs/myproject` does not match the project environment path `.venv` and will be ignored

The script then creates a .venv folder and completes the sync instead of using the already activated venv.

This behavior is odd because the documentation states the opposite: https://docs.astral.sh/uv/pip/environments/#discovery-of-python-environments

Am I missing something?

Platform

No response

Version

No response

@khamaileon khamaileon added the question Asking for clarification or support label Jan 28, 2025
@konstin
Copy link
Member

konstin commented Jan 28, 2025

uv sync uses .venv in your project independent of your system of activated environment for consistency in the project commands. If you need to specifically use a different environment, you can set UV_PROJECT_ENVIRONMENT to your venv location.

@khamaileon
Copy link
Author

Thanks for your help. Here's the doc if someone else missed it: https://docs.astral.sh/uv/concepts/projects/config/#project-environment-path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

2 participants