0

Before marking it duplicate, please read it fully.

I am trying to use pydot in my script which depends on pyparsing module. But the module I have is pyparsing 2.0.1 which came with the MAC installation. This needs to be downgraded to 1.5.7 to fix this error - "Couldn't import dot_parser, loading of dot files will not be possible" as per this answer, but when I tried to uninstall my existing pyparsing module, I am getting this error -

pip uninstall pyparsing
DEPRECATION: Uninstalling a distutils installed project (pyparsing) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling pyparsing-2.0.1:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pyparsing-2.0.1-py2.7.egg-info
Proceed (y/n)?

If I give yes, as expected, this is throwing me Operation not permitted error due to the System Integrity Protection in Mac OS X. So I am not able to proceed with this.

I tried to see my module path,

import site; site.getsitepackages()
['/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
 '/Library/Python/2.7/site-packages']

I can see pyparsing 2.0.1 under my site-packages as well, Is there a way to uninstall that alone without modifying the pyparsing under system library?

Community
  • 1
  • 1
ds_user
  • 2,139
  • 4
  • 36
  • 71
  • You talk about uninstalling pyparsing, but it sounds like you want to *upgrade* pyparsing? –  Mar 11 '16 at 02:37
  • I dont want to upgrade, if you see the link I tried to follow, thats the solution provided for the error I receive, it says to uninstall the latest version 2.0.1 and install 1.5.7 to fix this issue. Updated the question to make it clear. – ds_user Mar 11 '16 at 02:39
  • `/Library/Python/` does not cause problems altering (e.g., it's not under Mac's SIP)? –  Mar 11 '16 at 02:47
  • Yeah I know. Thats why I am asking is there a way to uninstall pyparsing under /Library/Python alone? Because when i specify pip uninstall pyparsing, its automatically trying to uninstall pyparsing under system library. If you see the error I am getting. – ds_user Mar 11 '16 at 02:49
  • NB: the second answer in your linked question suggests using pydot2 instead. That avoids downgrading. Why can't you use that? –  Mar 11 '16 at 02:55
  • I tried that as well, it was throwing me some other error, but your solution with user worked like a charm. Now I could convert dot to png using pydot. Thanks. – ds_user Mar 11 '16 at 03:01

1 Answers1

1

Install it as a user package (which goes somewhere in $HOME/Library). This should take precedence over system installed packages, and you don't need to adjust your PYTHONPATH.

pip install pyparsing==1.5.7 --user

As an aside, you remove pyparsing from /Library/Python manually:

rm -r /Library/Python/2.7/site-packages/pyparsing*

But that shouldn't matter with the above solution.