Skip to content

uv fails to recognize Python installations from mise sync python --uv #3654

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

Closed
kiangti opened this issue Dec 17, 2024 · 2 comments · Fixed by #3704
Closed

uv fails to recognize Python installations from mise sync python --uv #3654

kiangti opened this issue Dec 17, 2024 · 2 comments · Fixed by #3704
Labels

Comments

@kiangti
Copy link

kiangti commented Dec 17, 2024

Describe the bug
It seems that uv cannot recognize the symbolic link created by mise sync python --uv in ~/.local/share/uv/python

To Reproduce

~ mise ls python
Tool    Version  Source                      Requested
python  3.11.11
python  3.13.1   ~/.config/mise/config.toml  latest
➜  ~ mise sync python --uv
mise WARN  failed to resolve toolset: [~/.config/mise/config.toml] thefuck@latest: thefuck not found in mise tool registry
➜  ~ ls -al ~/.local/share/uv/python
total 16
drwxr-xr-x  5 liangyi  staff   160 Dec 18 04:55 .
drwxr-xr-x  4 liangyi  staff   128 Dec 18 04:55 ..
-rw-r--r--@ 1 liangyi  staff  6148 Dec 18 04:55 .DS_Store
lrwxr-xr-x  1 liangyi  staff    56 Dec 18 04:55 cpython-3.11.11-macos-x86_64-gnu -> /Users/liangyi/.local/share/mise/installs/python/3.11.11
lrwxr-xr-x  1 liangyi  staff    55 Dec 18 04:55 cpython-3.13.1-macos-x86_64-gnu -> /Users/liangyi/.local/share/mise/installs/python/3.13.1
➜  ~ mise install thefuck
error: No interpreter found for Python 3.11 in managed installations or search path
mise ERROR uv failed
error: No interpreter found for Python 3.11 in managed installations or search path
mise ERROR failed to install pipx:[email protected]
mise ERROR uv exited with non-zero status: exit code 2
mise ERROR Run with --verbose or MISE_VERBOSE=1 for more information
➜  ~ uv python list
cpython-3.13.1-macos-x86_64-none    .local/share/mise/installs/python/3.13.1/bin/python3.13
cpython-3.13.1-macos-x86_64-none    .local/share/mise/installs/python/3.13.1/bin/python3 -> python3.13
cpython-3.13.1-macos-x86_64-none    .local/share/mise/installs/python/3.13.1/bin/python -> .local/share/mise/installs/python/3.13.1/bin/python3
cpython-3.9.6-macos-x86_64-none     /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -> ../../Library/Frameworks/Python3.framework/Versions/3.9/bin/python3
[settings]
experimental = true

[alias]
thefuck = "pipx:thefuck"

[env]
UV_PYTHON_DOWNLOADS = "never"

[tool]
python = "latest"
thefuck = { version = "latest", uvx_args = "--python 3.11" }

Expected behavior
Python versions installed by mise should be detected by uv python list. This means I can install thefuck using uvx_args = "--python 3.11", even when Python 3.11 is not activated in the configuration

mise doctor output

version: 2024.12.12 macos-x64 (2d9d289 2024-12-16)
activated: yes
shims_on_path: no

build_info:
  Target: x86_64-apple-darwin
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Mon, 16 Dec 2024 18:22:36 +0000
  Rust Version: rustc 1.83.0 (90b35a623 2024-11-26)
  Profile: release

shell:
  /bin/zsh
  zsh 5.9 (x86_64-apple-darwin23.0)

dirs:
  cache: ~/Library/Caches/mise
  config: ~/.config/mise
  data: ~/.local/share/mise
  shims: ~/.local/share/mise/shims
  state: ~/.local/state/mise

config_files:
  ~/.config/mise/config.toml

backends:
  aqua
  asdf
  cargo
  core
  gem
  go
  npm
  pipx
  spm
  ubi
  vfox

plugins:
  flutter  https://github.com/oae/asdf-flutter.git#d736066
  maven    https://github.com/mise-plugins/asdf-maven.git#c872214
  tuist    https://github.com/asdf-community/asdf-tuist.git#44c87b2

toolset:
  aqua:astral-sh/[email protected]
  aqua:cloudflare/[email protected]
  aqua:firebase/[email protected]
  asdf:flutter@stable
  asdf:[email protected]
  asdf:[email protected]
  core:[email protected]
  core:[email protected]
  core:[email protected]+11.0.LTS
  core:[email protected]
  core:[email protected]
  core:[email protected]
  core:[email protected]
  go:github.com/metacubex/geo/cmd/geo@master
  pipx:git+https://github.com/5ec1cff/payload-dumper.git@master
  pipx:[email protected]     (missing)
  ubi:ajeetdsouza/[email protected]
  ubi:jdx/[email protected]
  ubi:watchexec/[email protected]

path:
  ~/Library/Android/sdk/tools
  ~/Library/Android/sdk/emulator
  ~/Library/Android/sdk/cmdline-tools/latest/bin
  ~/Library/Android/sdk/platform-tools
  ~/.spicetify
  ~/PersonalSpace/Exec/ffmpeg
  ~/.local/share/mise/installs/usage/1.6.0/bin
  ~/.local/share/mise/installs/watchexec/2.2.1/bin
  ~/.local/share/mise/installs/bun/1.1.38/bin
  ~/.local/share/mise/installs/flutter/stable/bin
  ~/.local/share/mise/installs/go/1.23.4/bin
  ~/.local/share/mise/installs/java/temurin-21.0.5+11.0.LTS/bin
  ~/.local/share/mise/installs/node/23.4.0/bin
  ~/.local/share/mise/installs/python/3.13.1/bin
  ~/.local/share/mise/installs/ruby/3.3.6/bin
  ~/.cargo/bin
  ~/.local/share/mise/installs/maven/3.9.9/bin
  ~/.local/share/mise/installs/tuist/4.37.0/bin
  ~/.local/share/mise/installs/uv/0.5.9/uv-x86_64-apple-darwin
  ~/.local/share/mise/installs/cloudflared/2024.12.1
  ~/.local/share/mise/installs/firebase/13.29.1
  ~/.local/share/mise/installs/geo/master/bin
  ~/.local/share/mise/installs/payload-dumper/master/bin
  ~/.local/share/mise/installs/zoxide/0.9.6/bin
  ~/.local/bin
  /usr/local/opt/curl/bin
  /usr/local/bin
  /System/Cryptexes/App/usr/bin
  /usr/bin
  /bin
  /usr/sbin
  /sbin
  /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin
  /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin
  /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
  /Library/Apple/usr/bin
  /Applications/Wireshark.app/Contents/MacOS
  /Applications/iTerm.app/Contents/Resources/utilities

env_vars:
  MISE_SHELL=zsh

settings:
  experimental          true                ~/.config/mise/config.toml
  trusted_config_paths  ["~/PersonalSpace"] ~/.config/mise/config.toml

No problems found

Additional context

@kiangti kiangti added the bug label Dec 17, 2024
@jdx
Copy link
Owner

jdx commented Dec 17, 2024

I noticed this behavior too, though it worked for some runtimes and not others. Wasn't sure why.

@jdx
Copy link
Owner

jdx commented Dec 19, 2024

ok I see why this is happening, it seems uv makes 2 modifications to the pythons:

❯ diff -rq uv mise
Only in uv/lib/python3.11: EXTERNALLY-MANAGED
Files uv/lib/python3.11/_sysconfigdata__darwin_darwin.py and mise/lib/python3.11/_sysconfigdata__darwin_darwin.py differ

the first is a simple file which maybe we could add, though doing so may have some ramifications I'm not aware of:

cat uv/lib/python3.11/EXTERNALLY-MANAGED 
[externally-managed]
Error=This Python installation is managed by uv and should not be modified.

it's weird to me that they call it "externally-managed" but it seems to mean "internally managed" in the way I'm understanding it. The second file however I don't really understand at all and the changes between them are hard to follow since they have completely different structure. I don't know how much they actually have in common but it could probably be determined from executing the python and converting to json or something. This is uv's code: https://github.com/astral-sh/uv/blob/main/crates/uv-python/src/sysconfig/mod.rs#L217

I also found this in the indygreg docs: https://gregoryszorc.com/docs/python-build-standalone/main/quirks.html#references-to-build-time-paths

it seems these are referenced used in python for things like the c compiler. These are settings mise should actually probably also be modifying I think outside of syncing with uv.

For now I'm just going to remove the reverse syncing back to uv. If uv had a different way to integrate outside pythons or if somehow these binaries become identical between installs we could get the reverse syncing but for now I don't see a path forward with that.

jdx added a commit that referenced this issue Dec 19, 2024
@jdx jdx closed this as completed in #3704 Dec 19, 2024
jdx added a commit that referenced this issue Dec 19, 2024
* fix: disable reverse uv syncing

Fixes #3654

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
miguelmig pushed a commit to miguelmig/mise that referenced this issue Dec 21, 2024
* fix: disable reverse uv syncing

Fixes jdx#3654

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants