Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Development build of pandas giving importerror: C extension: 'hashtable' not built on python 3.4 (anaconda)

Try to do a development build with 3.4 (have previously managed in 2.7). Python is just an anaconda installation on osx10.10. I can get

I:

  • git cloned pandas
  • ran python setup.py build_ext --inplace (got no errors)
  • ran python setup.py develop.

But when I try and import pandas I get:

import pandas as pd
Traceback (most recent call last):

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

  File "/Users/Nick/github/pandas/pandas/__init__.py", line 13, in <module>
    "extensions first.".format(module))

ImportError: C extension: 'hashtable' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first.

Note that when I do build_ext I get the following (apparently fine) output:

pandas(master)$python setup.py build_ext --inplace

running build_ext
skipping 'pandas/index.c' Cython extension (up-to-date)
skipping 'pandas/lib.c' Cython extension (up-to-date)
skipping 'pandas/parser.c' Cython extension (up-to-date)
skipping 'pandas/src/period.c' Cython extension (up-to-date)
skipping 'pandas/hashtable.c' Cython extension (up-to-date)
skipping 'pandas/algos.c' Cython extension (up-to-date)
skipping 'pandas/tslib.c' Cython extension (up-to-date)
skipping 'pandas/src/sparse.c' Cython extension (up-to-date)
skipping 'pandas/src/testing.c' Cython extension (up-to-date)
skipping 'pandas/msgpack.cpp' Cython extension (up-to-date)

Further, I can get pandas installed if I run conda install pandas, but would really like a development environment for code development.

Similar to this, which looked unsolved and this

like image 751
nick_eu Avatar asked Jul 18 '15 21:07

nick_eu


2 Answers

The answer, due to @chrisb in comments, was to run python setup.py build_ext --inplace --force.

like image 157
nick_eu Avatar answered Sep 30 '22 17:09

nick_eu


I solved it reinstalling pandas with this command:

conda install pandas

Everything was working fine, but I installed something using pip and started having problems. This solved it.

like image 39
neves Avatar answered Sep 30 '22 15:09

neves