ansys / pydpf-core

Data Processing Framework - Python Core
http://dpf.docs.pyansys.com/
MIT License
69 stars 25 forks source link

OSError: exception: access violation reading 0x0000000000000030 #1120

Open junming1202 opened 1 year ago

junming1202 commented 1 year ago

Before submitting the issue

Description of the bug

Hi, I am simply trying out the DPF operator in scripting by following the first example in the pydpf documentation link below. Yet, I encountered error when trying to extract just the displacement field result. https://dpf.docs.pyansys.com/version/0.8/operator_reference_load.html

I started to encounter this issue after installing ANSYS 2023R2. My previous installation is ANSYS 2022 R1.

Steps To Reproduce

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import operators as ops
>>> my_file_path = r"file.rst"
>>> my_data_sources = dpf.DataSources(my_file_path)
>>> u_op = ops.result.displacement()
>>> u_op.inputs.data_sources.connect(my_data_sources)
>>> my_u = u_op.outputs.fields_container()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\junmisoh.AMD\AppData\Roaming\Python\Python310\site-packages\ansys\dpf\core\outputs.py", line 73, in __call__
    return self.get_data()
  File "C:\Users\junmisoh.AMD\AppData\Roaming\Python\Python310\site-packages\ansys\dpf\core\outputs.py", line 70, in get_data
    return self._operator.get_output(self._pin, type_output)
  File "C:\Users\junmisoh.AMD\AppData\Roaming\Python\Python310\site-packages\ansys\dpf\core\dpf_operator.py", line 494, in get_output
    parameters = {type_tuple[2]: type_tuple[1](self, pin)}
  File "C:\Users\junmisoh.AMD\AppData\Roaming\Python\Python310\site-packages\ansys\dpf\gate\generated\operator_capi.py", line 402, in operator_getoutput_fields_container
    res = capi.dll.Operator_getoutput_FieldsContainer(op._internal_obj if op is not None else None, utils.to_int32(iOutput), ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
OSError: exception: access violation reading 0x0000000000000030

Which Operating System causes the issue?

Windows

Which DPF/Ansys version are you using?

Ansys 2023 R2

Which Python version causes the issue?

3.10

Installed packages

Package Version


ansys-dpf-core 0.9.0 ansys-dpf-gate 0.4.1 ansys-dpf-gatebin 0.4.1 ansys-grpc-dpf 0.8.1 cachetools 5.3.1 certifi 2023.7.22 charset-normalizer 3.2.0 cli2gui 2022.3 colorama 0.4.6 et-xmlfile 1.1.0 getostheme 2021 google-api-core 2.11.1 google-api-python-client 2.95.0 google-auth 2.22.0 google-auth-httplib2 0.1.0 googleapis-common-protos 1.60.0 grpcio 1.56.2 httplib2 0.22.0 idna 3.4 importlib-metadata 6.8.0 joblib 1.3.1 numpy 1.25.2 openpyxl 3.1.2 packaging 23.1 pandas 2.0.3 Pillow 9.5.0 pip 22.3.1 protobuf 4.23.4 psutil 5.9.5 pyasn1 0.5.0 pyasn1-modules 0.3.0 pyparsing 3.1.1 PyQt5 5.15.9 PyQt5-Qt5 5.15.2 PyQt5-sip 12.12.2 PySimpleGUI 4.60.5 python-dateutil 2.8.2 pytz 2023.3 PyYAML 6.0.1 requests 2.31.0 rsa 4.9 scikit-learn 1.3.0 scipy 1.11.1 setuptools 65.5.0 six 1.16.0 threadpoolctl 3.2.0 tqdm 4.65.0 tzdata 2023.3 uritemplate 4.1.1 urllib3 1.26.16 zipp 3.16.2

PProfizi commented 1 year ago

Hi @junming1202,

You have installed Ansys 2023 R2 locally, but have you uninstalled Ansys 2022 R1? It could potentially be a mix-up in which version DPF is trying to use. Could you please report the result when running this script:

from ansys.dpf import core as dpf

server = dpf.start_local_server()
print(server.version)

It will let me know if the problem comes from DPF not using the latest Ansys installation on your computer.

junming1202 commented 1 year ago

Hi @PProfizi, no, I have not uninstalled ANSYS 2022 R1 as I still need to use it. The dpf server version is 6.2 after running the script.

from ansys.dpf import core as dpf server = dpf.start_local_server() print(server.version) 6.2

PProfizi commented 1 year ago

Hi @junming1202, so it seems DPF does use the right Ansys installation as 6.2 is the DPF server version shipped with Ansys 2023R2. Have you tried running the first example of the repository? Do you get the same error? Looking at your script I do not see anything that would break by switching to 2023R2. Knowing if this error happens when trying to run the PyDPF-Core examples would let me know if the problem comes from DPF or for some reason from the file or your script.