ansys / pydpf-core

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

ansys.grpc.dpf cannot import support_service_pb2_grpc #473

Closed ThomasEnzingerRB closed 2 years ago

ThomasEnzingerRB commented 2 years ago

Before submitting the issue

Description of the bug

Loading a resut file (ANSYS 2021 R2, mechanical, static) and print statistics runs into following error


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\abc\AppData\Roaming\Python\Python37\site-packages\ansys\dpf\post\dpf_solution.py", line 100, in __str__
    txt += self._model.__str__()
  File "C:\Users\abc\AppData\Roaming\Python\Python37\site-packages\ansys\dpf\core\model.py", line 203, in __str__
    txt += str(self.metadata.time_freq_support)
  File "C:\Users\abc\AppData\Roaming\Python\Python37\site-packages\ansys\dpf\core\errors.py", line 103, in wrapper
    out = func(*args, **kwargs)
  File "C:\Users\abc\AppData\Roaming\Python\Python37\site-packages\ansys\dpf\core\model.py", line 338, in time_freq_support
    0, types.time_freq_support
  File "C:\Users\abc\AppData\Roaming\Python\Python37\site-packages\ansys\dpf\core\dpf_operator.py", line 373, in get_output
    out = output_type(**parameters, server=self._server)
  File "C:\Users\abc\AppData\Roaming\Python\Python37\site-packages\ansys\dpf\core\time_freq_support.py", line 45, in __init__
    super(TimeFreqSupport, self).__init__(support=time_freq_support, server=server)
  File "C:\Users\abc\AppData\Roaming\Python\Python37\site-packages\ansys\dpf\core\support.py", line 55, in __init__
    self._support_api.init_support_environment(self)  # creates stub when gRPC
  File "C:\Users\abc\AppData\Roaming\Python\Python37\site-packages\ansys\dpf\gate\errors.py", line 38, in wrapper
    out = func(*args, **kwargs)
  File "C:\Users\abc\AppData\Roaming\Python\Python37\site-packages\ansys\dpf\gate\support_grpcapi.py", line 17, in init_support_environment
    from ansys.grpc.dpf import support_service_pb2_grpc
ImportError: cannot import name 'support_service_pb2_grpc' from 'ansys.grpc.dpf' (C:\Users\abc\AppData\Roaming\Python\Python37\site-packages\ansys\grpc\dpf\__init__.py)

### Steps To Reproduce

ANSYS 2021 R2 local installed

```python
from ansys.dpf import post
from ansys.dpf.post import common

import os.path as Path

exampleRST = Path.join("C:\\Temp", "file.rst")
solution = post.load_solution(exampleRST,
    physics_type=common._PhysicsType.mechanical,
    analysis_type=common._AnalysisType.static)
print(solution)

### Which Operating System are you using?

Windows

### Which Python version are you using?

3.7

### Installed packages

ansys-dpf-core==0.6.0
ansys-dpf-gate==0.2.1
ansys-dpf-gatebin==0.2.1
ansys-dpf-post==0.2.4
ansys-grpc-dpf==0.3.0
astroid==2.7.3
cachetools==5.2.0
certifi==2022.6.15
charset-normalizer==2.1.1
colorama==0.4.4
cycler==0.11.0
fonttools==4.30.0
gmsh==4.9.5
google-api-core==2.10.0
google-api-python-client==2.60.0
google-auth==2.11.0
google-auth-httplib2==0.1.0
googleapis-common-protos==1.56.4
grpcio==1.48.1
httplib2==0.20.4
idna==3.3
importlib-metadata==4.12.0
isort==5.9.3
kiwisolver==1.4.0
lazy-object-proxy==1.6.0
matplotlib==3.5.1
mccabe==0.6.1
numpy==1.21.5
packaging==21.3
pandas==1.3.5
Pillow==9.0.1
platformdirs==2.3.0
protobuf==3.20.0
psutil==5.9.2
pyasn1==0.4.8
pyasn1-modules==0.2.8
pylint==2.10.2
pyparsing==3.0.7
python-dateutil==2.8.2
pytz==2021.3
requests==2.28.1
rsa==4.9
scipy==1.7.3
scooby==0.6.0
six==1.16.0
toml==0.10.2
tqdm==4.64.1
typed-ast==1.4.3
typing-extensions==3.10.0.2
uritemplate==4.1.1
urllib3==1.26.12
wrapt==1.12.1
zipp==3.8.1
PProfizi commented 2 years ago

Hi @ThomasEnzingerRB, thank you for bringing this up. There is indeed a problem of compatibility between the latest PyDPF-Core 0.6.0 release and Ansys 212 + ansys-grpc-dpf 0.3.0. Fixing this now, it will be available with 0.6.1 which we will release as soon as possible. In the meantime, you can just downgrade your core package to 0.5.2 with pip install ansys-dpf-core==0.5.2. It should work with all the other latest packages.

Ornold commented 2 years ago

@PProfizi: Thank you for the comment! It helped a lot!

PProfizi commented 2 years ago

@Ornold Happy to help! Closing this issue since the fix has been merged.