uv: Can't install `chumpy`

uv version

uv 0.4.7 (a178051e8 2024-09-07)

Reproduce:

uv add chumpy

image

It’s similar to #1551 but the solution don’t work:

  1. Use uv init --lib to create a project that allows [build-system]
  2. Modify the [build-system] to image
  3. Use uv add chumpy, and get an error image

uv add pip/uv pip install pip then uv add chumpy/uv pip install chumpy don’t work.

uv add pip/uv pip install pip then uv run pip install chumpy/uv run python -m pip install chumpy don’t work. (NOTE: they work when there is a cached wheel.)

image

But pixi can handle this.

pixi add python pip
pixi run pip install chumpy

image

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (19 by maintainers)

Most upvoted comments

Sadly this is an issue with chumpy itself. The package is not properly structured – it’s documented as such here: https://github.com/astral-sh/uv/issues/2252#issuecomment-1981978204. For example, it also won’t work if you run pip install chumpy --use-pep517, which will eventually be the default in pip:

❯ pip install chumpy --use-pep517
Collecting chumpy
  Downloading chumpy-0.70.tar.gz (50 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [26 lines of output]
      Traceback (most recent call last):
        File "<string>", line 9, in <module>
      ModuleNotFoundError: No module named 'pip'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/Users/crmarsh/.local/share/rtx/installs/python/3.12.3/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/crmarsh/.local/share/rtx/installs/python/3.12.3/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       ...

(In the pixi example you included, that’s just pixi running pip within an environment, there’s no special handling there that differs from pip install.)

You can either use uv pip install chumpy --no-build-isolation, or see the docs on using build isolation with uv add and related APIs.

I think the difference is that uv lock runs in the system Python interpreter (since we’re not doing any install operations), which happens to have setuptools installed in the environment (this isn’t true of later versions of Python, like Python 3.12), whereas with uv sync, we run in the project virtual environment, which doesn’t include setuptools by default. If the project had a build-time dependency other than setuptools and pip, both versions would fail. So it kind of works by accident.

You can probably get the uv lock version to fail (I assume) by running uv venv first?

Yeah I think to explore further I’d need a consistent reproduction (I’d suggest running uv cache clean and rm -f uv.lock before any sequence of commands).