Skip to content

Postinstall for python@3.7 fails (tested on multiple machines) #107295

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

Closed
2 tasks done
sseneca opened this issue Aug 4, 2022 · 3 comments
Closed
2 tasks done

Postinstall for python@3.7 fails (tested on multiple machines) #107295

sseneca opened this issue Aug 4, 2022 · 3 comments
Labels
bug Reproducible Homebrew/homebrew-core bug outdated PR was locked due to age

Comments

@sseneca
Copy link

sseneca commented Aug 4, 2022

brew config output

HOMEBREW_VERSION: 3.5.7
ORIGIN: https://github.com/Homebrew/brew
HEAD: ce8ef89ec0cfe875c48c3a83a843af9074c05930
Last commit: 3 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: b9dc7e988ae2f94de6c200dddf37bd99e8994a40
Core tap last commit: 18 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.Yc6ELhTu1O/org.xquartz:0
HOMEBREW_EDITOR: nvim
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_NO_ENV_HINTS: set
Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit icelake
Clang: 13.1.6 build 1316
Git: 2.37.1 => /usr/local/bin/git
Curl: 7.79.1 => /usr/bin/curl
macOS: 12.5-x86_64
CLT: 13.4.0.0.1.1651278267
Xcode: 13.4.1

brew doctor output

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Putting non-prefixed coreutils in your path can cause GMP builds to fail.

Verification

  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.

What were you trying to do (and why)?

Install Python 3.7. Because I want to use Python 3.7

What happened (include all command output)?

==> Postinstalling python@3.7
==> /usr/local/Cellar/python@3.7/3.7.13_1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python@3.7/3.7.13_1/bin --install-lib=/usr/local/lib/python3.7/site-packages --single-version-externally-managed -
==> /usr/local/Cellar/python@3.7/3.7.13_1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python@3.7/3.7.13_1/bin --install-lib=/usr/local/lib/python3.7/site-packages --single-version-externally-managed -
==> /usr/local/Cellar/python@3.7/3.7.13_1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python@3.7/3.7.13_1/bin --install-lib=/usr/local/lib/python3.7/site-packages --single-version-externally-managed -
==> /usr/local/Cellar/python@3.7/3.7.13_1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python@3.7/3.7.13_1/bin --install-lib=/usr/local/lib/python3.7/site-packages --single-version-externally-managed -
Last 15 lines from /Users/sseneca/Library/Logs/Homebrew/python@3.7/post_install.04.python3:
  File "/usr/local/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 293, in __init__
    self.finalize_options()
  File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 852, in finalize_options
    ep(self)
  File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 869, in _finalize_setup_keywords
    for ep in metadata.entry_points(group='distutils.setup_keywords'):
  File "/usr/local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 999, in entry_points
    return SelectableGroups.load(eps).select(**params)
  File "/usr/local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 449, in load
    ordered = sorted(eps, key=by_group)
  File "/usr/local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 997, in <genexpr>
    dist.entry_points for dist in unique(distributions())
  File "/usr/local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/_itertools.py", line 16, in unique_everseen
    k = key(element)
AttributeError: 'PathDistribution' object has no attribute '_normalized_name'
Warning: The post-install step did not complete successfully
You can try again using:
  brew postinstall python@3.7

What did you expect to happen?

For it to install Python 3.7

Step-by-step reproduction instructions (by running brew commands)

brew install python@3.7
# fails with above error, as does running brew postinstall python@3.7
@sseneca sseneca added the bug Reproducible Homebrew/homebrew-core bug label Aug 4, 2022
@carlocab carlocab transferred this issue from Homebrew/brew Aug 4, 2022
@SMillerDev SMillerDev changed the title Postinsall for python@3.7 fails (tested on multiple machines) Postinstall for python@3.7 fails (tested on multiple machines) Aug 4, 2022
@triallax
Copy link
Contributor

triallax commented Aug 4, 2022

This sounds like python/importlib_metadata#396, which already has a PR open: python/importlib_metadata#397

@cho-m
Copy link
Member

cho-m commented Aug 4, 2022

This should be a side effect of current setuptools_scm that has a bootstrap loop. My previous analysis in #104489 (comment)

One workaround is to restrict setuptools_scm[toml] to <7.

Note that we currently aren't able to update to latest importlib_metadata in python@3.7 since the build system switched from having setup.py to only having setup.cfg/pyproject.toml, so it cannot be installed via old python3 setup.py ....

@cho-m
Copy link
Member

cho-m commented Aug 4, 2022

Alternatively, we might be able to just drop the resources for importlib_metadata and zipp.

They were originally added to support virtualenv package for Homebrew's DSL (#64831) but we switched DSL to use built-in -m venv just afterward in Homebrew/brew#10039.

Seems like easier option. Users can then use pip to install wheels in an upstream-supported manner.


Note that there is still a build loop when using Homebrew DSL for formulae like ansible@2.8, but that is unavoidable due to setuptools_scm upstream no longer allowing our bootstrap-style installation in Python <= 3.7

In core tap, we no longer use python@3.7 so isn't really an issue. Users that directly run pip won't see any issue since it will install wheels.

cho-m added a commit to cho-m/homebrew-core that referenced this issue Aug 4, 2022
These resources were added to support `virtualenv` package used by
Homebrew DSL, but `virtualenv` has been replaced by built-in venv.
Also update `setuptools` and `pip` to include with new revision.

Fixes Homebrew#107295
@github-actions github-actions bot added the outdated PR was locked due to age label Sep 4, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/homebrew-core bug outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants