Repository navigation
Cannot create labelled videos on Windows from videos analyzed on Linux #3562
Description
Is there an existing issue for this?
- I have searched the existing issues
Operating System
Ubuntu 22.04 (for training/analysis), Windows 11 (for creating labelled videos)
DeepLabCut version
3.0.2
What engine are you using?
pytorch
DeepLabCut mode
single animal
Device type
GeForce RTX 2080
Bug description 🐛
Attempting to create labelled videos on Windows from analysis results created on Linux raises NotImplementedError: cannot instantiate 'PosixPath' on your system
Steps To Reproduce
- Install DeepLabCut on a Linux machine
- Run the following python script:
import deeplabcut
import imageio.v3 as iio
import os
import numpy as np
import pandas as pd
from itertools import chain
iio.imwrite('~/test.mp4',np.zeros((100,128,128,3)))
deeplabcut.create_new_project('PosixPathTest','John',[os.sep.join([os.environ['HOME'],'test.mp4'])])
os.chdir('PosixPathTest-John-2026-10-22') # change to today's date
deeplabcut.extract_frames('config.yaml',userfeedback=False,algo='uniform')
frames = [('labeled-data','test',file.name) for file in os.scandir('labeled-data/test') if file.name.endswith('.png')]
columns = list(chain(*[[('John',bodypart,coord) for coord in 'xy'] for bodypart in ['bodypart1','bodypart2','bodypart3','objectA']]))
df = pd.DataFrame(np.ones((len(frames),len(columns))),columns=pd.MultiIndex.from_tuples(columns,names=['scorer','bodyparts','coords']),index=pd.MultiIndex.from_tuples(frames))
df.to_csv('labeled-data/test/CollectedData_John.csv')
df.to_hdf('labeled-data/test/CollectedData_John.h5',key='df_with_missing')
deeplabcut.create_training_dataset('config.yaml')
deeplabcut.train_network('config.yaml',shuffle=1) # can keyboard interrupt after at least on snapshot is created if you don't want to wait for training to run
deeplabcut.analyze_videos('config.yaml',[os.sep.join([os.environ['HOME'],'test.mp4'])],shuffle=1)
- Copy the created video, DLC project, and label files to a Windows machine
- On the Windows machine, install DeepLabCut
- On the Windows machine, run the following Python script:
import deeplabcut
config = R'C:\path\to\config.yaml' # update path appropriately
videos = [R'C:\path\to\test.mp4'] # update path appropriately
deeplabcut.create_labeled_video(config,videos,videotype='mp4',shuffle=1)
Expected behaviour:
A labelled video is created
Actual behaviour:
The script throws NotImplementedError: cannot instantiate 'PosixPath' on your system
Relevant log output
Starting to process video: Z:\LACIE\DATA\John\dlc\test.mp4
Loading Z:\LACIE\DATA\John\dlc\test.mp4 and data.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\jmb9770\Anaconda3\envs\DEEPLABCUT\lib\site-packages\deeplabcut\core\deprecation.py", line 204, in wrapper
return fn(*args, **kwargs)
File "C:\Users\jmb9770\Anaconda3\envs\DEEPLABCUT\lib\site-packages\deeplabcut\utils\make_labeled_video.py", line 707, in create_labeled_video
results.append(func(video))
File "C:\Users\jmb9770\Anaconda3\envs\DEEPLABCUT\lib\site-packages\deeplabcut\utils\make_labeled_video.py", line 783, in proc_video
metadata = auxiliaryfunctions.load_video_metadata(destfolder, vname, DLCscorer)
File "C:\Users\jmb9770\Anaconda3\envs\DEEPLABCUT\lib\site-packages\deeplabcut\utils\auxiliaryfunctions.py", line 629, in load_video_metadata
return read_pickle(find_video_metadata(folder, videoname, scorer))
File "C:\Users\jmb9770\Anaconda3\envs\DEEPLABCUT\lib\site-packages\deeplabcut\utils\auxiliaryfunctions.py", line 145, in read_pickle
return pickle.load(handle)
File "C:\Users\jmb9770\Anaconda3\envs\DEEPLABCUT\lib\pathlib.py", line 962, in __new__
raise NotImplementedError("cannot instantiate %r on your system"
NotImplementedError: cannot instantiate 'PosixPath' on your systemAnything else?
Based on the stack trace, this seems to be caused by an issue unpickling the video metadata, which apparently stores certain paths as system-specific subclasses of pathlib.Path. For cross-platform compatibility, these should probably be saved as strings, or some other platform agnostic format.
The steps to reproduce are the minimal reproducible example that I could come up with, but this happened on a real project using real data/videos.
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
C-Achard commentedon Oct 23, 2026
@Ayskin Maybe relevant for the pickle refactoring/rework!
C-Achard commentedon Oct 23, 2026
Thanks for the report @johnmbarrett, this is correct and confirmed.
This is now fixed minimally in #3564/#3565, we will see if we can ship alongside the rest of 3.0.3.
We are more broadly reworking the pickling system on our side as well, hopefully improving the overall usability and portability of those files.
Please let us know if you need help or are currently blocked with your work, we can help you install the fix locally if needed!
Best,
Cyril
C-Achard commentedon Oct 23, 2026
(Keeping open until 3.0.3 is released)