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

Improve handling of stale homebrew/core clones #15775

Closed
4 tasks done
shengslogar opened this issue Jul 27, 2023 · 9 comments · Fixed by #15781
Closed
4 tasks done

Improve handling of stale homebrew/core clones #15775

shengslogar opened this issue Jul 27, 2023 · 9 comments · Fixed by #15781
Assignees
Labels
bug Reproducible Homebrew/brew bug in progress Maintainers are working on this install from api Relates to API installs outdated PR was locked due to age

Comments

@shengslogar
Copy link

shengslogar commented Jul 27, 2023

brew gist-logs <formula> link OR brew config AND brew doctor output

$ brew config
HOMEBREW_VERSION: 4.1.2-15-gf56f27b
ORIGIN: https://github.com/Homebrew/brew
HEAD: f56f27b0d65968edbb9d22b56db13021ca6ac56d
Last commit: 38 minutes ago
Core tap origin: https://github.com/Homebrew/homebrew-core
Core tap HEAD: dd0746f4307228e1cd5d35c74ece2b6c9efbd911
Core tap last commit: 3 weeks ago
Core tap branch: master
Core tap JSON: 27 Jul 15:50 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 14.0.3 build 1403
Git: 2.39.2 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.88.1 => /usr/bin/curl
macOS: 13.4.1-arm64
CLT: 14.3.1.0.1.1683849156
Xcode: 14.3.1
Rosetta 2: false

$ brew doctor
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: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  [email protected]
  [email protected]
  [email protected]

Verification

  • My "brew doctor output" says Your system is ready to brew. and am still able to reproduce my issue.
  • 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.
  • I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.

What were you trying to do (and why)?

Note: as seen above, my brew doctor does output some warnings, but these are all PHP-related which is not dependent on Python.

Install [email protected] as a dependency of brew install aws-sam-cli.

Interestingly, the installer is looking for setuptools-67.6.1-py3-none-any.whl:

FileNotFoundError: [Errno 2] No such file or directory: '/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ensurepip/_bundled/setuptools-67.6.1-py3-none-any.whl'

Navigating to the directory, I see a similarly-named file:

$ ls /opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ensurepip/_bundled
pip-23.2.1-py3-none-any.whl		setuptools-68.0.0-py3-none-any.whl

Renaming this file to match the file it's looking for then yields a missing pip-23.0.1-py3-none-any.whl:

FileNotFoundError: [Errno 2] No such file or directory: '/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ensurepip/_bundled/pip-23.0.1-py3-none-any.whl'

Renaming pip-23.2.1-py3-none-any.whl to this filename then yields a missing wheel-0.40.0-py3-none-any.whl:

FileNotFoundError: [Errno 2] No such file or directory: '/opt/homebrew/Cellar/[email protected]/3.11.4_1/libexec/wheel-0.40.0-py3-none-any.whl'

I don't use Python outside of this so I'm not really sure what these errors are even about, but it seems like some sort of incorrectly-versioned dependency is being installed. I do have [email protected] installed successfully.

What happened (include all command output)?

$ brew install [email protected]
Running brew update --auto-update...
==> Auto-updated Homebrew!
==> Updated Homebrew from 4c612ab to f56f27b.
No changes to formulae or casks.

==> Fetching [email protected]
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.11/manifests/3.11.4_1-1
##################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.11/blobs/sha256:0b34eff80378cb1157e1fefee56a89160e7a805226c32a2f24b09d5d17c1710e
##################################################################################################################################### 100.0%
==> Pouring [email protected]_1.arm64_ventura.bottle.1.tar.gz
==> /opt/homebrew/Cellar/[email protected]/3.11.4_1/bin/python3.11 -Im ensurepip
==> /opt/homebrew/Cellar/[email protected]/3.11.4_1/bin/python3.11 -Im pip install -v --no-deps --no-index --upgrade --isolated --target=/opt/home
Last 15 lines from /Users/sheng/Library/Logs/Homebrew/[email protected]/post_install.02.python3.11:
dist = self._prepare_distribution()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 304, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 538, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 643, in _prepare_linked_requirement
hash = hash_file(local_file.path)[0].hexdigest()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pip/_internal/utils/misc.py", line 616, in hash_file
with open(path, "rb") as f:
^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ensurepip/_bundled/setuptools-67.6.1-py3-none-any.whl'
Warning: The post-install step did not complete successfully
You can try again using:
brew postinstall [email protected]
==> Caveats
Python has been installed as
/opt/homebrew/bin/python3

Unversioned symlinks python, python-config, pip etc. pointing to
python3, python3-config, pip3 etc., respectively, have been installed into
/opt/homebrew/opt/[email protected]/libexec/bin

You can install Python packages with
pip3 install
They will install into the site-package directory
/opt/homebrew/lib/python3.11/site-packages

tkinter is no longer included with this formula, but it is available separately:
brew install [email protected]

gdbm (dbm.gnu) is no longer included in this formula, but it is available separately:
brew install [email protected]
dbm.ndbm changed database backends in Homebrew Python 3.11.
If you need to read a database from a previous Homebrew Python created via dbm.ndbm,
you'll need to read your database using the older version of Homebrew Python and convert to another format.
dbm still defaults to dbm.gnu when it is installed.

For more information about Homebrew and Python, see: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /opt/homebrew/Cellar/[email protected]/3.11.4_1: 3,281 files, 61.9MB
==> Running brew cleanup [email protected]...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see man brew).

$ brew postinstall [email protected]

==> Postinstalling [email protected]
==> /opt/homebrew/Cellar/[email protected]/3.11.4_1/bin/python3.11 -Im ensurepip
==> /opt/homebrew/Cellar/[email protected]/3.11.4_1/bin/python3.11 -Im pip install -v --no-deps --no-index --upgrade --isolated --target=/opt/homebrew/lib/python3.11/site-packages /opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ensurepip/_bundled/setuptools-67.6.1-py3-none-any.whl /opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/en
Last 15 lines from /Users/sheng/Library/Logs/Homebrew/[email protected]/post_install.02.python3.11:
dist = self._prepare_distribution()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 304, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 538, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 643, in _prepare_linked_requirement
hash = hash_file(local_file.path)[0].hexdigest()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pip/_internal/utils/misc.py", line 616, in hash_file
with open(path, "rb") as f:
^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ensurepip/_bundled/setuptools-67.6.1-py3-none-any.whl'
Warning: The post-install step did not complete successfully
You can try again using:
brew postinstall [email protected]

What did you expect to happen?

Successful install with no errors.

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

brew update
brew upgrade
brew install [email protected]
brew postinstall [email protected]
@shengslogar shengslogar added the bug Reproducible Homebrew/brew bug label Jul 27, 2023
@carlocab
Copy link
Member

The likely explanation is that postinstall is using the outdated [email protected] formula in your outdated clone of Homebrew/core for some reason:

Core tap HEAD: dd0746f4307228e1cd5d35c74ece2b6c9efbd911
Core tap last commit: 3 weeks ago

Try doing

brew untap homebrew/core

and see if that helps.

@shengslogar
Copy link
Author

That did the trick! Thanks for the quick reply.

I see homebrew/core and homebrew/cask both provide warnings when tapping, so I assume it's best practice to untap both.

@carlocab
Copy link
Member

You should be getting this warning from brew doctor:

Warning: You have an unnecessary local Core tap!
This can cause problems installing up-to-date formulae.
Please remove it by running:
 brew untap homebrew/core

Not really sure why that didn't show up for you. What's the output of brew developer?

@shengslogar
Copy link
Author

$ brew developer
Developer mode is enabled.

Sounds like this should be off? I have no memory of enabling this (although I've had Homebrew installed for forever).

@carlocab
Copy link
Member

carlocab commented Jul 27, 2023

Up to you really. You can leave it on if it's not causing you problems.

Reopening this because it seems like there is still a bug or three here:

  • postinstall is using a stale homebrew/core clone
  • your homebrew/core clone is not being updated even if brew developer is on
  • you did not see the warning message about your stale homebrew/core clone

Not 100% certain if any/all/none of the above are bugs, but we should probably do something to try to improve them.

@carlocab carlocab reopened this Jul 27, 2023
@carlocab carlocab transferred this issue from Homebrew/homebrew-core Jul 27, 2023
@carlocab carlocab added the install from api Relates to API installs label Jul 27, 2023
@carlocab carlocab changed the title brew postinstall fails for [email protected] Improve handling of stale homebrew/core clones Jul 27, 2023
@MikeMcQuaid
Copy link
Member

  • you did not see the warning message about your stale homebrew/core clone

@carlocab is this something we've ever done? Agreed the others were bugs.

@MikeMcQuaid MikeMcQuaid self-assigned this Jul 28, 2023
@MikeMcQuaid MikeMcQuaid added the in progress Maintainers are working on this label Jul 28, 2023
@MikeMcQuaid
Copy link
Member

  • your homebrew/core clone is not being updated even if brew developer is on

Should be resolved by #15780. Looking at post_install now.

@MikeMcQuaid
Copy link
Member

  • postinstall is using a stale homebrew/core clone

Should be resolved by #15781

@shengslogar
Copy link
Author

Y'all are awesome 🔥

@github-actions github-actions bot added the outdated PR was locked due to age label Aug 28, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/brew bug in progress Maintainers are working on this install from api Relates to API installs outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants