I have installed anaconda. Now when i am trying to run
import pandas as pd
I am getting the following error
Traceback (most re
The cool thing about anaconda is, that you can manage virtual environments for several projects. Those also have the benefit of keeping several python installations apart. This could be a problem when several installations of a module or package are interfering with each other.
Try the following:
user@machine:~$ conda create -n pandas_env python=2.7
user@machine:~$ source activate pandas_env
on Linux/OSX or $ activate pandas_env
on Windows. On Linux the active environment is shown in parenthesis in front of the user name in the shell. (I am not sure how windows handles this, but you can see it by typing $ conda info -e
. The one with the * next to it is the active one)(pandas_env)user@machine:~$ conda list
to show a list of all installed modules.(pandas_env)user@machine:~$ conda install pandas
, as @Fiabetto suggested.(pandas_env)user@machine:~$ python
and try to load pandas again. Note that now you are working in a python environment, that only knows the modules installed inside the pandas_env
environment. Every time you want to use it you have to activate the environment. This might feel a little bit clunky at first, but really shines once you have to manage different versions of python (like 2.7 or 3.4) or you need a specific version of a module (like numpy 1.7).
If this still does not work you have several options:
Check if the right pandas module is found:
`(pandas_env)user@machine:~$ python`
Python 2.7.10 |Continuum Analytics, Inc.| (default, Sep 15 2015, 14:50:01)
>>> import imp
>>> imp.find_module("pandas")
(None, '/path/to/miniconda3/envs/foo/lib/python2.7/site-packages/pandas', ('', '', 5))
# See what this returns on your system.
Reinstall pandas in your environment with $ conda install -f pandas
. This might help if you files have been corrupted somehow.
pip
). To do this, create a new environment like above (make sure to pick a different name to avoid clashes here) but replace point 4 by (pandas_env)user@machine:~$ pip install pandas
.