Skip to content

CAD import failed - ImportError: DLL load failed while importing PyFM #929

Open
@Guilladeb

Description

@Guilladeb

🔍 Before submitting the issue

  • I have searched among the existing issues
  • I am using a Python virtual environment

🐞 Description of the bug

Hello!
I'm having difficulties trying to run the block model example. It seems i'm unable to load the CAD with mesh_util read.

https://prime.docs.pyansys.com/version/stable/examples/gallery_examples/gallery/00_lucid_file_IO.html#sphx-glr-examples-gallery-examples-gallery-00-lucid-file-io-py

I'm currently using py3.11.9 in a virtual environment, with ansys 2024R2 and py prime mesh 0.6.2. I'm on windows10.0.19045 pro.
I used the ProductConfig.exe script in the ansys files to configure CAD readers, and i can successfully read the example in SpaceClaim.

I tried investigating, and i launched the prime server without the launch_prime() function (using a cmd, calling the runPrime.bat) and i noticed the server correctly booting, but as soon as i run the example script on Python, trying to connect to the server and read the geometry; the server crashes saying "the DLL load failed while importing PyFM: the OS cannot execute %1". As soon as this error arises on the server prompt, i get the import CAD failed error in my python script.
I also encountered the same problem with some of my coworkers.
Do you have, by any chance, any idea where this could be coming from? Thank you very much

📝 Steps to reproduce

  1. First in a cmd prompt: "%AWP_ROOT242%\meshing\Prime\runPrime.bat" server

which shows:
C:\Users\Guillaume>"%AWP_ROOT242%\meshing\Prime\runPrime.bat" server
Welcome to Ansys Prime Meshing (2024R2)
Copyright 1987 - 2024 ANSYS,Inc. All Rights Reserved.
Starting Ansys Prime Server...
Server listening on : 127.0.0.1:50055

  1. then i try running with python:
    import ansys.meshing.prime as prime

prime_client = prime.Client(ip="127.0.0.1", port=50055)
model = prime_client.model
mesh_util = prime.lucid.Mesh(model=model)

mesh_util.read(file_name="D:\MEC8370\PyPrimeMesh\test PyPrimeMesh 3\pyprime_block_import.scdoc")

print(model)

  1. On the cmd prompt i used to launch the prime server, the error arises:
    C:\Users\Guillaume>"%AWP_ROOT242%\meshing\Prime\runPrime.bat" server
    Welcome to Ansys Prime Meshing (2024R2)
    Copyright 1987 - 2024 ANSYS,Inc. All Rights Reserved.
    Starting Ansys Prime Server...
    Server listening on : 127.0.0.1:50055
    Traceback (most recent call last):
    File "C:\Users\GUILLA~1\AppData\Local\Temp\pyprime1730384592775038_cad_import_script.py", line 5, in
    from ansys.FM import FM
    File "D:\ANSYS Inc\v242\meshing\Prime\ansys\FM\FM.py", line 54, in
    import PyFM
    ImportError: DLL load failed while importing PyFM: Le système d’exploitation ne peut pas exécuter %1.
    (which is french for "the OS cannot execute %1)

Image

  1. The python scripts immediately crashes afterwards, with this error:
    Traceback (most recent call last):
    File "d:\MEC8370\PyPrimeMesh\test PyPrimeMesh 3\test.py", line 8, in
    mesh_util.read(file_name=r"D:\MEC8370\PyPrimeMesh\test PyPrimeMesh 3\pyprime_block_import.scdoc")
    File "D:\MEC8370\PyPrimeMesh\test PyPrimeMesh 3\virtualenviro\Lib\site-packages\ansys\meshing\prime\lucid\mesh_util.py", line 114, in read
    prime.FileIO(self._model).import_cad(
    File "D:\MEC8370\PyPrimeMesh\test PyPrimeMesh 3\virtualenviro\Lib\site-packages\ansys\meshing\prime\core\fileio.py", line 586, in import_cad
    import_result = super().import_cad(temp_file_name, params)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "D:\MEC8370\PyPrimeMesh\test PyPrimeMesh 3\virtualenviro\Lib\site-packages\ansys\meshing\prime\autogen\fileio.py", line 692, in import_cad
    result = self._comm.serve(self._model, command_name, self._object_id, args=args)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "D:\MEC8370\PyPrimeMesh\test PyPrimeMesh 3\virtualenviro\Lib\site-packages\ansys\meshing\prime\internals\error_handling.py", line 577, in wrapper_error_code
    raise PrimeRuntimeError(
    ansys.meshing.prime.internals.error_handling.PrimeRuntimeError: CAD import failed.

Image

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

2024R2

🐍 Which Python version are you using?

3.11

📦 Installed packages

ansys-meshing-prime==0.6.2

about-time==4.2.1
alive-progress==3.2.0
ansys-api-fluent==0.3.28
ansys-api-platform-instancemanagement==1.1.0
ansys-api-tools-filetransfer==0.1.0
ansys-fluent-core==0.26.1
ansys-fluent-visualization==0.14.0
ansys-platform-instancemanagement==1.1.2
ansys-tools-filetransfer==0.1.0
ansys-units==0.3.2
beartype==0.19.0
certifi==2024.8.30
charset-normalizer==3.4.0
click==8.1.7
colorama==0.4.6
contourpy==1.3.0
cycler==0.12.1
docker==7.1.0
fonttools==4.54.1
grapheme==0.6.0
grpcio==1.67.0
grpcio-health-checking==1.62.3
idna==3.10
importlib_metadata==8.5.0
joblib==1.4.2
kiwisolver==1.4.7
lxml==5.3.0
matplotlib==3.9.2
nltk==3.9.1
numpy==1.26.4
packaging==24.1
pandas==2.2.3
pillow==11.0.0
platformdirs==4.3.6
pooch==1.8.2
protobuf==4.25.5
psutil==6.1.0
pyparsing==3.2.0
PySide6==6.7.3
PySide6_Addons==6.7.3
PySide6_Essentials==6.7.3
python-dateutil==2.9.0.post0
pytz==2024.2
pyvista==0.44.1
pyvistaqt==0.11.1
pywin32==308
PyYAML==6.0.2
QtPy==2.4.1
regex==2024.9.11
requests==2.32.3
scipy==1.14.1
scooby==0.10.0
shiboken6==6.7.3
six==1.16.0
tqdm==4.66.6
typing_extensions==4.12.2
tzdata==2024.2
urllib3==2.2.3
vtk==9.3.1
zipp==3.20.2
about-time==4.2.1
alive-progress==3.2.0
ansys-api-fluent==0.3.28
ansys-api-meshing-prime==0.1.3
ansys-api-platform-instancemanagement==1.1.0
ansys-api-tools-filetransfer==0.1.0
ansys-fluent-core==0.26.1
ansys-fluent-visualization==0.14.0
ansys-meshing-prime==0.6.2
ansys-platform-instancemanagement==1.1.2
ansys-tools-filetransfer==0.1.0
ansys-units==0.3.2
appdirs==1.4.4
beartype==0.19.0
certifi==2024.8.30
charset-normalizer==3.4.0
click==8.1.7
colorama==0.4.6
contourpy==1.3.0
cycler==0.12.1
docker==7.1.0
fonttools==4.54.1
grapheme==0.6.0
grpcio==1.67.0
grpcio-health-checking==1.62.3
idna==3.10
importlib_metadata==8.5.0
joblib==1.4.2
kiwisolver==1.4.7
lxml==5.3.0
matplotlib==3.9.2
nltk==3.9.1
numpy==1.26.4
packaging==24.1
pandas==2.2.3
pillow==11.0.0
platformdirs==4.3.6
pooch==1.8.2
protobuf==4.25.5
psutil==6.1.0
pyparsing==3.2.0
PySide6==6.7.3
PySide6_Addons==6.7.3
PySide6_Essentials==6.7.3
python-dateutil==2.9.0.post0
pytz==2024.2
pyvista==0.44.1
pyvistaqt==0.11.1
pywin32==308
PyYAML==6.0.2
QtPy==2.4.1
regex==2024.9.11
requests==2.32.3
scipy==1.14.1
scooby==0.10.0
shiboken6==6.7.3
six==1.16.0
tqdm==4.66.6
typing_extensions==4.12.2
tzdata==2024.2
urllib3==2.2.3
vtk==9.3.1
zipp==3.20.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions