Reputation: 1684
I have installed anaconda 4 and created environment with all packages packages that Continuum includes in its default Anaconda installer.
conda create -n env_full python=3 anaconda=4
(env_full)neeraj@nicetomeetyou:~$ which anaconda
/home/neeraj/.conda/envs/env_full/bin/anaconda
I have installed a package "mesa". To check if it works properly, I wrote the following test file "1.py".
import mesa
print('mesa is installed')
When I run the file using python in the environment of the anaconda, it shows the ImportError. However, when I check if mesa is installed, it shows that version 10.5.4 is installed as follows:
(env_full)neeraj@nicetomeetyou:~$ conda list -f mesa --show
# packages in environment at /home/neeraj/.conda/envs/env_full:
#
mesa 10.5.4 0 defaults
(env_full)neeraj@nicetomeetyou:~$ python3 1.py
Traceback (most recent call last):
File "1.py", line 1, in <module>
import mesa
ImportError: No module named 'mesa'
Run using python
(env_full)neeraj@nicetomeetyou:~$ python 1.py
Traceback (most recent call last):
File "1.py", line 1, in <module>
import mesa
ImportError: No module named 'mesa'
How do I resolve the problem ?
Following action worked. I created another environment for mesa as 'env_mesa'
(env_full)neeraj@nicetomeetyou:~$ source activate env_mesa
and then run using python.
(env_full)neeraj@nicetomeetyou:~$ source activate env_mesa
discarding /home/neeraj/.conda/envs/env_full/bin from PATH
prepending /home/neeraj/.conda/envs/env_mesa/bin to PATH
(env_mesa)neeraj@nicetomeetyou:~$ python 1.py
mesa is installed
What is the thing that is different in two cases ? even outputs for conda list are same for both the cases
(env_mesa)neeraj@nicetomeetyou:~$ conda list -f mesa --show
# packages in environment at /home/neeraj/.conda/envs/env_mesa:
#
mesa 10.5.4 0 defaults
(env_full)neeraj@nicetomeetyou:~$ conda list -f mesa --show
# packages in environment at /home/neeraj/.conda/envs/env_full:
#
mesa 10.5.4 0 defaults
Upvotes: 1
Views: 1387
Reputation: 11
I had the same problem, and I fixed it using pip instead:
pip install mesa
Upvotes: 1