mise icon indicating copy to clipboard operation
mise copied to clipboard

Mise fails to download precompiled python on macOS

Open cjntaylor opened this issue 5 months ago • 2 comments

Describe the bug On a fresh, clean install on macOS (Ventura and Sonoma), mise fails to install precompiled python, and immediately falls back to running python-build

To Reproduce 1 . (If already installed) - mise implode, manually rm -rf ~/Library/Caches/mise and ~/.local/share/mise, ~/.config/mise (just to be sure) 2. curl https://mise.run | sh 3. eval $(${HOME}/.local/bin/mise activate zsh) 4. mise install python@latest

Expected behavior Per the default configuration, the latest build from python-build-standalone should be installed, without compilation.

mise doctor output

version: 2024.3.2 macos-x64 (3b25ebb 2024-03-15)
activated: yes
shims_on_path: no

build_info: 
  Target: x86_64-apple-darwin
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Fri, 15 Mar 2024 04:40:23 +0000
  Rust Version: rustc 1.76.0 (07dca489a 2024-02-04)
  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: 


plugins: 
  bun     (core)
  deno    (core)
  go      (core)
  java    (core)
  node    (core)
  python  (core)
  ruby    (core)

toolset: 


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_compile = false
  python_default_packages_file = "/Users/taylocj1/.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 problems found

Additional context

I noticed that the precompiled.msgpack.z file is too small when initially created:

❯ ls -alh ~/Library/Caches/mise/python
total 16
drwxr-xr-x   6 sanitized  sanitized   192B Mar 15 02:19 .
drwxr-xr-x   4 sanitized  sanitized   128B Mar 15 02:19 ..
drwxr-xr-x   3 sanitized  sanitized    96B Mar 15 02:19 3.12.2
-rw-r--r--   1 sanitized  sanitized     9B Mar 15 02:19 precompiled.msgpack.z
drwxr-xr-x  27 sanitized  sanitized   864B Mar 15 02:19 pyenv
-rw-r--r--   1 sanitized  sanitized   2.9K Mar 15 02:19 remote_versions.msgpack.z

I've also discovered that if I manually set the python architecture when first running the command, it works as expected, but only if I set the architecture non-specifically to x86_64:

❯ rm -rf ~/Library/Caches/mise ~/.local/share/mise ~/.config/mise
❯ MISE_PYTHON_PRECOMPILED_ARCH="x86_64" mise install python@latest
mise installing precompiled python from indygreg/python-build-standalone
mise if you experience issues with this python, switch to python-build
mise by running: mise settings set python_compile 1
mise [email protected] downloading cpython-3.12.2+20240224-x86_64-apple-darwin-ins ...

The msgpack files also appear to be correct now:

❯ ls -alh ~/Library/Caches/mise/python
total 16
drwxr-xr-x  5 sanitized  sanitized   160B Mar 15 02:24 .
drwxr-xr-x  4 sanitized  sanitized   128B Mar 15 02:24 ..
drwxr-xr-x  3 sanitized  sanitized    96B Mar 15 02:24 3.12.2
-rw-r--r--  1 sanitized  sanitized   752B Mar 15 02:24 precompiled.msgpack.z
-rw-r--r--  1 sanitized  sanitized   2.9K Mar 15 02:24 remote_versions.msgpack.

Setting MISE_PYTHON_PRECOMPILED_ARCH to anything other than "x86_64" causes this failure (neither "x86_64_v3" or "x86_64_v2" work). I believe the issue is that the v3 and v2 variants do not exist for macOS but that's the default architecture being generated by the code.

cjntaylor avatar Mar 15 '24 06:03 cjntaylor