1

I'm trying to switch from Homebrew Python to Anaconda Python. My $PATH is:
234:~ user$ echo $PATH /Users/user/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
Also, when I check which python, which pip, and which conda I get the anaconda directory for all three. But I still get the following when I try to import some standard package (which is installed in the anaconda directory):

234:~ user$ python Python 2.7.13 |Anaconda custom (x86_64)| (default, Dec 20 2016, 23:05:08) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. Anaconda is brought to you by Continuum Analytics. Please check out: http://continuum.io/thanks and https://anaconda.org '>>> import numpy Traceback (most recent call last): File "<'stdin>", line 1, in File "/usr/local/lib/python2.7/site-packages/numpy/init.py", line 142, in <'module> ...
ImportError: Importing the multiarray numpy extension module failed. Most likely you are trying to import a failed build of numpy. If you're working with a numpy git repo, try git clean -xdf (removes all files not under version control). Otherwise reinstall numpy.

I have tried a reboot and completely uninstalling anaconda and reinstalling, all to no avail. Why is python still using my usr/local/lib directory to hunt for packages? How do I redirect it to the anaconda directory?

Tim
  • 171
  • 2
  • 12
  • Do you have the `$PYTHONPATH` environment variable set anywhere (e.g. in your `.bash_profile`)? – harryscholes Mar 10 '17 at 10:11
  • $PYTHONPATH is not set. – Tim Mar 10 '17 at 11:41
  • What is the output of `python -c import sys; print sys.path`? – darthbith Mar 10 '17 at 12:48
  • ['', '/Users/user/anaconda/lib/python27.zip', '/Users/user/anaconda/lib/python2.7', '/Users/user/anaconda/lib/python2.7/plat-darwin', '/Users/user/anaconda/lib/python2.7/plat-mac', '/Users/user/anaconda/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/user/anaconda/lib/python2.7/lib-tk', '/Users/user/anaconda/lib/python2.7/lib-old', '/Users/user/anaconda/lib/python2.7/lib-dynload', '/Users/user/.local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/site-packages', '/Users/user/anaconda/lib/python2.7/site-packages', ...] – Tim Mar 10 '17 at 13:44
  • This is likely the same issue in question: [https://github.com/conda/conda/issues/448](https://github.com/conda/conda/issues/448). That said, all of the solutions I'm seeing sound dicey. See also: https://stackoverflow.com/q/25584276/5054877 – Braham Snyder Apr 22 '18 at 14:33

0 Answers0