import nest
gives the 'no module named nest' error when it is in the $PATH
, which means that there is a /opt/nest/lib/python2.7/site-packages:
in my system $PATH
. At this location there is a directory named nest
and the structure inside the nest
directory is looks like:
, where there is an __init__.py
obviously. So why can't python find nest
?
more information:
I am sure that I installed nest with python2.7, and run it with the same python2.7.
According to the docs, there are several ways to install python packages:
- using
distutils
- running python setup.py install
installs the package to site-packages
of your current distribution;
- passing
--user
to setup.py install
installs module to ~/.local/lib/python2.7/site-packages
on Unix, and this directory in under normal conditions always included in sys.path
;
- passing
--home=$HOME
to setup.py install
installs module under $HOME
directory. This directory should be included to sys.path
explicitly;
- modifying python search path:
you can do either
import sys
sys.path.append('/opt/nest/lib/python2.7/site-packages')
in the beginning of your script; or your can add
PYTHONPATH=/opt/nest/lib/python2.7/site-packages
export PYTHONPATH
in the end of your ~/.bash_profile
file.
UPDATE:
Just tried to install nest
and found that it comes in two flavours - 32bit (under /opt/nest/lib
) and 64bit (under /opt/nest/lib64
). You might have tried to use 32-bit python package with 64-bit python distribution. Try to change the string in ./zshrc
to
PYTHONPATH=/opt/nest/lib64/python2.7/site-packages
and see if it works. It works for me at least.