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

Communicate PEP 517 hook results via files #2314

Merged
merged 1 commit into from
Mar 9, 2024
Merged

Conversation

charliermarsh
Copy link
Member

Summary

In #1813, we were failing to install scikit-image==0.19.3 from source in Python 3.11. Confusingly, though, the trace showed that the build command exited with status 0...

The issue is that we get results from the PEP 517 hooks by reading from stdout -- that is, we print at the end of the script, and parse the printed output on the other side.

It turns out that for scikit-image, in this case, there was output after the wheel filename:

...
no previously-included directories found matching 'doc/gh-pages'
adding license file 'LICENSE.txt'
writing manifest file 'scikit_image.egg-info/SOURCES.txt'
Copying scikit_image.egg-info to build/bdist.macosx-12.6-arm64/wheel/scikit_image-0.19.3-py3.11.egg-info
running install_scripts
scikit_image-0.19.3-cp311-cp311-macosx_14_0_arm64.whl
INFO:
########### EXT COMPILER OPTIMIZATION ###########
INFO: Platform      :
  Architecture: aarch64
  Compiler    : clang

CPU baseline  :
  Requested   : 'min'
  Enabled     : NEON NEON_FP16 NEON_VFPV4 ASIMD
  Flags       : none
  Extra checks: none

CPU dispatch  :
  Requested   : 'max -xop -fma4'
  Enabled     : ASIMDHP ASIMDDP ASIMDFHM
  Generated   : none
INFO: CCompilerOpt.cache_flush[864] : write cache to path -> /private/var/folders/nt/6gf2v7_s3k13zq_t3944rwz40000gn/T/.tmp5ZPIbv/built-wheels-v0/pypi/scikit-image/0.19.3/hLW_f7wWeGDOPRlSazQXw/scikit-image-0.19.3.tar.gz/build/temp.macosx-12.6-arm64-3.11/ccompiler_opt_cache_ext.py

We need the scikit_image-0.19.3-cp311-cp311-macosx_14_0_arm64.whl line, but we were failing to find it due to all the extra output at the end (presumedly, some kind of atexit logging).

This PR modifies the hooks to instead write their results to files that are passed in by the parent. On the other end, we then read the results back from disk. This makes it much more robust to "other" output in the script.

Closes #1813.

Test Plan

Ran cargo run pip install scikit-image==0.19.3 --reinstall --no-cache-dir on Python 3.11.

let outfile = self
.temp_dir
.path()
.join(format!("build_{}.txt", self.build_kind));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These don't need deterministic names (we pass them into the script anyway) but I figured it would help debugging.

Copy link
Member

@zanieb zanieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

@charliermarsh charliermarsh merged commit f7f6453 into main Mar 9, 2024
7 checks passed
@charliermarsh charliermarsh deleted the charlie/scikit-image branch March 9, 2024 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to install scikit-image==0.19.3
2 participants