jdx/mise

Cannot install uwsgi with mise's python@3.13.0

Closed this issue · 5 comments

gslin commented

Describe the bug
We cannot install uwsgi under mise's Python 3.13.0.

To Reproduce

Test with container environment:

docker run -it --rm ubuntu:noble /bin/bash

Then:

sed -i -e 's/archive.ubuntu.com/us.archive.ubuntu.com/' /etc/apt/sources.list.d/ubuntu.sources; apt update; apt install -y build-essential curl git libbz2-dev libcurl4-openssl-dev libffi-dev liblzma-dev libreadline-dev libsqlite3-dev libssl-dev libz-dev tk-dev wget; apt clean
wget -qO - https://mise.jdx.dev/gpg-key.pub | gpg --dearmor | tee /etc/apt/keyrings/mise-archive-keyring.gpg 1> /dev/null; echo "deb [signed-by=/etc/apt/keyrings/mise-archive-keyring.gpg arch=amd64] https://mise.jdx.dev/deb stable main" | tee /etc/apt/sources.list.d/mise.list; apt update; apt install -y mise; apt clean; echo -e '#\nif command -v mise > /dev/null; then\n    eval "$(mise activate bash)"\nfi' >> ~/.profile; source ~/.profile; mise use -g python@3.13.0
pip install uwsgi

(Choose 11. Etc then 33. UTC during selecting timezone)

We will get error like this:

          super().run_command(command)
          ~~~~~~~~~~~~~~~~~~~^^^^^^^^^
        File "/tmp/pip-build-env-7m1c3bp4/overlay/lib/python3.13/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
          cmd_obj.run()
          ~~~~~~~~~~~^^
        File "<string>", line 77, in run
        File "/tmp/pip-install-h1zf7mq6/uwsgi_8a52a2d5b7ec473086acf56753803e7f/uwsgiconfig.py", line 760, in __init__
          raise Exception("you need a C compiler to build uWSGI")
      Exception: you need a C compiler to build uWSGI
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for uwsgi
Failed to build uwsgi
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (uwsgi)

[notice] A new release of pip is available: 24.1.2 -> 24.3.1
[notice] To update, run: pip install --upgrade pip

Expected behavior
Install uwsgi successfully.

mise doctor output

version: 2024.11.4 linux-x64 (8e68e3a 2024-11-06)
activated: yes
shims_on_path: no

build_info:
  Target: x86_64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Wed, 6 Nov 2024 22:22:19 +0000
  Rust Version: rustc 1.82.0 (f6e511eec 2024-10-15)
  Profile: release

shell:
  bash
  GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)
  Copyright (C) 2022 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

  This is free software; you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.

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

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

backends:
  cargo
  core
  go
  npm
  pipx
  spm
  ubi
  vfox

plugins:

toolset:
  python@3.13.0

env_vars:
  MISE_SHELL=bash

settings:
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cache_prune_age = "30d"
  ci = false
  color = true
  debug = false
  disable_backends = []
  disable_default_registry = false
  disable_hints = []
  disable_tools = []
  experimental = false
  fetch_remote_versions_cache = "1h"
  fetch_remote_versions_timeout = "10s"
  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
  http_timeout = "30s"
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  libgit2 = true
  lockfile = false
  log_level = "info"
  not_found_auto_install = true
  paranoid = false
  pin = false
  plugin_autoupdate_last_check_duration = "7d"
  quiet = false
  raw = false
  task_timings = false
  trace = false
  trusted_config_paths = []
  use_versions_host = true
  verbose = false
  yes = false

  [cargo]
  binstall = true

  [node]

  [pipx]
  uvx = false

  [python]
  default_packages_file = "~/.default-python-packages"
  pyenv_repo = "https://github.com/pyenv/pyenv.git"
  venv_auto_create = false
  venv_stdlib = false

  [ruby]
  default_packages_file = "~/.default-gems"
  ruby_build_repo = "https://github.com/rbenv/ruby-build.git"
  ruby_install = false
  ruby_install_repo = "https://github.com/postmodern/ruby-install.git"

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false
No warnings found
No problems found

Additional context

No issues on pyenv (also in a clean container environment):

sed -i -e 's/archive.ubuntu.com/us.archive.ubuntu.com/' /etc/apt/sources.list.d/ubuntu.sources; apt update; apt install -y build-essential curl git libbz2-dev libcurl4-openssl-dev libffi-dev liblzma-dev libreadline-dev libsqlite3-dev libssl-dev libz-dev tk-dev wget; apt clean; git clone https://github.com/pyenv/pyenv.git ~/.pyenv; echo -e "export PYENV_ROOT=\"\${HOME}/.pyenv\"\nif [ -d \"\${PYENV_ROOT}\" ]; then\n    export PATH=\"\${PYENV_ROOT}/bin:\${PYENV_ROOT}/shims:\${PATH}\"\n    eval \"\$(pyenv init - --no-rehash)\"\nfi" >> ~/.profile; source ~/.profile; pyenv install 3.13.0; pyenv global 3.13.0
pip install uwsgi

This likely a problem with python pre-compiled binaries? See the warning when you install python:

[mise hint] installing precompiled python from indygreg/python-build-standalone
if you experience issues with this python (e.g.: running poetry), switch to python-build by running mise settings set python.compile 1

https://mise.jdx.dev/lang/python.html#precompiled-python-binaries

jdx commented

no it's this:

  Exception: you need a C compiler to build uWSGI
gslin commented

Thanks for the explanation. The build-essential package includes gcc & g++, which are installed via apt in the beginning:

root@467bfbfa346c:/# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.2.0-23ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4)
root@467bfbfa346c:/# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.2.0-23ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4)

And they're actually used by pyenv (commands are in the Additional context section of original report) to compile Python 3.13.0 (confirmed with my CPU usage and also showed in -VV output about compiled time):

Cloning into '/root/.pyenv'...
remote: Enumerating objects: 25197, done.
remote: Counting objects: 100% (1950/1950), done.
remote: Compressing objects: 100% (183/183), done.
remote: Total 25197 (delta 1826), reused 1809 (delta 1761), pack-reused 23247 (from 1)
Receiving objects: 100% (25197/25197), 5.11 MiB | 5.82 MiB/s, done.
Resolving deltas: 100% (16976/16976), done.
Downloading Python-3.13.0.tar.xz...
-> https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tar.xz
Installing Python-3.13.0...
Installed Python-3.13.0 to /root/.pyenv/versions/3.13.0
root@467bfbfa346c:/# python3 -VV
Python 3.13.0 (main, Nov  9 2024, 21:03:49) [GCC 13.2.0]
root@467bfbfa346c:/# python3 -VV
Python 3.13.0 (main, Nov  9 2024, 21:03:49) [GCC 13.2.0]
gslin commented

Thansk hverlin, it works when setting with mise settings set python.compile 1 before mise use -g python@3.13.0:

root@93c7c9468a74:/# mise settings set python.compile 1
root@93c7c9468a74:/# mise use -g python@3.13.0
mise hint use multiple versions simultaneously with mise use python@3.12 python@3.11
Downloading Python-3.13.0.tar.xz...
-> https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tar.xz
Installing Python-3.13.0...
Installed Python-3.13.0 to /root/.local/share/mise/installs/python/3.13.0
mise python@3.13.0 ✓ installed
mise ~/.config/mise/config.toml tools: python@3.13.0
root@93c7c9468a74:/# pip install uwsgi
Collecting uwsgi
  Downloading uwsgi-2.0.28.tar.gz (816 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 816.2/816.2 kB 4.8 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: uwsgi
  Building wheel for uwsgi (pyproject.toml) ... done
  Created wheel for uwsgi: filename=uWSGI-2.0.28-cp313-cp313-linux_x86_64.whl size=558726 sha256=361fb828449c00259b9b8a373d960a41b842a4839c401b5ddae7f5d59d807f7f
  Stored in directory: /root/.cache/pip/wheels/64/67/66/4ea57e801333bf19b24abd7aca4af17ddc9cf3ee7b373e38b8
Successfully built uwsgi
Installing collected packages: uwsgi
Successfully installed uwsgi-2.0.28
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: pip install --upgrade pip

Just curious if this is expected or maybe something deeper need to be dug out?

jdx commented

like the warning states when you install them, the precompiled python's are not fully compatible. If you'd like to fix this you should ask on the indygreg board.