problem with pandas

1,121 views
Skip to first unread message

Jeremy Harbinson

unread,
Feb 11, 2014, 7:42:57 AM2/11/14
to spyd...@googlegroups.com
Hi,
I use the EPD (currently I have 1.3.0), which runs Python 2.7, installed on a Mac OSX system (10.8.4). In Spyder I can load pandas in a normal Python session, but when I try to load it in an IPython session I get the following error:

import pandas as pd
numpy.ufunc has the wrong size, try recompiling
Traceback (most recent call last):

  File "<ipython-input-8-af55e7023913>", line 1, in <module>
    import pandas as pd

  File "/Users/jeremyharbinson1/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pandas/__init__.py", line 6, in <module>
    from . import hashtable, tslib, lib

  File "numpy.pxd", line 865, in init pandas.tslib (pandas/tslib.c:48701)

ValueError: numpy.ufunc has the wrong size, try recompiling

Numpy is version 1.7.1, pandas is 0.12.0 (in the normal Python session) and I have Spyder 2.2.5 (an earlier version produced the same error). I guess this is a setup or path problem, but I have no idea how to fix it. Any suggestions?
all the best,
Jeremy Harbinson

Adrian Klaver

unread,
Feb 11, 2014, 10:38:38 AM2/11/14
to spyd...@googlegroups.com
On 02/11/2014 04:42 AM, Jeremy Harbinson wrote:
> Hi,
> I use the EPD (currently I have 1.3.0), which runs Python 2.7, installed
> on a Mac OSX system (10.8.4). In Spyder I can load pandas in a normal
> Python session, but when I try to load it in an IPython session I get
> the following error:


Do you get the same error if you run pandas in an IPython console that
is independent of Spyder?

Also you might want to check Tools -->Preferences-->IPython Console
-->Graphics and see if numpy is being automatically loaded. Could be
different versions in play.




--
Adrian Klaver
adrian...@gmail.com

Jeremy Harbinson

unread,
Feb 11, 2014, 11:03:48 AM2/11/14
to spyd...@googlegroups.com
Hi,
Thanks for your response. 

Numpy was running in the Spyder IPython console (version 1.7.1) (though it was useful to look at those pages of the Preferences notebook). I also started an IPython notebook in Safari (so no Spyder and no Enthought Canopy), pandas loaded and I could run a function that used pandas. The version number of pandas that ran in the notebook was 0.12.0, which is the same as that which ran in the Spyder Python session.  
all the best,
Jeremy

Adrian Klaver

unread,
Feb 11, 2014, 11:51:58 AM2/11/14
to spyd...@googlegroups.com
On 02/11/2014 08:03 AM, Jeremy Harbinson wrote:
> Hi,
> Thanks for your response.
>
> Numpy was running in the Spyder IPython console (version 1.7.1) (though
> it was useful to look at those pages of the Preferences notebook).

You might want to uncheck automatically loading numpy in the Spyder
IPython console and see what happens. Just a hunch, but I suspect there
may be a numpy version clash at work.

I
> also started an IPython notebook in Safari (so no Spyder and no
> Enthought Canopy), pandas loaded and I could run a function that used
> pandas. The version number of pandas that ran in the notebook was
> 0.12.0, which is the same as that which ran in the Spyder Python session.
> all the best,
> Jeremy
>



--
Adrian Klaver
adrian...@gmail.com

Jeremy Harbinson

unread,
Feb 11, 2014, 1:36:14 PM2/11/14
to spyd...@googlegroups.com
Hi,
I tried unchecking the automatically load numpy option. I checked that numpy was not available in the Spyder IPython console. Pandas still would not import, nor would it import once I had manually imported numpy - same error message as before. 

I agree that it looks like some kind of mis-match. I used sys.modules to track the paths, but no joy: in Spyder/Python numpy and pandas load from Spyder (eg /Applications/Spyder.app/Contents/Resources/lib/python2.7/pandas/__init__.pyc), in Spyder/IPython numpy also loads from Spyder, but I cannot tell from where it tries to load pandas - that might be helpful!
all the best,
Jeremy

Uwe Fechner

unread,
Feb 11, 2014, 2:41:57 PM2/11/14
to spyd...@googlegroups.com
Hello,

today I had to fix a simular problem on the Mac of a student (I don't own a Mac).

We followed this instruction:
http://www.lowindata.com/2013/installing-scientific-python-on-mac-os-x/

And it worked out very well.

After installing ipython etc. as described in this link it also worked in spyder, that was installed
as dmg. In spyder we changed the default python interpreter to the default interpreter of the
operating system, otherwise it would not see modules we installed with "sudo pip install xxx".

We had to add one or two lines to .bash_profile. Homebrew tells you what you need to add
or change here.

I tried homebrew today the first time and I like it.

Best regards:

Uwe Fechner
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+...@googlegroups.com.
To post to this group, send email to spyd...@googlegroups.com.
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/groups/opt_out.

Adrian Klaver

unread,
Feb 11, 2014, 2:47:44 PM2/11/14
to spyd...@googlegroups.com
On 02/11/2014 10:36 AM, Jeremy Harbinson wrote:
> Hi,
> I tried unchecking the automatically load numpy option. I checked that
> numpy was not available in the Spyder IPython console. Pandas still
> would not import, nor would it import once I had manually imported numpy
> - same error message as before.
>
> I agree that it looks like some kind of mis-match. I used sys.modules to
> track the paths, but no joy: in Spyder/Python numpy and pandas load from
> Spyder (eg
> /Applications/Spyder.app/Contents/Resources/lib/python2.7/pandas/__init__.pyc),
> in Spyder/IPython numpy also loads from Spyder, but I cannot tell from
> where it tries to load pandas - that might be helpful!

Actually it told you in the traceback in the first post:

File
"/Users/jeremyharbinson1/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pandas/__init__.py",
line 6, in <module>

So you are working with two versions of pandas.

See Uwes' post for a possible solution.

Harbinson, Jeremy

unread,
Feb 12, 2014, 5:20:18 AM2/12/14
to spyd...@googlegroups.com

Hi,

Thanks for this advice – I’ll have a go at installing a separate, up to date Python outside the Enthought and Spyder installations. Maybe also some editing of the Spyder python path will help – it currently includes the Enthought distribution above the Spyder distribution, which seems odd.

All the best,

Jeremy

--
You received this message because you are subscribed to a topic in the Google Groups "spyder" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/spyderlib/hYJZZj_dKjg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to spyderlib+...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages