3

I installed Anaconda's graphical installer successfully. I configured it to Python 3.5 by

conda create -n py35 python=3.5
source activate py35 % to deactive source deactivate
conda install notebook ipykernel
ipython kernel install --user

With PYTHONPATH

I want to get Anaconda's libraries in PYTHONPATH. They are not located in $HOME/.anaconda/lib/python3.5/site-packages. Here is a similar thread without an answer about PYTHONPATH problems in OSX. I run by accident pip install conda just to test if you can confuse the system by installing second Anaconda, but you cannot and you get

Requirement already satisfied (use --upgrade to upgrade): conda in /Users/masi/anaconda/lib/python3.5/site-packages

where you apparently see the location of the libraries of Anaconda. My $HOME/.bash_profile

export PYTHONPATH=/Users/masi/anaconda/lib/python3.5/site-packages

# otherwise PYTHONPATH fails in OS X; see history for logs
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

I run my test code

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline

and I get unsuccessfully

/Users/masi/anaconda/lib/python3.5/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')

I do not know where Matplotlib keeps its cache. In Linux, removal with rm -rf ~/.cache/matplotlib would be possible but not in OS X. This can be a bug in Matplotlib that has not been solved in OS X. I sent a message to the thread about the issue in the project's Github here. The cache directory is empty, ls -a $HOME/.matplotlib/ gives empty list where you find the cache directory by import matplotlib; matplotlib.get_cachedir() in ipython.

Without PYTHONPATH

My PATH is

/Users/masi/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin

I install numpy by sudo -H pip install numpy. I run the test code but I get

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-a38059fd5ca4> in <module>()
----> 1 import numpy as np
      2 import pandas as pd
      3 import matplotlib.pyplot as plt
      4 get_ipython().magic('matplotlib inline')

ImportError: No module named 'numpy'

so something wrong with pip in installing the modules. I have both conda via pip and Anaconda. This may not be optimal. Please, propose different setting.

Trying to get rid of conda

I run pip uninstall conda but I still get the error about missing numpy although I installed it with pip. I think have some PATH problem. How can you uninstall all packages installed by conda?


How can you add Anaconda's Python Libraries in PYTHONPATH?

  • 1
    probably bestt to run without any PYTHONPATH the anaconda setup should just work. Run in a virtual path by using conda activate – user151019 May 29 '16 at 11:53
  • 1
    What is your path and do you have both condo via pip and anaconda? – user151019 May 29 '16 at 12:03
  • I get different errors :( I had to install more than you e.g. condo install matplotlib. Time to get a real VM I think – user151019 May 29 '16 at 12:36
  • 1
    I would use condo install rather than pip conda conda.pydata.org/docs/_downloads/… – user151019 May 29 '16 at 12:57
  • 1
    I have a problem with mkl so cannot provide a working solution – user151019 May 29 '16 at 16:02
0

I think one good option is to gave up with Anaconda and use Canopy under an academic license (user2738815). Another option is to use Debian Linux, where I have not experienced any such problems.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .