1

I'm trying to install a Python package name MDAnalysis which required numpy. The problem is the default path for python is

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/

but my package (installed with pip) was in:

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

So I added this path to PYTHONPATH but the problem is now in each path, I have a different version of numpy and python always use the version in the first path which cause a mach-o, but wrong architecture. How can I remove the version in the fisrt path? A pip uninstall will remove numpy in the second path and when I went to the first path to directly delete numpy, it says the file/folder doesn't exist. Thanks in advance

timrau
  • 22,578
  • 4
  • 51
  • 64
pomxipum
  • 315
  • 1
  • 3
  • 9
  • 1
    It's generally easier to manage different installs and version of packages with `virtualenv`s. – jonrsharpe Feb 19 '15 at 16:37
  • Are you sure, that the first numpy version causes the mach-o trouble? Normally when you have your PYTHONPATH right, the system should not touch the package. – Juergen Feb 19 '15 at 17:13

1 Answers1

1

The simplest solution, I guess, would be that you change your PYTHONPATH in a way, that your site-packages path is added before the other path.

For example (in your startup-shell or where you set the path):

PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages:$PYTHONPATH

Of course it is also possible to use virtualenv, but that also needs some learning and I am currently not sure, that it will solve your immediate problem, since the system libraries will still be accessible.

You also can remove packages by hand, though. But when above fix helps, I would recommend it.

On Linux, it is possible to remove a package just by going to the right directory from your PYTHONPATH and than just apply:

rm -fr numpy

To my knowledge, that should completely remove the package. It could be, that an .egg file stays on the base folder and it can be removed too, but I think it does no greater harm.

Juergen
  • 12,378
  • 7
  • 39
  • 55
  • Thanks when I import MDAnalysis, it always yeilds match-o error. I don't know what else can cause this problem... – pomxipum Feb 19 '15 at 16:55
  • Hi, you are working with MacOS? I did not hear about mach-o before, but I goodled it and get many hits about Mac. I guess, one of your libraries was compiled for the wrong Mac architecture. – Juergen Feb 19 '15 at 17:09
  • 1
    Maybe you could have a look at this post, it could be helpful (??) I have no experience with Mac, so I guess, my help is limited here: http://stackoverflow.com/a/10683043/122012 – Juergen Feb 19 '15 at 17:10
  • 1
    Thanks alot, may be that's my problem. I'm using MacOS Snow Leopard and I'm newbie to Mac too so I guesse I have to dig in those posts. I hated Mac before and now I hate it more :'( – pomxipum Feb 19 '15 at 17:45