Repository navigation
Open
Labels
3.0.3configRelated to config.yaml, ruamel, YAML parsing, ...Related to config.yaml, ruamel, YAML parsing, ...
Description
Is there an existing issue for this?
- I have searched the existing issues
Operating System
Windows 11
DeepLabCut version
3.0.2
What engine are you using?
pytorch
DeepLabCut mode
single animal
Device type
NVIDIA RTX PRO 4000 Blackwell Generation Laptop GPU
Bug description 🐛
I'm trying to calibrate 2 points of view using
deeplabcut.calibrate_cameras(config_path3d, cbrow=12, cbcol=8, calibrate=False, alpha=0.9)
An error occurs and stop the process.
It feels like pydantic wants to check config.yaml structure but doesn't recognize some of the arguments inside.
Even when I do not modify the settings in config.yaml, let it by default and don't put any images in "calibration_images" folder, the error still occurs.
It would be nice to fix this.
Steps To Reproduce
- Go into your deeplabcut environment :
conda activate deeplabcut - Use ipython
ipython - Import deeplabcut library
import deeplabcut - Create a new 3D DLC project
config_path3d=deeplabcut.create_new_project_3d("trial","USER", num_cameras=2, working_directory=r"C:\Users\USER\Documents\DLC") - Try to calibrate even if no images are in "calibration_images"
deeplabcut.calibrate_cameras(config_path3d, cbrow=12, cbcol=8, calibrate=False, alpha=0.9)
Relevant log output
---------------------------------------------------------------------------
ValidationError Traceback (most recent call last)
Cell In[5], line 1
----> 1 deeplabcut.calibrate_cameras(config_path3d, cbrow=12, cbcol=8, calibrate=False, alpha=0.9)
File ~\AppData\Local\miniforge3\envs\deeplabcut\lib\site-packages\deeplabcut\pose_estimation_3d\camera_calibration.py:81, in calibrate_cameras(config, cbrow, cbcol, calibrate, alpha, search_window_size)
78 objp[:, :2] = np.mgrid[0:cbcol, 0:cbrow].T.reshape(-1, 2)
80 # Read the config file
---> 81 cfg_3d = auxiliaryfunctions.read_config(config)
82 (
83 img_path,
84 path_corners,
(...)
87 path_removed_images,
88 ) = auxiliaryfunctions_3d.Foldernames3Dproject(cfg_3d)
90 images = [str(p) for p in Path(img_path).glob("*.jpg")]
File ~\AppData\Local\miniforge3\envs\deeplabcut\lib\site-packages\deeplabcut\core\config\utils.py:330, in read_config(configname, ignore_empty)
321 warnings.warn(
322 "read_config(ignore_empty=...) is deprecated and no longer has any effect: "
323 "empty/None values for non-optional ProjectConfig fields are always treated "
(...)
326 stacklevel=2,
327 )
329 path = Path(configname)
--> 330 project_config = ProjectConfig.from_yaml(path)
332 # If necessary, ProjectConfig automatically updates its project path via _post_yaml_load_updates.
333 # if that is the case (marked as dirty), we write the config back to the file.
334 if "project_path" in project_config.dirty_fields:
335 # NOTE @deruyter92 2026-02-02: copied old behaviour of writing the config
336 # immediately back to the file after reading it. We should consider separating
337 # the writing and reading instead of having inplace edits during reading.
File ~\AppData\Local\miniforge3\envs\deeplabcut\lib\site-packages\deeplabcut\core\config\base_config.py:104, in DLCBaseConfig.from_yaml(cls, yaml_path)
101 @classmethod
102 def from_yaml(cls, yaml_path: str | Path) -> Self:
103 yaml_dict = read_config_as_dict(yaml_path)
--> 104 cfg = cls.from_dict(yaml_dict)
105 cfg._post_yaml_load_updates(yaml_path=Path(yaml_path))
106 return cfg
File ~\AppData\Local\miniforge3\envs\deeplabcut\lib\site-packages\deeplabcut\core\config\base_config.py:342, in DLCVersionedConfig.from_dict(cls, cfg_dict)
335 @classmethod
336 def from_dict(cls, cfg_dict: dict) -> Self:
337 cfg_dict = versioning.migrate_config(
338 cfg_dict,
339 config_type=cls.__name__,
340 target_version=versioning.CURRENT_CONFIG_VERSION,
341 )
--> 342 return super().from_dict(cfg_dict)
File ~\AppData\Local\miniforge3\envs\deeplabcut\lib\site-packages\deeplabcut\core\config\base_config.py:82, in DLCBaseConfig.from_dict(cls, cfg_dict)
80 @classmethod
81 def from_dict(cls, cfg_dict: dict) -> Self:
---> 82 return cls.model_validate(cfg_dict)
File ~\AppData\Local\miniforge3\envs\deeplabcut\lib\site-packages\pydantic\main.py:732, in BaseModel.model_validate(cls, obj, strict, extra, from_attributes, context, by_alias, by_name)
726 if by_alias is False and by_name is not True:
727 raise PydanticUserError(
728 'At least one of `by_alias` or `by_name` must be set to True.',
729 code='validate-by-alias-and-name-false',
730 )
--> 732 return cls.__pydantic_validator__.validate_python(
733 obj,
734 strict=strict,
735 extra=extra,
736 from_attributes=from_attributes,
737 context=context,
738 by_alias=by_alias,
739 by_name=by_name,
740 )
ValidationError: 12 validation errors for ProjectConfig
alphaValue
Extra inputs are not permitted [type=extra_forbidden, input_value=0.8, input_type=float]
For further information visit https://errors.pydantic.dev/2.13/v/extra_forbidden
markerType
Extra inputs are not permitted [type=extra_forbidden, input_value='*', input_type=str]
For further information visit https://errors.pydantic.dev/2.13/v/extra_forbidden
markerColor
Extra inputs are not permitted [type=extra_forbidden, input_value='r', input_type=str]
For further information visit https://errors.pydantic.dev/2.13/v/extra_forbidden
num_cameras
Extra inputs are not permitted [type=extra_forbidden, input_value=2, input_type=int]
For further information visit https://errors.pydantic.dev/2.13/v/extra_forbidden
camera_names
Extra inputs are not permitted [type=extra_forbidden, input_value=['camera-1', 'camera-2'], input_type=list]
For further information visit https://errors.pydantic.dev/2.13/v/extra_forbidden
scorername_3d
Extra inputs are not permitted [type=extra_forbidden, input_value='DLC_3D', input_type=str]
For further information visit https://errors.pydantic.dev/2.13/v/extra_forbidden
config_file_camera-1
Extra inputs are not permitted [type=extra_forbidden, input_value='/home/mackenzie/DEEPLABC...-2019-06-05/config.yaml', input_type=str]
For further information visit https://errors.pydantic.dev/2.13/v/extra_forbidden
config_file_camera-2
Extra inputs are not permitted [type=extra_forbidden, input_value='/home/mackenzie/DEEPLABC...-2019-06-05/config.yaml', input_type=str]
For further information visit https://errors.pydantic.dev/2.13/v/extra_forbidden
shuffle_camera-1
Extra inputs are not permitted [type=extra_forbidden, input_value=1, input_type=int]
For further information visit https://errors.pydantic.dev/2.13/v/extra_forbidden
trainingsetindex_camera-1
Extra inputs are not permitted [type=extra_forbidden, input_value=0, input_type=int]
For further information visit https://errors.pydantic.dev/2.13/v/extra_forbidden
shuffle_camera-2
Extra inputs are not permitted [type=extra_forbidden, input_value=1, input_type=int]
For further information visit https://errors.pydantic.dev/2.13/v/extra_forbidden
trainingsetindex_camera-2
Extra inputs are not permitted [type=extra_forbidden, input_value=0, input_type=int]
For further information visit https://errors.pydantic.dev/2.13/v/extra_forbiddenAnything else?
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
3.0.3configRelated to config.yaml, ruamel, YAML parsing, ...Related to config.yaml, ruamel, YAML parsing, ...
Activity
deruyter92 commentedon Nov 13, 2026
Hi @Kevin-POIROT
Thanks for pointing out this problem. We have verified the bug and fixed it in #3587.
You can install the fix by running
pip install "git+https://github.com/DeepLabCut/DeepLabCut.git@736412da7b4ab60e3cc0b73862d5262bdb59ab14"We plan to include the fix in a new release soon.
Let us know if this works for you or if we can help you with another workaround for now.
Kevin-POIROT commentedon Nov 13, 2026
Hi @deruyter92
After installing the fix, I tried exactly the same protocol as described in "Steps to Reproduce" and I obtained exactly the same error as in "Relevant log output".
deruyter92 commentedon Nov 13, 2026
@Kevin-POIROT, could it be the case that you installed the fix in a different environment than the one where you are running your ipython session? Or did the install maybe fail? To verify, could you paste the output of the commands below?
After a successful install, it should be impossible to reach the exact same traceback for
cfg_3d = auxiliaryfunctions.read_config(config)since that line does not exist in the new code.In your terminal, after installing the fix:
In your ipython session:
The output of
print(sys.excecutable)prints the location where python is installed and DeepLabCut. It should be the same in your terminal after installation, and in your ipython session. Otherwise you did not install the fix in the same environment.