Sublime Forum

ImportError: No module named tables

#1

I am writing a small program that uses pytables. When run the program within sublime text 2 I get the error above. However, when I run the program from command line it runs without error. Any suggestions?

import tables
import numpy as np
from pandas import HDFStore,DataFrame

#create (or open) an hdf5 file and opens in append mode
hdf = HDFStore(‘storage.h5’)

df = DataFrame(np.random.rand(5,3), columns=(‘A’,‘B’,‘C’))

#put the dataset in the storage
hdf.put(‘d1’, df, format=‘table’, data_columns=True)

print hdf’d1’].shape

0 Likes

#2

Your system Python and Sublime Text’s internal Python are decoupled and do not share their modules. You need to make the tables module available to Sublime Text by adjusting sys.path in ST (most likely only works locally, unless you determine the path programmatically) or by including the pytables module in your package.

0 Likes