Saving labeled images AttributeError PandasArray

Hi all, I am new to DLC and python but excited to get more involved for my research. I am using the example video to practice (openfield-Pranav) and following along with the youtube tutorial (DeepLabCut Project Manager GUI: Tutorial) but cannot make it past the step of labeling frames. When I click save after labeling, I get an AttributeError: ‘PandasArray’ object has no attribute ‘_str_encode’. Any help would be greatly appreciated!
Cheers,
Emily

I am running DLC (CPU) version 2.1.10.2 on macOS 10.12.6 (Sierra)

(DLC-CPU) DT-320384-BIO:~ dbernal$ cd Desktop/DLC/DeepLabCut
(DLC-CPU) DT-320384-BIO:DeepLabCut dbernal$ pythonw
Python 3.7.9 (default, Aug 31 2020, 07:22:35)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

import deeplabcut
deeplabcut.launch_dlc()
Traceback (most recent call last):
File “/Users/dbernal/Desktop/DLC/DeepLabCut/deeplabcut/generate_training_dataset/labeling_toolbox.py”, line 916, in saveDataSet
mode=“w”,
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/core/generic.py”, line 2449, in to_hdf
encoding=encoding,
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/io/pytables.py”, line 270, in to_hdf
f(store)
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/io/pytables.py”, line 262, in
encoding=encoding,
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/io/pytables.py”, line 1129, in put
track_times=track_times,
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/io/pytables.py”, line 1801, in _write_to_group
track_times=track_times,
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/io/pytables.py”, line 4238, in write
data_columns=data_columns,
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/io/pytables.py”, line 3834, in _create_axes
new_index = _convert_index(axis_name, a, self.encoding, self.errors)
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/io/pytables.py”, line 4813, in _convert_index
converted = _convert_string_array(values, encoding, errors)
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/io/pytables.py”, line 4946, in _convert_string_array
.str.encode(encoding, errors)
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/core/strings/accessor.py”, line 101, in wrapper
return func(self, *args, **kwargs)
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/core/strings/accessor.py”, line 1722, in encode
result = self._data.array._str_encode(encoding, errors)
AttributeError: ‘PandasArray’ object has no attribute ‘_str_encode’

Hey @erobins, could you try updating pandas and tables with pip install pandas -U and pip install tables -U and tell me if that fixes it? :slight_smile:

Hi @jeylau
Thanks for the suggestion! I tried your idea and it updated from numpy 1.15.4 to 1.20.1, with pandas and tables updated. Unfortunately, I still got the same error when I tried to save the labeled images.

output when updating:
(DLC-CPU) DT-320384-BIO:DeepLabCut dbernal$ pip install pandas -U
Requirement already satisfied: pandas in /opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages (1.2.2)
Requirement already satisfied: pytz>=2017.3 in /opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages (from pandas) (2021.1)
Requirement already satisfied: python-dateutil>=2.7.3 in /opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages (from pandas) (2.8.1)
Collecting numpy>=1.16.5
Downloading numpy-1.20.1-cp37-cp37m-macosx_10_9_x86_64.whl (16.0 MB)
|████████████████████████████████| 16.0 MB 38 kB/s
Requirement already satisfied: six>=1.5 in /opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)
Installing collected packages: numpy
Attempting uninstall: numpy
Found existing installation: numpy 1.15.4
Uninstalling numpy-1.15.4:
Successfully uninstalled numpy-1.15.4
Successfully installed numpy-1.20.1
(DLC-CPU) DT-320384-BIO:DeepLabCut dbernal$ pip install tables -U
Requirement already satisfied: tables in /opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages (3.6.1)
Requirement already satisfied: numpy>=1.9.3 in /opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages (from tables) (1.20.1)
Requirement already satisfied: numexpr>=2.6.2 in /opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages (from tables) (2.7.2)

output when saving:
Traceback (most recent call last):
File “/Users/dbernal/Desktop/DLC/DeepLabCut/deeplabcut/generate_training_dataset/labeling_toolbox.py”, line 916, in saveDataSet
mode=“w”,
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/core/generic.py”, line 2449, in to_hdf
encoding=encoding,
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/io/pytables.py”, line 270, in to_hdf
f(store)
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/io/pytables.py”, line 262, in
encoding=encoding,
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/io/pytables.py”, line 1129, in put
track_times=track_times,
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/io/pytables.py”, line 1801, in _write_to_group
track_times=track_times,
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/io/pytables.py”, line 4238, in write
data_columns=data_columns,
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/io/pytables.py”, line 3834, in _create_axes
new_index = _convert_index(axis_name, a, self.encoding, self.errors)
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/io/pytables.py”, line 4813, in _convert_index
converted = _convert_string_array(values, encoding, errors)
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/io/pytables.py”, line 4946, in _convert_string_array
.str.encode(encoding, errors)
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/core/strings/accessor.py”, line 101, in wrapper
return func(self, *args, **kwargs)
File “/opt/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/pandas/core/strings/accessor.py”, line 1722, in encode
result = self._data.array._str_encode(encoding, errors)
AttributeError: ‘PandasArray’ object has no attribute ‘_str_encode’