Skip to content

Python import: DataAugmentationUtils -- pydantic errors #2367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
siboles opened this issue Mar 19, 2025 · 1 comment
Open

Python import: DataAugmentationUtils -- pydantic errors #2367

siboles opened this issue Mar 19, 2025 · 1 comment

Comments

@siboles
Copy link

siboles commented Mar 19, 2025

Description

Importing DataAugmentationUtils raises a TypeError with classes inheriting from ApiModel. I was able to resolve the issue, but posting here in case others have the same problem.

Details

Release: v6.5.1
OS: PopOS 22.04

To Reproduce Error

import DataAugmentationUtils

Error Trace

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/scotts/miniforge3/envs/shapeworks/lib/python3.9/site-packages/DataAugmentationUtils/__init__.py", line 1, in <module>
    from DataAugmentationUtils import DataAugmentation
  File "/home/scotts/miniforge3/envs/shapeworks/lib/python3.9/site-packages/DataAugmentationUtils/DataAugmentation.py", line 6, in <module>
    from DataAugmentationUtils import Utils
  File "/home/scotts/miniforge3/envs/shapeworks/lib/python3.9/site-packages/DataAugmentationUtils/Utils.py", line 1, in <module>
    import shapeworks as sw
  File "/home/scotts/miniforge3/envs/shapeworks/lib/python3.9/site-packages/shapeworks/__init__.py", line 13, in <module>
    from .portal import download_dataset
  File "/home/scotts/miniforge3/envs/shapeworks/lib/python3.9/site-packages/shapeworks/portal.py", line 16, in <module>
    from swcc.models import Dataset
  File "/home/scotts/miniforge3/envs/shapeworks/lib/python3.9/site-packages/swcc/models/__init__.py", line 2, in <module>
    from .other_models import (
  File "/home/scotts/miniforge3/envs/shapeworks/lib/python3.9/site-packages/swcc/models/other_models.py", line 19, in <module>
    class Segmentation(ApiModel):
  File "pydantic/main.py", line 197, in pydantic.main.ModelMetaclass.__new__
  File "pydantic/fields.py", line 506, in pydantic.fields.ModelField.infer
  File "pydantic/fields.py", line 436, in pydantic.fields.ModelField.__init__
  File "pydantic/fields.py", line 552, in pydantic.fields.ModelField.prepare
  File "pydantic/fields.py", line 751, in pydantic.fields.ModelField._type_analysis
  File "pydantic/fields.py", line 808, in pydantic.fields.ModelField._create_sub_type
  File "pydantic/fields.py", line 436, in pydantic.fields.ModelField.__init__
  File "pydantic/fields.py", line 552, in pydantic.fields.ModelField.prepare
  File "pydantic/fields.py", line 668, in pydantic.fields.ModelField._type_analysis
  File "/home/scotts/miniforge3/envs/shapeworks/lib/python3.9/typing.py", line 852, in __subclasscheck__
    return issubclass(cls, self.__origin__)
TypeError: issubclass() arg 1 must be a class

My Fix

Updating pydantic from 1.10.7 (from release python_requirements.txt) to 1.10.13 seems to resolve the issue.

conda activate shapeworks
pip install pydantic==1.10.13
@akenmorris
Copy link
Contributor

Yes, this has been updated in the master branch and will be part of the next ShapeWorks release.

pydantic==1.10.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants