7

I tried looking for an answer to this around the forum/google, but I can't find anything. My issue is this (from python console):

>>> import pandas
cannot import name hashtable
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\pandas\__init__.py", line 6, in <module>
    from . import hashtable, tslib, lib
ImportError: cannot import name hashtable //also can't import name NaT somtimes

I ran the windows 1-click installer prior to attempting the import. I'm running everything 32-bit. The pandas installer is for python 2.7.

Here's a list of modules that I have correctly imported into Python.

  1. setuptools
  2. pip
  3. mox
  4. dateutil
  5. six
  6. numpy
  7. SQLAlchemy

I'm on windows 7.

I also have anaconda installed, but that was really just a "hail mary" after I tried everything else. My end goal is to install the ultra-finance module. However, it seems to require pandas, hence me being stuck.

I'm a python noob, so please don't assume I know anything. Thanks.

EDIT: please let me know if I can provide any extra information.

downtempo
  • 73
  • 1
  • 1
  • 5
  • How did you install pandas? Were you installing from source? – Andy Hayden Jun 15 '13 at 23:46
  • 1
    possible duplicate of [Python3.3\_ImportError: cannot import name hashtable?](http://stackoverflow.com/questions/14422976/python3-3-importerror-cannot-import-name-hashtable) (granted that *says* 3.3, but the issue is the same) – Andy Hayden Jun 15 '13 at 23:48
  • installed using the installer - pandas-0.11.0.win32-py2.7.exe. I'm pretty sure i also tried source a few hours ago using the disutil method discussed here: http://docs.python.org/2/install/ I'm going to try that one again to make sure i did it right. – downtempo Jun 15 '13 at 23:51
  • you're right, I'll check that thread. Thanks for the heads up, I'll check that thread and if it helps i'm assuming I should just delete this one? – downtempo Jun 15 '13 at 23:53
  • I'd leave it so it comes up in google (and other people with the same issue can find it), I've voted to close as a duplicate (that was google redirects). :) – Andy Hayden Jun 16 '13 at 00:00
  • I really appreciate the help Andy. – downtempo Jun 16 '13 at 00:05

4 Answers4

3

The recommended way to install pandas is via pip:

pip install pandas

This hashtables error arises from the cython files not being built. This error message will be more informative from 0.11.1.

Andy Hayden
  • 359,921
  • 101
  • 625
  • 535
  • Note: this question is a duplicate of [this one](http://stackoverflow.com/questions/14422976/importing-pandas-shows-importerror-cannot-import-name-hashtable), see my longer answer there. – Andy Hayden Aug 19 '14 at 02:08
  • In fact, the real cause of this error is that some internal dependency of panda is broken, that's why installing or updating via pip solves the problem most of the times. – amorales Jan 21 '15 at 17:20
  • 1
    @amorales this isn't an internal "dependancy" as much as the internal cython (.pyx) files being compiled/built. Updating via conda and pip should fix as they ship precompiled. – Andy Hayden Jan 22 '15 at 01:41
1

Try running your code in Spyder (Anaconda -> Spyder). It worked for me.

Eldorado
  • 69
  • 4
0

Check that you have python scripts included in your system path variable. In my case I had to add "C:\Python27\Scripts"

DivideByZero
  • 131
  • 2
  • 11
0

I was having a similar problem when downloading Pandas to my Windows 8 system. The first error I had was an egg error, but after installing some packages I think I have the solution.

First look at the previous pip errors with Pandas, make sure you have the most updated pip.

The second part is downloading wheel using

pip install wheel 

After installing wheel and having the dependencies for panda and using pip it worked correctly.

user2723240
  • 803
  • 1
  • 13
  • 23