pipx: Updating Python from 3.9.1_4 to 3.9.1_8 causes No such file or directory
Yesterday, I ran brew upgrade. After that, my shell (xonsh), as installed by pipx, stopped running. It would fail with:
login: /Users/jaraco/.local/bin/xonsh: No such file or directory
So I load up bash and inspect:
$ ls -la ~/.local/pipx/venvs/xonsh/bin/python3.9
lrwxr-xr-x 1 jaraco primarygroup 69 Jan 5 11:39 python3.9 -> /Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/bin/python3.9
It seems python3.9
no longer points to a valid Python, and thus all pipx commands are now broken.
I was able to reinstall-all
, which worked, but also emitted an error:
$ pipx reinstall-all
Failed to upgrade shared libraries
Traceback (most recent call last):
File "/Users/jaraco/.local/homebrew/lib/python3.9/site-packages/pipx/shared_libs.py", line 92, in upgrade
upgrade_process = run_subprocess(
File "/Users/jaraco/.local/homebrew/lib/python3.9/site-packages/pipx/util.py", line 123, in run_subprocess
completed_process = subprocess.run(
File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 501, in run
with Popen(*popenargs, **kwargs) as process:
File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 947, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1819, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/jaraco/.local/pipx/shared/bin/python'
uninstalled oathtool! ✨ 🌟 ✨
...
done! ✨ 🌟 ✨
$ ls -la ~/.local/pipx/venvs/xonsh/bin/python3.9
lrwxr-xr-x 1 jaraco primarygroup 69 Feb 19 09:25 /Users/jaraco/.local/pipx/venvs/xonsh/bin/python3.9 -> /Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_8/bin/python3.9
I have pipx 0.16.0.0.
Is it the case that a reinstall-all
is expected to be needed between patch updates to Python? I haven’t experienced this issue on my other mac where I have Homebrew installed in the canonical location. Is there anything that one can do to avoid this failure when running brew upgrade
?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (19 by maintainers)
Commits related to this issue
- pipx: protect against venv breakage https://github.com/pipxproject/pipx/issues/633#issuecomment-782806161 — committed to branchvincent/dotfiles by branchvincent 3 years ago
I’m still experiencing this issue. I’ve added the following to by shell init config:
And run
pipx reinstall-all
. Hopefully that will bypass the issue going forward.