Third party packages found in iPython but not Python

0 views
Skip to first unread message

Graham Warner

unread,
Mar 26, 2015, 2:58:12 PM3/26/15
to anac...@continuum.io
I have several additional packages that I'm trying to install from source code into Anaconda; one such package is neo. I downloaded the source, put it in /usr/local/anaconda/lib/python2.7/site-packages/ an ran

python setup.py install

when I look in site-packages it seem like it was installed properly and when I run

$ipython
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
Type "copyright", "credits" or "license" for more information.

IPython 0.13.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python'
s own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import neo
In [2]:

I get no errors. However, when I run

$python
Python 2.7.8 |Anaconda 2.1.0 (64-bit)| (default, Aug 21 2014, 18:22:21)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> import neo
Traceback (most recent call last):
 
File "<stdin>", line 1, in <module>
ImportError: No module named neo

It can't find the package, even though it shows that it is running Anaconda. My

$ which ipython
/usr/bin/ipython
$ which python
alias python='/usr/local/anaconda/bin/python'
   
/usr/local/anaconda/bin/python


My bashrc file reads

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
       
. /etc/bashrc
fi

export PATH=/usr/local/anaconda/bin:$PATH
export PATH=/usr/local/anaconda/lib/python2.7:$PATH
export PATH=/usr/lib/python2.6/site-packages:$PATH
export PATH=/usr/pubsw/packages/python/epd/bin:$PATH
export PATH=/usr/bin/:$PATH
export PATH=/PHShome/gcw8/Packages/PlexonNeuroshareDLL:$PATH
# User specific aliases and functions
alias python=/usr/local/anaconda/bin/python


Can anyone see what the problem is?

Aaron Meurer

unread,
Mar 26, 2015, 3:14:04 PM3/26/15
to anaconda
Your IPython is running a different Python. Instead of aliasing
python, you should put `/usr/local/anaconda` higher up in your PATH
(move the line lower in your bashrc file) and delete the alias. You
should also remove "export
PATH=/usr/local/anaconda/lib/python2.7:$PATH" (directories in the lib
directory should not be in the PATH), "export
PATH=/usr/lib/python2.6/site-packages:$PATH" (ditto for
site-packages). If you are not using "export
PATH=/usr/pubsw/packages/python/epd/bin:$PATH" you should remove that
as well, as otherwise you will still have the chance for things to
"leak" through the path from it, giving you not what you expect.

Aaron Meurer
> --
> Anaconda Community Support Group Brought to you by Continuum Analytics
> ---
> You received this message because you are subscribed to the Google Groups
> "Anaconda - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to anaconda+u...@continuum.io.
> To post to this group, send email to anac...@continuum.io.
> Visit this group at http://groups.google.com/a/continuum.io/group/anaconda/.

Graham Warner

unread,
Mar 26, 2015, 4:40:28 PM3/26/15
to anac...@continuum.io
Thanks, that fixed my issue. I just noticed another problem. Some of the standard packages in Anaconda (in this case PIL) aren't loading when I launch python from anywhere outside of /usr/local/anaconda/lib/python2.7/site-packages/. They are successfully imported from within the /site-packages/ directory. Strangely, others work.

[gcw8@database_dev ~]$ pwd
/PHShome/gcw8
[gcw8@database_dev ~]$ python
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xlrd
>>> import PIL
Traceback (most recent call last):
 
File "<stdin>", line 1, in <module>
ImportError: No module named PIL

Now from /site-packages/

[gcw8@database_dev site-packages]$ pwd
/usr/local/anaconda/lib/python2.7/site-packages
[gcw8@database_dev site-packages]$ python
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xlrd
>>> import PIL
>>>

Any thoughts?

Aaron Meurer

unread,
Mar 26, 2015, 5:38:06 PM3/26/15
to anaconda
Your "python" that you are starting is still not the Anaconda Python
(if it were, it would say "Continuum Analytics" at the top when you
started it). Make sure Anaconda is the first thing in your PATH. You
are probably loading a Python from epd. It only works when you are in
that directory because the epd Python automatically picks up packages
from the current directory.

Aaron Meurer

Graham Warner

unread,
Mar 27, 2015, 9:03:26 AM3/27/15
to anac...@continuum.io
It's working now, thank you!
Reply all
Reply to author
Forward
0 new messages