uv icon indicating copy to clipboard operation
uv copied to clipboard

`uv venv --seed` doesn't seem to be installing `setuptools` for pypy

Open bendoerry opened this issue 1 year ago • 1 comments

Not sure whether title is "correct" here, but it presents that way.

Alembic is illustrative here, I've also had this occur with psycogreen, psycopg2cffi, flask-migrate, docopt (this is a non-exhaustive list)

With CPython (using rye to ensure same python version)

> uv venv --python <HOME>/.rye/py/[email protected]/install/bin/python3 --seed
Using Python 3.9.16 interpreter at <HOME>/.rye/py/[email protected]/install/bin/python3.9
Creating virtualenv at: .venv
 + setuptools==69.1.0
 + pip==24.0
 + wheel==0.42.0

> source .venv/bin/activate
> python3 --version
Python 3.9.16

> uv pip install alembic==1.0.11
Resolved 9 packages in 12ms
Installed 9 packages in 8ms
 + alembic==1.0.11
 + greenlet==3.0.3
 + mako==1.3.2
 + markupsafe==2.1.5
 + python-dateutil==2.8.2
 + python-editor==1.0.4
 + six==1.16.0
 + sqlalchemy==2.0.27
 + typing-extensions==4.9.0

With PyPy (This also occurs with system PyPy, not just rye managed)

> uv venv --python <HOME>/.rye/py/[email protected]/bin/python3 --seed
Using Python 3.9.16 interpreter at <HOME>/.rye/py/[email protected]/bin/pypy3.9
Creating virtualenv at: .venv
 + setuptools==69.1.0
 + pip==24.0
 + wheel==0.42.0

> source .venv/bin/activate
> python3 --version
Python 3.9.16 (feeb267ead3e6771d3f2f49b83e1894839f64fb7, Dec 29 2022, 14:23:21)
[PyPy 7.3.11 with GCC 10.2.1 20210130 (Red Hat 10.2.1-11)]

> uv pip install alembic==1.0.11
Resolved 9 packages in 11ms
error: Failed to download distributions
  Caused by: Failed to fetch wheel: greenlet==3.0.3
  Caused by: Failed to build: greenlet==3.0.3
  Caused by: Build backend failed to determine extra requires with `build_wheel()`:
--- stdout:

--- stderr:
Traceback (most recent call last):
  File "<string>", line 4, in <module>
ModuleNotFoundError: No module named 'setuptools'
---

> # Next one included since error is slightly different
> uv pip install alembic==1.0.11 --index-url <index with prebuilt pypy wheels>
error: Failed to download and build: alembic==1.0.11
  Caused by: Failed to build: alembic==1.0.11
  Caused by: Build backend failed to determine metadata through `prepare_metadata_for_build_wheel`:
--- stdout:

--- stderr:
Traceback (most recent call last):
  File "<string>", line 4, in <module>
ModuleNotFoundError: No module named 'setuptools'
---

bendoerry avatar Feb 16 '24 13:02 bendoerry

I think this is a general issue with build requirements in PyPy. See also https://github.com/tox-dev/tox-uv/issues/15.

edgarrmondragon avatar Feb 20 '24 22:02 edgarrmondragon

With https://github.com/astral-sh/uv/pull/2094 merged, I was able to run your original set of steps successfully. Could you try again when the next release is out? (Or build from main if you want to try earlier.) If it still doesn't work, it might help to share a bit more about your environment. Linux? macOS? And show the output of RUST_LOG=trace uv pip install -v ....

BurntSushi avatar Feb 29 '24 21:02 BurntSushi

This actually might be fixed... Let's see.

charliermarsh avatar Feb 29 '24 21:02 charliermarsh

So this does seem to work for us now, we're able to install all our dependencies on PyPy and so far our tests seem to pass (haven't had time to run the full test suite though).

bendoerry avatar Mar 01 '24 17:03 bendoerry

Okay cool -- closing for now but if you run into other PyPy issues, please file.

charliermarsh avatar Mar 01 '24 17:03 charliermarsh