Jupyter notebook hangs when I try to import PyTables

56 views Asked by At

I'm trying to open an hdf5 file so I'm working with PyTables. For some reason the importation of pytables, either with from tables import * or import tables, causes the jupyter notebook to hang. At first I thought it was having trouble opening the file, but I've set up a bunch of print statements to catch the problem and it came down to PyTables.

print("importing os")
import os
print("importing numpy")
import numpy as np
print("importing pandas")
import pandas as pd
print("importing tables")
import tables
# from tables import *
print("setting path")
path = '/path/to/data'
print("generating empty set")
all_tokens = set()
print("reading csv")
df = pd.read_csv(os.path.join(path, 'data.csv'))
print("about to open file")
with tables.open_file(os.path.join(path, "database.h5"), 'r') as h5file:
    print("file open")
    print(h5file)
    for i in range(len(df):
        pass

I try interrupting the kernel repeatedly and it still hangs, no error output. The only thing that gets it to stop is restarting the kernel, but the problem persists. Strangely, when I restart, sometimes it hangs on the read_csv line instead. The CSV I am importing is fairly large with over 289,000 lines, but there hasn't previously been a problem reading it before. In fact, previously there hasn't been any problem importing PyTables.

If it helps, I'm working in a virtual environment on an HPC via a Slurm job. I have no idea what could be causing this, so any help even in diagnosing the problem would be greatly appreciated.

0

There are 0 answers