pypa / twine

Utilities for interacting with PyPI

Home Page:https://twine.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Transitive Rustup Dependency or Something

mentalisttraceur opened this issue · comments

Your Environment

1) Your operating system:

Right now I have this happening in Termux on Android, but I suspect this happens on any system which:

  1. Lacks pre-built wheels of your nh3 dependency, or any other dependency that uses maturin to build Rust pieces. (For example, Linux running on Aarch64 (ARM) CPUs.)

  2. Doesn't have rustup installed (but has a full Rust toolchain - rustc, etc). Not entirely clear and I don't have time to dig into why one of your transitive dependencies is unable to build on systems that can generally build things just fine.

2) Version of python you are running:

$ python --version
Python 3.11.5

3) How did you install twine? Did you use your operating system's package manager or pip or something else?

I tried installing twine with pip install twine.

This was the error/output:

Collecting twine
  Downloading twine-4.0.2-py3-none-any.whl (36 kB)
Collecting pkginfo>=1.8.1 (from twine)
  Downloading pkginfo-1.9.6-py3-none-any.whl (30 kB)
Collecting readme-renderer>=35.0 (from twine)
  Obtaining dependency information for readme-renderer>=35.0 from https://files.pythonhosted.org/packages/b5/7e/992e0e21b37cadd668226f75fef0aa81bf21c2426c98bc06a55e514cb323/readme_renderer-42.0-py3-none-any.whl.metadata
  Downloading readme_renderer-42.0-py3-none-any.whl.metadata (2.8 kB)
Collecting requests>=2.20 (from twine)
  Obtaining dependency information for requests>=2.20 from https://files.pythonhosted.org/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl.metadata
  Downloading requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Collecting requests-toolbelt!=0.9.0,>=0.8.0 (from twine)
  Downloading requests_toolbelt-1.0.0-py2.py3-none-any.whl (54 kB)

Collecting urllib3>=1.26.0 (from twine)
  Obtaining dependency information for urllib3>=1.26.0 from https://files.pythonhosted.org/packages/26/40/9957270221b6d3e9a3b92fdfba80dd5c9661ff45a664b47edd5d00f707f5/urllib3-2.0.6-py3-none-any.whl.metadata
  Downloading urllib3-2.0.6-py3-none-any.whl.metadata (6.6 kB)
Collecting importlib-metadata>=3.6 (from twine)
  Obtaining dependency information for importlib-metadata>=3.6 from https://files.pythonhosted.org/packages/cc/37/db7ba97e676af155f5fcb1a35466f446eadc9104e25b83366e8088c9c926/importlib_metadata-6.8.0-py3-none-any.whl.metadata
  Downloading importlib_metadata-6.8.0-py3-none-any.whl.metadata (5.1 kB)
Collecting keyring>=15.1 (from twine)
  Obtaining dependency information for keyring>=15.1 from https://files.pythonhosted.org/packages/0e/8f/5772801169cf62e8232721034f91f81e33b0cfa6e51d3bf6ff65c503af2a/keyring-24.2.0-py3-none-any.whl.metadata
  Downloading keyring-24.2.0-py3-none-any.whl.metadata (20 kB)
Collecting rfc3986>=1.4.0 (from twine)
  Downloading rfc3986-2.0.0-py2.py3-none-any.whl (31 kB)
Collecting rich>=12.0.0 (from twine)
  Obtaining dependency information for rich>=12.0.0 from https://files.pythonhosted.org/packages/be/2a/4e62ff633612f746f88618852a626bbe24226eba5e7ac90e91dcfd6a414e/rich-13.6.0-py3-none-any.whl.metadata
  Downloading rich-13.6.0-py3-none-any.whl.metadata (18 kB)
Collecting zipp>=0.5 (from importlib-metadata>=3.6->twine)
  Obtaining dependency information for zipp>=0.5 from https://files.pythonhosted.org/packages/d9/66/48866fc6b158c81cc2bfecc04c480f105c6040e8b077bc54c634b4a67926/zipp-3.17.0-py3-none-any.whl.metadata
  Downloading zipp-3.17.0-py3-none-any.whl.metadata (3.7 kB)
Collecting jaraco.classes (from keyring>=15.1->twine)
  Obtaining dependency information for jaraco.classes from https://files.pythonhosted.org/packages/c7/6b/1bc8fa93ea85146e08f0e0883bc579b7c7328364ed7df90b1628dcb36e10/jaraco.classes-3.3.0-py3-none-any.whl.metadata
  Downloading jaraco.classes-3.3.0-py3-none-any.whl.metadata (2.9 kB)
Collecting SecretStorage>=3.2 (from keyring>=15.1->twine)
  Downloading SecretStorage-3.3.3-py3-none-any.whl (15 kB)
Collecting jeepney>=0.4.2 (from keyring>=15.1->twine)
  Downloading jeepney-0.8.0-py3-none-any.whl (48 kB)
Collecting nh3>=0.2.14 (from readme-renderer>=35.0->twine)
  Downloading nh3-0.2.14.tar.gz (14 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [60 lines of output]
      Collecting maturin<2.0,>=1.0
        Downloading maturin-1.3.0.tar.gz (175 kB)
           ━━━━━━━━━━━━━━━ 175.6/175.6 kB 2.9 MB/s eta 0:00:00
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Building wheels for collected packages: maturin
        Building wheel for maturin (pyproject.toml): started
        Building wheel for maturin (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
      
        × Building wheel for maturin (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [37 lines of output]
            /data/data/com.termux/files/usr/tmp/pip-build-env-_3v7r0pa/overlay/lib/python3.11/site-packages/setuptools/config/_apply_pyprojecttoml.py:80: SetuptoolsWarning: `install_requires` overwritten in `pyproject.toml` (dependencies)
              corresp(dist, value, root_dir)
            running bdist_wheel
            running build
            running build_py
            creating build
            creating build/lib.linux-aarch64-cpython-311
            creating build/lib.linux-aarch64-cpython-311/maturin
            copying maturin/__init__.py -> build/lib.linux-aarch64-cpython-311/maturin
            copying maturin/__main__.py -> build/lib.linux-aarch64-cpython-311/maturin
            copying maturin/import_hook.py -> build/lib.linux-aarch64-cpython-311/maturin
            running egg_info
            creating maturin.egg-info
            writing maturin.egg-info/PKG-INFO
            writing dependency_links to maturin.egg-info/dependency_links.txt
            writing requirements to maturin.egg-info/requires.txt
            writing top-level names to maturin.egg-info/top_level.txt
            writing manifest file 'maturin.egg-info/SOURCES.txt'
            reading manifest file 'maturin.egg-info/SOURCES.txt'
            reading manifest template 'MANIFEST.in'
            warning: no files found matching '*.json' under directory 'src/python_interpreter'
            writing manifest file 'maturin.egg-info/SOURCES.txt'
            running build_ext
            running build_rust
            error: rustup could not choose a version of rustc to run, because one wasn't specified explicitly, and no default is configured.
            help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.
            error: can't find Rust compiler
      
            If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
      
            To update pip, run:
      
                pip install --upgrade pip
      
            and then retry package installation.
      
            If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for maturin
      Failed to build maturin
      ERROR: Could not build wheels for maturin, which is required to install pyproject.toml-based projects
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

4) Version of twine you have installed

N/A

5) Which package repository are you targeting?

N/A

The Issue

Twine fails to install due to some sort of wrong assumption in a Rust build of a dependency.

At a glance, it seems like Maturin tries to unconditionally run rustup, which either fails (last I checked rustup doesn't work in Termux) or isn't installed (I didn't check if it bundles/downloads its own copy) and then gives up even though there's a Rust toolchain available (rustc is in PATH, etc).

I trust you're better equipped to figure out which of your dependencies is responsible, and open the appropriate issue w/ them. I'm opening this here because to me as a twine user, this is twine problem.

Steps to Reproduce

pip install twine

Thank you! I did a quick search for the keywords I thought of and didn't find that.

In the meantime, I was able to make progress by running these commands to make cargo and rustup recognize and use my system Rust install:

$ rustup toolchain link system /usr
$ rustup default system

(Replace /usr with /data/data/com.termux/files/usr on Termux.)