Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uv fails to build qcore==1.10.0 on Python 3.12, but pip is happy to #2145

Closed
hauntsaninja opened this issue Mar 4, 2024 · 14 comments
Closed
Labels
bug Something isn't working macos Specific to the macOS platform

Comments

@hauntsaninja
Copy link
Contributor

hauntsaninja commented Mar 4, 2024

(v312-ydmj) ~/tmp/v312 λ uv pip install 'qcore==1.10.0'
Resolved 1 package in 10ms
error: Failed to download distributions
  Caused by: Failed to fetch wheel: qcore==1.10.0
  Caused by: Failed to build: qcore==1.10.0
  Caused by: Build backend failed to build wheel through `build_wheel()`:
--- stdout:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-14.3-arm64-cpython-312
creating build/lib.macosx-14.3-arm64-cpython-312/qcore
copying qcore/disallow_inheritance.py -> build/lib.macosx-14.3-arm64-cpython-312/qcore
[ ... elided ... ]
copying qcore/inspection.pxd -> build/lib.macosx-14.3-arm64-cpython-312/qcore
running build_ext
building 'qcore.helpers' extension
--- stderr:
error: unknown file type '.py' (from 'qcore/helpers.py')
---

(v312-ydmj) ~/tmp/v312 λ pip install 'qcore==1.10.0'
Collecting qcore==1.10.0
  Downloading qcore-1.10.0.tar.gz (53 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.4/53.4 kB 2.2 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: qcore
  Building wheel for qcore (pyproject.toml) ... done
  Created wheel for qcore: filename=qcore-1.10.0-cp312-cp312-macosx_14_0_arm64.whl size=473177 sha256=91aa57658beb48575a877eed396f8451af7630e82a2c2912b9213272fd37e595
  Stored in directory: /Users/shantanu/Library/Caches/pip/wheels/bd/b3/b7/5f2d05e6f3e4411856f9464c742da56c2b5b34ba9fd17e6e2f
Successfully built qcore
Installing collected packages: qcore
Successfully installed qcore-1.10.0
@hauntsaninja
Copy link
Contributor Author

hauntsaninja commented Mar 4, 2024

Hm, maybe this is because qcore relies on setup_requires? Not actually sure how setuptools implements that https://github.com/quora/qcore/blob/master/setup.py#L78

Either way, it would be nice if the error message error: unknown file type '.py' (from 'qcore/helpers.py') was more actionable. Any chance there's a Python traceback that uv is swallowing?

@hauntsaninja
Copy link
Contributor Author

hauntsaninja commented Mar 4, 2024

Hm, maybe setup_requires is not related, I can repro on quora/qcore#102 as well with uv pip install "qcore @ ."

@hauntsaninja
Copy link
Contributor Author

hauntsaninja commented Mar 4, 2024

Okay, I think it might be something like uv install setuptools in the build environment, but does not pick up its pth path in the env?

I validated this hypothesis by doing:

diff --git a/setup.py b/setup.py
index a085fbf..47f0020 100644
--- a/setup.py
+++ b/setup.py
@@ -12,6 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import _distutils_hack
+_distutils_hack.add_shim()
 from setuptools import setup
 from setuptools.extension import Extension

And this appeared to allow uv to build the package

@hauntsaninja
Copy link
Contributor Author

That shim code comes from:

λ cat distutils-precedence.pth
import os; var = 'SETUPTOOLS_USE_DISTUTILS'; enabled = os.environ.get(var, 'local') == 'local'; enabled and __import__('_distutils_hack').add_shim(); 
λ cat setuptools-68.2.2.dist-info/RECORD | grep pth
distutils-precedence.pth,sha256=JjjOniUA5XKl4N5_rtZmHrVp0baW_LoHsN0iPaX10iQ,151

@konstin konstin added the macos Specific to the macOS platform label Mar 4, 2024
@konstin
Copy link
Member

konstin commented Mar 4, 2024

This seems to be mac os specific, i can't repro on linux. I've also checked that the pth file is present in the build env on linux:

$ ls
Cython  Cython-3.0.8.dist-info  Cython.libs  cython.py  _distutils_hack  distutils-precedence.pth  pkg_resources  __pycache__  pyximport  setuptools  setuptools-69.1.1.dist-info  _virtualenv.pth  _virtualenv.py  wheel  wheel-0.42.0.dist-info

@tdejager
Copy link
Contributor

tdejager commented Mar 4, 2024

Just tried this with the latest uv on a apple m1, and for me the installation is succesful.

@charliermarsh charliermarsh added the bug Something isn't working label Mar 4, 2024
@JelleZijlstra
Copy link
Contributor

Note I just released a version of qcore (1.10.1) with 3.12 wheels; it's possible this bug only manifests if the package has to be built from the sdist. (1.10.0 lacked 3.12 wheels.)

@charliermarsh
Copy link
Member

Trying to reproduce but cargo run pip install 'qcore @ https://files.pythonhosted.org/packages/54/56/a74f41ae8712407f959f05d7a8c15e1d11d515b2824bd43499e063cdb465/qcore-1.10.0.tar.gz' still passes for me.

@hauntsaninja
Copy link
Contributor Author

hauntsaninja commented Mar 5, 2024

uv pip install --no-cache 'qcore @ https://files.pythonhosted.org/packages/54/56/a74f41ae8712407f959f05d7a8c15e1d11d515b2824bd43499e063cdb465/qcore-1.10.0.tar.gz' consistently fails for me with uv version uv 0.1.14 (c525fdf2b 2024-03-04) when installing to an arm64 Python 3.12.2 virtual environment on macOS 14.3.1.

Like konstin, I could not reproduce directly on Linux.

However, the thing that motivated me to open this issue is a failure on Linux in Github Actions. Note the error is different, though: https://github.com/python/typing_extensions/actions/runs/8153774375/job/22285830806?pr=348

@konstin
Copy link
Member

konstin commented Mar 5, 2024

I tried uv pip install qcore==1.10.0 on a ubuntu docker container with python3.12 python3.12-dev from deadsnakes and build-essential, but this also passed

@charliermarsh
Copy link
Member

I'm gonna close for now due to some difficulty with the repro, but can always reopen if it pops back up.

@hauntsaninja
Copy link
Contributor Author

I can still repro with uvx 'uv@0.1.14' pip install --no-cache 'qcore @ https://files.pythonhosted.org/packages/54/56/a74f41ae8712407f959f05d7a8c15e1d11d515b2824bd43499e063cdb465/qcore-1.10.0.tar.gz' but not with 0.4.10, so I think we can call this fixed!

@charliermarsh
Copy link
Member

0.1.14...

theres-a-name-ive-not-heard-in-many-years

@hauntsaninja
Copy link
Contributor Author

I think got fixed by #2381 , so thank you konstin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working macos Specific to the macOS platform
Projects
None yet
Development

No branches or pull requests

5 participants