53
import pandas as pd
dfs = pd.HDFStore('xxxxx.h5')

throws this error:

"ImportError: HDFStore requires PyTables, "No module named tables" problem importing"

I tried to install PyTables, which Requires Cython. I have Cython 0.21 installed, but it is throwing an error stating that Cython should be greater than 0.13

Here is the log that I am getting:

".. ERROR:: You need Cython 0.13 or greater to compile PyTables!

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /private/tmp/pip_build_root/tables
Storing debug log for failure in /Users/nikhilsahai/Library/Logs/pip.log
Nikhils-MacBook-Pro:~ nikhilsahai$ sudo pip install cython
Requirement already satisfied (use --upgrade to upgrade): cython in /Library/Python/2.7/site-packages/Cython-0.21-py2.7-macosx-10.9-intel.egg
Cleaning up..."

Please guide me how to do solve this issue.

3
  • I assume you have some paths crossed and setup.py is findinging one version of cython and pip is finding a different one.
    – tacaswell
    Sep 22, 2014 at 18:07
  • yeh, you need a much greater version of cython, 0.21 is the current
    – Jeff
    Sep 22, 2014 at 18:22
  • It's a bug in the released version of pytables: github.com/PyTables/PyTables/issues/388. It's fixed in the dev version. Which you can install with pip install git+https://github.com/PyTables/PyTables Sep 22, 2014 at 18:51

7 Answers 7

53

Simply updating pytables with:

pip install --upgrade tables

worked for me.

0
26

I also had the same error when using HDFStore. And I tried all the steps specified above and spent many hours to find a solution, but non of them were successful.

Then I downloaded and installed MiniConda. And then I used the below command to install pytables.

conda install -c conda-forge pytables

Please refer the below screenshot.

enter image description here

0
18

On Ubuntu, I solved this problem using this command:

sudo apt-get install python3-tables

Note that I am using Python 3

7
  • or pkg install py27-tables-3.2.2_1 Dec 12, 2016 at 9:43
  • 10
    or just pip install tables for python 3
    – Shadi
    Jan 5, 2018 at 11:14
  • @shadi I use Linux and prefer to stick to the package manager.
    – Tarik
    Jan 6, 2018 at 16:01
  • 1
    You're kind of restricting your options unnecessarily. With pip you can choose different versions. Pip is also a package manager btw.
    – Shadi
    Jan 6, 2018 at 16:03
  • 2
    @shadi Read this article: matthew-brett.github.io/pydagogue/installing_on_debian.html. It has a balanced view explaining the pros and cons of apt-get vs pip. I prefer using apt-get for stability reasons, others prefer pip to get other benefits such as better control on the package they want. It also seems preferable to use virtualenv in conjunction with pip.
    – Tarik
    Jan 20, 2018 at 23:49
6

You can use pip on any os :

python -m pip install tables

You can check the official documentation on more ways to install it http://www.pytables.org/usersguide/installation.html

1
  • I can confirm: this solves the problem on MacOS and both python2 and python3 (python2 -m pip install tables and python3 -m pip install tables)
    – normanius
    Nov 17, 2017 at 13:04
2

As TomAugspurger mentioned... It seems there is a bug with the latest version of pytables. You can install the current development version by executing the following command:

sudo pip install git+https://github.com/PyTables/PyTables

If it solved the problem, the question should be closed :)

2

You have to install pytables:

conda install pytables

1

On Windows,maybe that is a good choices,using this Command:

pip installed tables-3.2.2-cp34-cp34m-win_amd64.whl

---the document you can download from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.