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

Specify Python minor version in homebrew formula #3344

Merged
merged 2 commits into from
Aug 23, 2022
Merged

Conversation

jstvz
Copy link
Contributor

@jstvz jstvz commented Aug 23, 2022

Users were intermittently reporting that upgrades failed with some
variation of the following error:

File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/build_meta.py", line 142, in run_setup
     exec(compile(code, __file__, 'exec'), locals())
   File "setup.py", line 14, in <module>
     from setuptools_rust import RustExtension
   File "/private/tmp/pip-build-env-gh8ot2a3/overlay/lib/python3.8/site-packages/setuptools_rust/__init__.py", line 1, in <module>
     from .build import build_rust
   File "/private/tmp/pip-build-env-gh8ot2a3/overlay/lib/python3.8/site-packages/setuptools_rust/build.py", line 23, in <module>
     from setuptools.command.build import build as CommandBuild  # type: ignore[import]
 ModuleNotFoundError: No module named 'setuptools.command.build'

This changeset includes two substantive changes to how the formula is
generated:

  1. The major.minor version (python3.9of the python executable is used instead of python3). This prevents the installation from inadvertently using the system Python. This occurs because Homebrew only symlinks a python3 executable for the latest version. See Enable linking multiple Python formulae Homebrew/homebrew-core#107517.
  2. Adds --allow-unsafe to the pip-compile step. This is a noop because we aren't pinning setuptools.

Users were intermittently reporting that upgrades failed with some
variation of the following error:

```python-traceback
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/build_meta.py", line 142, in run_setup
     exec(compile(code, __file__, 'exec'), locals())
   File "setup.py", line 14, in <module>
     from setuptools_rust import RustExtension
   File "/private/tmp/pip-build-env-gh8ot2a3/overlay/lib/python3.8/site-packages/setuptools_rust/__init__.py", line 1, in <module>
     from .build import build_rust
   File "/private/tmp/pip-build-env-gh8ot2a3/overlay/lib/python3.8/site-packages/setuptools_rust/build.py", line 23, in <module>
     from setuptools.command.build import build as CommandBuild  # type: ignore[import]
 ModuleNotFoundError: No module named 'setuptools.command.build'
```
This changeset includes three substantive changes to how the formula is
generated:

1. Rust has been added as a build-time dependency. This is the root
cause of the installation failure.
2. The major.minor version (`python3.9`of the python executable is used instead of
`python3`). This prevents the installation from inadvertently using the
system Python. This occurs because Homebrew only symlinks a `python3`
executable for the latest version. See Homebrew/homebrew-core/107517.
3. Adds `--allow-unsafe` to the `pip-compile` step. This is a noop
because we aren't pinning setuptools.
@jstvz jstvz requested a review from a team as a code owner August 23, 2022 16:02
@jstvz jstvz added the bug label Aug 23, 2022
@jstvz jstvz requested a review from prescod August 23, 2022 16:03
Copy link
Contributor

@prescod prescod left a comment

Choose a reason for hiding this comment

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

Let's try it without Rust. I think based on our conversation that we don't need it.

utility/build-homebrew.sh Outdated Show resolved Hide resolved
Co-authored-by: Paul Prescod <pprescod@salesforce.com>
@jstvz jstvz changed the title Add Rust as build dependency in homebrew formula Specify Python minor version in homebrew formula Aug 23, 2022
@jstvz jstvz enabled auto-merge (squash) August 23, 2022 18:38
@jstvz jstvz disabled auto-merge August 23, 2022 18:39
@jstvz jstvz enabled auto-merge (squash) August 23, 2022 18:39
@jstvz jstvz merged commit 50d549c into main Aug 23, 2022
@jstvz jstvz deleted the homebrew-tweaks branch August 23, 2022 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants