Unable to initialize Python in ver 6.4 and 6.5(dev)

Hello, I am currently working with human mandible with ShapeWorks but I have some problem on version 6.4 and 6.5 (dev).

I didn’t know that there was a new release so I’ve tried to install the new version and the dev version on my computer based on the installation guideline. However, I constantly meet two error messages below (it is written in Korean - “cannot find designated module”)


I saw in release note of 6.3 that python error problem is solved already, but I don’t know why I am confronting this problem. I’ve already tried to uninstall all the problem and redo the process but still I am seeing those error. Is there any way I could solve this problem?

Thank you.

The photo is so small so I copy and paste the error message.

Error: Unable to initialize Python: ImportError: DLL load failed while importing vtkViewsInfovis: 지정된 모듈을 찾을 수 없습니다. At: C:\Users\Admin.conda\envs\shapeworks64\lib\site-packages\vtkmodules\all.py(21): (228): _call_with_frames_removed (850): exec_module (695): _load_unlocked (986): _find_and_load_unlocked (1007): _find_and_load (1030): gcd_import C:\Users\Admin.conda\envs\shapeworks64\lib\importlib_init.py(127): import_module C:\Users\Admin.conda\envs\shapeworks64\lib\site-packages\vtk.py(31): (228): _call_with_frames_removed (850): exec_module (695): _load_unlocked (986): _find_and_load_unlocked (1007): find_and_load C:\Users\Admin.conda\envs\shapeworks64\lib\site-packages\shapeworks_init.py(1): (228): _call_with_frames_removed (850): exec_module (695): _load_unlocked (986): _find_and_load_unlocked (1007): _find_and_load (228): _call_with_frames_removed (972): _find_and_load_unlocked (1007): _find_and_load

Error: Unable to initialize Python. Please run install_shapeworks.bat

Hi,

Can you check if you are able to import the shapeworks python module from within python via the anaconda prompt?

  1. Open the anaconda command prompt
  2. run “conda activate shapeworks” (check that this works)
  3. run “python”
  4. In python, “import shapeworks” (check that this works)

Hi, thank you for your reply.

If I import shapeworks in anaconda command prompt, the error message like below appears.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Admin\.conda\envs\shapeworks\lib\site-packages\shapeworks\__init__.py", line 1, in <module>
    import vtk
  File "C:\Users\Admin\.conda\envs\shapeworks\lib\site-packages\vtk.py", line 31, in <module>
    all_m = importlib.import_module('vtkmodules.all')
  File "C:\Users\Admin\.conda\envs\shapeworks\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\Admin\.conda\envs\shapeworks\lib\site-packages\vtkmodules\all.py", line 21, in <module>
    from .vtkViewsInfovis import *
ImportError: DLL load failed while importing vtkViewsInfovis: 지정된 모듈을 찾을 수 없습니다.

The last sentence is written in Korean and it could be translated as “could not find the designated module”

This seems to be a problem with some changes that happened with Conda. Could you please try either the 6.4.2 release or the latest dev release?

Hi,
I think I have the same problem.
Until today, I used the previous version of ShapeWorks and I had no problem using the ShapeWorks library. Now, I have installed its new version, version 6.5, and when importing the library in Python, I get the error No module named ‘shapeworks’. What is the problem?
I do the installation steps according to the following site.

Is this on Windows, Mac, or Linux?

Can you check the output of the install_shapeworks step and see if there were any errors? With the conda environment loaded, does the following work?

$ python
import shapeworks


I am getting this error when try to import shapeworks. When I downgrade the type_extensions package to 4.13.2 I end up getting below error:

>>> import shapeworks
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sabe848/miniconda3/envs/shapeworks/lib/python3.9/site-packages/shapeworks/__init__.py", line 13, in <module>
    from .portal import download_dataset
  File "/home/sabe848/miniconda3/envs/shapeworks/lib/python3.9/site-packages/shapeworks/portal.py", line 16, in <module>
    from swcc.models import Dataset
  File "/home/sabe848/miniconda3/envs/shapeworks/lib/python3.9/site-packages/swcc/models/__init__.py", line 2, in <module>
    from .other_models import (
  File "/home/sabe848/miniconda3/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/sabe848/miniconda3/envs/shapeworks/lib/python3.9/typing.py", line 852, in __subclasscheck__
    return issubclass(cls, self.__origin__)
TypeError: issubclass() arg 1 must be a class

Any advice on fixing this? I am using Shapeworks 6.5.1 on Linux (ubuntu 24.04)

Can you try installing a different version of pydantic?

pip install pydantic==1.10.13

or

pip install pydantic==2.7.0