Open kenahoo opened 1 month ago
it doesn't do anything if it's already on PATH
Does the virtual env functionality not work with shims? In my .mise.toml
I have
[env]
_.python.venv = { path = ".venv", create = true }
but python still shows that it's using $HOME/.local/share/mise/installs/python/3.11.9/lib/
, not .venv/
.
With eval "$(mise activate zsh --shims)"
in my ~/.zprofile
:
>>> for p in sys.path: print(p)
...
/Users/kwilliams/.local/share/mise/installs/python/3.11.9/lib/python311.zip
/Users/kwilliams/.local/share/mise/installs/python/3.11.9/lib/python3.11
/Users/kwilliams/.local/share/mise/installs/python/3.11.9/lib/python3.11/lib-dynload
/Users/kwilliams/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages <- incorrect
With eval "$(mise activate)"
in my ~/.zprofile
:
>>> for p in sys.path: print(p)
...
/Users/kwilliams/.local/share/mise/installs/python/3.11/lib/python311.zip
/Users/kwilliams/.local/share/mise/installs/python/3.11/lib/python3.11
/Users/kwilliams/.local/share/mise/installs/python/3.11/lib/python3.11/lib-dynload
/Users/kwilliams/<project location>/.venv/lib/python3.11/site-packages <- correct
The only difference is changing that one line in the profile.
Can you try adding mise hook-env
instead? https://github.com/jdx/mise/issues/2270
Just tried it, but it still doesn't seem to honor the venv
settings.
~/.zprofile
:
path[1,0]="/opt/homebrew/bin" # Prepend
eval "$(mise hook-env --shell zsh)"
.mise.toml
:
[tools]
python = "3.11"
[env]
_.python.venv = { path = ".venv", create = true }
It's not using the local .venv/
directory:
% python -c 'import sys; [print(p) for p in sys.path]'
/Users/kwilliams/.local/share/mise/installs/python/3.11.9/lib/python311.zip
/Users/kwilliams/.local/share/mise/installs/python/3.11.9/lib/python3.11
/Users/kwilliams/.local/share/mise/installs/python/3.11.9/lib/python3.11/lib-dynload
/Users/kwilliams/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages
Sadly, yes. mise hook-env
is being called once at your IDE's startup.
But the above is just me trying setups in a fresh shell, not using an IDE at all. I thought it would be good to troubleshoot it in the shell to get that working first.
Were you able to confirm in your environment that shims aren't working with python venv
s?
I'm trying to get
mise
working with my IDE, which is IntelliJ IDEA (commercial version). I'm following the instructions at https://mise.jdx.dev/ide-integration.html but I'm having some problems.I have put
eval "$(mise activate zsh --shims)"
into my~/.zprofile
and restarted my shell, but this doesn't result in the shims directory being on thePATH
. If I runmise activate zsh --shims
directly, it looks like it produces no output at all, is that supposed to be the case? I'd have assumed it would spit out some text to modifyPATH
.Now I've set up a symlink for
asdf
and also added the shims directory toPATH
:But I can't seem to find any sign in IntelliJ that either
asdf
ormise
has been detected. Where would I see something? What should be different? Is there a plugin necessary? If I go intoProject Settings
->Project
->SDK
for a Python project, I don't see any stuff that seems to have anything to do withmise
, is it supposed to show up automatically? And environment variables that I've set locally in a project's.mise.toml
file aren't getting set in IDE jobs, though they're working fine at a terminal.Any help would be very appreciated, thanks.
**`mise doctor` output**
```text version: 2024.5.27 macos-arm64 (2024-05-31) activated: yes shims_on_path: yes build_info: Target: aarch64-apple-darwin Features: DEFAULT, NATIVE_TLS Built: Fri, 31 May 2024 02:31:10 +0000 Rust Version: rustc 1.78.0 (9b00956e5 2024-04-29) (Homebrew) Profile: release shell: /bin/zsh zsh 5.9 (x86_64-apple-darwin23.0) dirs: data: ~/.local/share/mise config: ~/.config/mise cache: ~/Library/Caches/mise state: ~/.local/state/mise shims: ~/.local/share/mise/shims config_files: ~/git/transmission/ey299-tft_view/.mise.toml backends: cargo core go npm pipx ubi plugins: bun (core) deno (core) erlang (core) go (core) java (core) node (core) python (core) ruby (core) toolset: python@3.11.9 env_vars: MISE_SHELL=zsh settings: activate_aggressive = false all_compile = false always_keep_download = false always_keep_install = false asdf_compat = false cargo_binstall = true color = true disable_default_shorthands = false disable_tools = [] experimental = false go_default_packages_file = "~/.default-go-packages" go_download_mirror = "https://dl.google.com/go" go_repo = "https://github.com/golang/go" go_set_gopath = false go_set_goroot = true go_skip_checksum = false jobs = 4 legacy_version_file = true legacy_version_file_disable_tools = [] node_compile = false not_found_auto_install = true paranoid = false plugin_autoupdate_last_check_duration = "7d" python_default_packages_file = "/Users/kwilliams/.default-python-packages" python_pyenv_repo = "https://github.com/pyenv/pyenv.git" raw = false trusted_config_paths = [] quiet = false verbose = false yes = false ci = false debug = false trace = false log_level = "info" python_venv_auto_create = false [status] missing_tools = "if_other_versions_installed" show_env = false show_tools = false No warnings found No problems found ```