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?
Best Answer
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.