Skip to content
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

The bug in launcher.py is in the launch_grpc function, which defaults to the system’s Python path. #559

Open
2 tasks done
agvarghe opened this issue Nov 5, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@agvarghe
Copy link

agvarghe commented Nov 5, 2024

🔍 Before submitting the issue

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

🐞 Description of the bug

While working on the on application, its observed that pydyna pre doesnt launch since it considers the python defined in the system defaults.

I observe the following error
Traceback (most recent call last):
File "C:\Users\agvarghe\AppData\Roaming\PYDYNA\ansys-pydyna-pre-server\kwserver.py", line 7, in
import grpc
ModuleNotFoundError: No module named 'grpc'

The reason is observed to be due to line
https://github.com/ansys/pydyna/blob/6c05ae71c45e74f733cffa3c559efefdfebe813e/src/ansys/dyna/core/pre/launcher.py#L139C22-L139C60
here , it would be nice if we replace with
subprocess.Popen(f"{sys.executable} kwserver.py", cwd=server_path, shell=True,)

📝 Steps to reproduce

  1. Prepare a simple pydyna pre script
  2. Launch the script using a subprocess on a virtual env ,

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

2024R2

🐍 Which Python version are you using?

3.10

📦 Installed packages

aiofiles==23.2.1
aiohappyeyeballs==2.4.0
aiohttp==3.10.5
aiomysql==0.2.0
aioshutil==1.5
aiosignal==1.3.1
aiosqlite==0.19.0
alabaster==0.7.16
altgraph==0.17.4
annotated-types==0.7.0
ansys-api-dbu==0.3.0
ansys-api-dyna==0.3.6
ansys-api-geometry==0.4.1
ansys-api-meshing-prime==0.1.2
ansys-api-platform-instancemanagement==1.1.0
ansys-bdm-api==0.1.dev15
ansys-bdm-shared-volume==0.1.dev11
ansys-dpf-core==0.12.1
ansys-dyna-core==0.4.15

@agvarghe agvarghe added the bug Something isn't working label Nov 5, 2024
@thesct22
Copy link

thesct22 commented Nov 5, 2024

This happens when launching a script using "/path/to/venv/Scripts/python script.py" which in turn launches this script using subprocess. If you activate the venv and then run the script it works fine. However, it is expected to work in both cases, so changing hard-coded "python" in scripts to using sys.executable would be preferred if the expected outcome is to use the same python for both cases.

@zhangzhanqun
Copy link
Contributor

Hi @agvarghe, Thank you for your information, it is very helpful, now I am trying to update pydyna according to your three suggestions(issue 559,432,564), I will keep you updated on any progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants