Deeplabcut: Unable to Label Videos: ImportError: Missing optional dependency 'tables'. Use pip or conda to install tables.

Created on 14 Feb 2020  路  4Comments  路  Source: DeepLabCut/DeepLabCut

* Bug report **
Description: Unable to label videos due to error generated:
"ImportError: Missing optional dependency 'tables'. Use pip or conda to install tables."

To Reproduce
Windows 10
Python=3.6
tensorflow-gpu==1.13.1
pytables==3.4.3
numpy==1.17.2

Expected behavior
I expected a labelled video to be written.

* Error Output *

`---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-8-560a625bda99> in <module>
      6 deeplabcut.convertcsv2h5(path_config_file)
      7 print('Starting Create Labelled Video')
----> 8 deeplabcut.create_labeled_video(path_config_file,videofile_path,videotype='mp4')
      9 #deeplabcut.create_labeled_video(path_config_file,videofile_path,videotype='mp4')

C:\ProgramData\Anaconda3\envs\dlc-GPU-C10t13\lib\site-packages\deeplabcut\utils\make_labeled_video.py in create_labeled_video(config, videos, videotype, shuffle, trainingsetindex, filtered, save_frames, Frames2plot, delete, displayedbodyparts, codec, outputframerate, destfolder, draw_skeleton, trailpoints, displaycropped)
    376         else:
    377             print("Loading ", video, "and data.")
--> 378             datafound,metadata,Dataframe,DLCscorer,suffix=auxiliaryfunctions.LoadAnalyzedData(str(videofolder),vname,DLCscorer,filtered) #returns boolean variable if data was found and metadata + pandas array
    379             videooutname=os.path.join(vname + DLCscorer+suffix+'_labeled.mp4')
    380             if datafound and not os.path.isfile(videooutname): #checking again, for this loader video could exist

C:\ProgramData\Anaconda3\envs\dlc-GPU-C10t13\lib\site-packages\deeplabcut\utils\auxiliaryfunctions.py in LoadAnalyzedData(videofolder, vname, DLCscorer, filtered)
    447                 DLCscorer='DLC_'+(datanames[0].split('DLC_')[1]).split('.h5')[0]
    448             print("Creating output for:", DLCscorer," instead.")
--> 449             Dataframe = pd.read_hdf(datanames[0])
    450             metadata=LoadVideoMetadata(datanames[0])
    451             datafound=True

C:\ProgramData\Anaconda3\envs\dlc-GPU-C10t13\lib\site-packages\pandas\io\pytables.py in read_hdf(path_or_buf, key, mode, errors, where, start, stop, columns, iterator, chunksize, **kwargs)
    395             raise FileNotFoundError(f"File {path_or_buf} does not exist")
    396 
--> 397         store = HDFStore(path_or_buf, mode=mode, errors=errors, **kwargs)
    398         # can't auto open/close if we are using an iterator
    399         # so delegate to the iterator

C:\ProgramData\Anaconda3\envs\dlc-GPU-C10t13\lib\site-packages\pandas\io\pytables.py in __init__(self, path, mode, complevel, complib, fletcher32, **kwargs)
    516             raise ValueError("format is not a defined argument for HDFStore")
    517 
--> 518         tables = import_optional_dependency("tables")
    519 
    520         if complib is not None and complib not in tables.filters.all_complibs:

C:\ProgramData\Anaconda3\envs\dlc-GPU-C10t13\lib\site-packages\pandas\compat\_optional.py in import_optional_dependency(name, extra, raise_on_missing, on_version)
     90     except ImportError:
     91         if raise_on_missing:
---> 92             raise ImportError(msg) from None
     93         else:
     94             return None

ImportError: Missing optional dependency 'tables'.  Use pip or conda to install tables.`

Desktop (please complete the following information about your system):

  • OS: Windows10
  • DeepLabCut Version: 2.1.5.2
  • Browser Chrome

Additional context
I tried trying older solutions including pip uninstall numpy, and conda install numpy==1.17.2 and I'm still getting this tables error.

All 4 comments

Seems your tables is broken. There are several issues on this and the Troubleshooting Tips: https://github.com/AlexEMG/DeepLabCut/wiki/Troubleshooting-Tips If you use the search fucntion in this repo yuo will find several solutions.

Windows: one user reports an issue with PyTables (i.e. here) pd.read_hdf(path). The solution was to upgrade tables from 3.4.4 to 3.4.5.dev using: pip install git+https://github.com/PyTables/PyTables

https://github.com/AlexEMG/DeepLabCut/issues/431

https://github.com/AlexEMG/DeepLabCut/issues/377

https://github.com/AlexEMG/DeepLabCut/issues/63

Thank you for the advice!

maceng4's solution worked for me to get past the pytables error (#63 ) https://github.com/AlexEMG/DeepLabCut/issues/63

Still can't label videos at the moment, now on to float division by zero, ffmpeg opencv error!

Other information: I used the default .yaml Windows GPU config file to install on a vanilla anaconda install, Windows 10 (1903).

maybe check out this. We also just added code to check video for errors, so that will be in 2.1.6; and/or you can directly import and use the source code and this will be a more useful warning... see:

https://github.com/AlexEMG/DeepLabCut/issues/557

Yes, sadly windows can have so many ways to install things/depends on what was installed already, as conda isn't a real virtual env; ie like docker, so there can be a lot of little differences in how/where things get installed (shout out for ubuntu if you want to take the plunge!)

Maybe I'll go back to Ubuntu, I'm not afraid of it just dependent on Windows Apps :(

Also, I figured out the video issue, it was the pathname after all, it must be explicit rather than relative.

Thanks for the quick replies!

Was this page helpful?
0 / 5 - 0 ratings