-
-
Notifications
You must be signed in to change notification settings - Fork 430
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
Python venv not activating correctly depending on shims #3458
Comments
This is often a matter of ordering.
After mise activate, anything added to the start of the path will never be overridden by mise. If you flip the order it might work how you expect. I think the current recommendation for bash is to put eval "$(mise activate bash --shims)"
eval "$(mise activate bash)" in your Also fyi, all |
yeah you definitely shouldn't add shims after activating—that doesn't make sense |
Ah, brilliant thanks! So, maybe two points from that:
|
I'm hesitant to put warnings like this in, I'm sure there is someone out there that has some reason for wanting to do things this way even though it generally isn't what you should do.
I think the docs are pretty clear https://mise.jdx.dev/cli/activate#shims |
When only using I think https://mise.jdx.dev/dev-tools/shims.html#how-to-add-mise-shims-to-path is useful to link to from the So, in summary, I need it like this: eval "$(mise activate bash --shims)"
eval "$(mise activate bash)" Having them in the other order worked (for me) before 2024.12.2. |
Yes, shims just add some executables to path, so it will never automatically change your path or activate environments as you change directory.
Yes. Doing it the other way around was unspecified behaviour and never supported. The docs are much better today, so no one else should get into that situation. |
Describe the bug
I'm using mise in https://codeberg.org/karrot/karrot-backend with this mise.toml.
After a recent upgrade (
2024.12.2
or higher), my python environment couldn't load any of the libraries, it was using the wrong python, not the venv.I found it was related to having this "IDE integration" line (which is what it used to recommend in the docs) in my bashrc:
With
2024.12.1
(the first part of) my path would get set correctly to:In
2024.12.2
and later, it gets set to this instead:The presence of
/home/nick/.local/share/mise/shims
at the start, prevents it using the correct python environment.If I switch to my shims enabling to the current approach in the docs:
... then it doesn't activate the venv at all.
trace log
Running
.venv/bin/activate
manually activates it correctly.To Reproduce
Install mise version
2024.12.2
or higher, deactivate all existing mise environment, then:Expected behavior
The venv path should always be before shims path.
mise doctor
outputAs I'm running it in various contexts, I see all combinations of
activated
andshims_on_path
.Additional context
My
~/.config/mise/config.toml
has this in it:It looks related to the change here #3396 - which is doing something with the shims, and was added in 2024.12.2.
I'm going to try only activating using:
... and try out this intellij plugin for mise https://plugins.jetbrains.com/plugin/24904-mise
The text was updated successfully, but these errors were encountered: