Reputation: 3519
import pandas as pd
df = pd.DataFrame({'a' : [1,2,3]})
df.to_hdf('temp.h5', key='df', mode='w')
This is giving me error.
Missing optional dependency 'tables'. Use pip or conda to install tables.
I already tried ImportError HDFStore requires PyTables No module named tables. Still the same error.
I am getting the same error when reading hdf file. And tables
are already installed for my python.
Some version info.
- python 3.7.4
- pandas 0.25.2
- windows10
PS: You can reproduce this in repl
https://repl.it/.
Update:
import tables
and got this error:
ImportError: Could not load any of ['hdf5.dll', 'hdf5dll.dll'], please ensure that it can be found in the system path.
It looks like pandas is not giving accurate message for this. Its just saying missing dependency when its actually present.
If anyone knows how to resolve this. That will help.
Upvotes: 44
Views: 61737
Reputation: 444
Bizarrely, I found that the pandas error has nothing to do with pytables which was the last error produced. Up higher in the stack trace, I noticed an error about Callables not being imported (typing support).
This fixed me:
pip install --upgrade typing_extensions
Upvotes: 0
Reputation: 11
Using MacOS Ventura on Apple M2 processor the above was not working for me. What finally was working for me:
env HDF5_DIR=/opt/homebrew/opt/hdf5 python3 -m pip install tables
Where /opt/homebrew/opt/hdf5
is the hdf5
installation location
Upvotes: 0
Reputation: 169
I used following command successfully resolved this problem:
pip install --upgrade tables
hope that work for you !
Upvotes: 3
Reputation: 445
The above solutions did not work for me. Perhaps because I built the individual environment using the conda-forge channel, I had success with this:
conda install -c conda-forge pytables
Upvotes: 2
Reputation: 41
using tables 3.6.1 worked for me to resolve the dependency
pip install tables==3.6.1
Upvotes: 4
Reputation: 1
This problem has appeared for me when refreshing an existing conda virtal env using pip install -U -r requirements.txt
. I resolved the issue as follows:
conda env remove -n <env> # remove your virtual env.
conda create -n <env> python==3.8 # create your virtual env again.
pip install -U -r requirements.txt
It's quite tedius to maintain a mix of conda and pip packages, so I just use the latter.
Upvotes: 0
Reputation: 3519
tables
.tables
using pip into local user directory using following command it's not working.pip install --user tables
Running import tables
will result in this error.
ImportError: Could not load any of ['hdf5.dll', 'hdf5dll.dll'], please ensure that it can be found in the system path
The solution that worked for me is to uninstall tables. And install it into python's directory. (or where your python is installed). without --user option
. You may require admin/root access for this depending upon location of your python.
C:\Program Files\Python37-64\python.exe
and installing under c:\program files\python37-64\lib\site-packages\
worked for me. Upvotes: 31