0

On my Mac OSX machine, I am unable to import mpl_toolkits with python2-7. I thought I would fix this by upgrading matplotib. I tried

sudo pip install --U matplotlib

It was a no-go with a very long error message that I will show at the end of this question.

Then, on a lark, I tried dropping the sudo:

pip install --U matplotlib

It failed with error

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/kiwisolver.so'
Consider using the `--user` option or check the permissions.

What the heck? I think. I'll give sudo one more try. It fails with a new error:

  Found existing installation: six 1.4.1
Cannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Now here's real kicker: I can no longer import matplotlib at all:

>>> import matplotlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py", line 125, in <module>
    raise ImportError("matplotlib requires pyparsing")
ImportError: matplotlib requires pyparsing

So, can anyone tell me at least how to get back to a usable matplotlib? And how to update it and get to mpl_toolkits would be great too.

BTW, that long error I mentioned was:

Installing collected packages: setuptools, kiwisolver, six, cycler, subprocess32, pytz, backports.functools-lru-cache, numpy, pyparsing, python-dateutil, matplotlib
  Found existing installation: setuptools 18.5
    Uninstalling setuptools-18.5:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
    copytree(src, real_dst, symlinks=True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
    raise Error, errors
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/tmp/pip-4yz1zL-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-4yz1zL-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', '/tmp/pip-4yz1zL-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-4yz1zL-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/tmp/pip-4yz1zL-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/tmp/pip-4yz1zL-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', '/tmp/pip-4yz1zL-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-4yz1zL-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/tmp/pip-4yz1zL-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/tmp/pip-4yz1zL-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]
bob.sacamento
  • 6,283
  • 10
  • 56
  • 115
  • The issue is no longer that you don't have `matplotlib` installed. Now, you need to reinstall the dependency `pyparsing`. Try `pip install pyparsing`. – Joel Jul 26 '18 at 17:07
  • @Joel Looks like I've got trouble. The install command tells me "Requirement already satisfied: pyparsing in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (2.0.1)" and when I try to import it, it fails with the same error. – bob.sacamento Jul 26 '18 at 17:10
  • 1
    Try `pip install --upgrade --force-reinstall pyparsing` – Joel Jul 26 '18 at 17:12
  • @Joel Thanks for your help, but it's still not happy: "Installing collected packages: pyparsing Found existing installation: pyparsing 2.0.1 Cannot uninstall 'pyparsing'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall." – bob.sacamento Jul 26 '18 at 17:17
  • https://stackoverflow.com/questions/50421287/pip-cannot-uninstall-ipython-it-is-a-distutils-installed-project-and-thus-w – Joel Jul 26 '18 at 17:18
  • @Joel I really appreciate all your doing, but it never ends. My system gives "command not found" for apt-get. – bob.sacamento Jul 26 '18 at 17:22
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/176820/discussion-between-bob-sacamento-and-joel). – bob.sacamento Jul 26 '18 at 17:32

0 Answers0