-
Notifications
You must be signed in to change notification settings - Fork 615
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
Unable to activate VIRTUAL_ENV when CONDA_PREFIX exists #2028
Comments
@konstin - Thoughts? |
We could have |
This'd be useful, same error came up when using Rye to set up a new project, while the global python comes from Conda. |
This also happens if you try to have The easy alternative is just to globally install |
When conda is activated it can be considered a globally available Python, therefore when a virtual environment is activated in a conda environment it is equivalent to a virtual environment being activated when there is a system install, the virtual environment should take precedence. This has come up a few of times on pip issues, I'll try and find the discussion . But anecdotally when I was a heavy conda user this is what I would have expected. |
It is a common pattern to have an active conda base env (that sets `CONDA_PREFIX`) and then create a venv on top of that (setting `VIRTUAL_ENV`). Previously, we would error when both `VIRTUAL_ENV` and `CONDA_PREFIX` were set, now `VIRTUAL_ENV` takes precedence over `CONDA_PREFIX`. Fixes #2028
It is a common pattern to have an active conda base env (that sets `CONDA_PREFIX`) and then create a venv on top of that (setting `VIRTUAL_ENV`). Previously, we would error when both `VIRTUAL_ENV` and `CONDA_PREFIX` were set, now `VIRTUAL_ENV` takes precedence over `CONDA_PREFIX`. Fixes #2028
I'm trying out uv, together with hatch-pip-compile (and hatch). venv creation works fine, and speed is significantly faster, great!
Except when I try to run command with created virtual env, error raises
The error message is clean, that's great, and I can fix it on my computer in 5 seconds (conda deactivate).
I just wonder if there is any difficulty makes this "user action" necessary?
Here is the hatch.toml (very likely unrelated imo since hatch is just an invoker and after I deactivated conda environment everything looks ok)
Thank you!
The text was updated successfully, but these errors were encountered: