2

I've been having a consistent problem upgrading python3 with homebrew.

When I run "brew upgrade python3", I get

==> Upgrading 1 outdated package, with result: python3 3.6.5 ==> Processing python3 formula rename to python ==> Unlinking python3 ==> Temporarily unlinking python Error: Error occurred while migrating. No such file or directory @ realpath_rec - /usr/local/opt/python Backing up... Error: No such file or directory @ realpath_rec - /usr/local/opt/python ==> Upgrading python3 Error: No such file or directory @ realpath_rec - /usr/local/opt/python 

Despite failing the upgrade, it has the side-effect of destroying my python3 symlink, so I have to run "brew link python3" afterwards to use it again. This error also screws up brew installs of other packages that depend on python, so it's getting to be pretty bad. Can someone help me fix it?

Edit: I tried "brew uninstall python" and "brew install python" but I get:

~$ brew uninstall python Warning: Use veclibfort instead of deprecated homebrew/science/veclibfort Uninstalling /usr/local/Cellar/python/2.7.14... (3,614 files, 50.6MB) Error: No such file or directory @ realpath_rec - /usr/local/opt/python ~$ brew install python ==> Processing python3 formula rename to python ==> Unlinking python3 ==> Temporarily unlinking python Error: Error occurred while migrating. No such file or directory @ realpath_rec - /usr/local/opt/python Backing up... Error: No such file or directory @ realpath_rec - /usr/local/opt/python Error: python 2.7.14 is already installed To upgrade to 3.6.5, run `brew upgrade python` 
9
  • 1
    Recently homebrew changed how they package python. Now brew install python installs python3.6 as python3 and brew install python@2 will install python2.7 as python. You shouldn't have any custom symlinks. Try brew uninstall python then brew install python. Commented Apr 3, 2018 at 4:22
  • Personally, I would suggest using pyenv instead of messing with Homebrew Python Commented Apr 3, 2018 at 4:24
  • There are some good reasons to use Homebrew Python—e.g., you're using some other Homebrew package that depends on its Python. But if they don't apply, it's usually easier (as of 2018) to use the python.org installer or Anaconda. (Especially now that you can do things like pip install pyqt5 with python.org Python against Homebrew Qt5, many of which didn't work a couple years ago.) Commented Apr 3, 2018 at 4:30
  • I tried "brew uninstall python" then "brew install python". I still get similar errors and it won't update to 3.6.5. I've edited the original post to show the error message. I don't know why /usr/local/opt/python keeps showing up. Is there any way to fix that? Commented Apr 3, 2018 at 4:37
  • 3
    Try brew uninstall python3 as well? Commented Apr 3, 2018 at 10:00

1 Answer 1

1

I face the issue: Error: Not a directory @ dir_s_rmdir - /usr/local/Cellar/python3.

  1. try to uninstall python3
    $ brew uninstall python3

  2. try to install python
    $ brew install python

  3. try to link the python3

$ brew link [email protected] Linking /usr/local/Cellar/[email protected]/3.8.5... Error: Could not symlink bin/2to3 Target /usr/local/bin/2to3 already exists. You may want to remove it: rm '/usr/local/bin/2to3' To force the link and overwrite all conflicting files: brew link --overwrite [email protected] To list all files that would be deleted: brew link --overwrite --dry-run [email protected] 
  1. follow up the tips, remove 2to3
    $ rm '/usr/local/bin/2to3'

  2. link [email protected]
    $ brew link --overwrite [email protected]

fix the error

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.