How to install/use PyAnsys in Mechanical CPython console?

Best Answer
-
pyansys
isn't installed by default in the Mechanical CPython scripting console. The user has topip install
it manually.Please use the following steps:
- Open command prompt as an administrator.
- Execute the command to download and install
pyansys
from https://pypi.org/project/pyansys/:
"C:\Program Files\ANSYS Inc\v211\commonfiles\CPython\3_7\winx64\Release\python\python.exe" -m pip install pyansys
- Restart Mechanical and check if the installation is successful.
In case you get the following error:
ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject
It should be resolved by upgrading the
numpy
version shipped with the default Ansys WB 2021R1 installation. Execute the following command in the command prompt to upgradenumpy
"C:\Program Files\ANSYS Inc\v211\commonfiles\CPython\3_7\winx64\Release\python\python.exe" -m pip install -U numpy
4
Answers
-
@Ayush Kumar Can you update the link in the first line:
0 -
@M Thanks for pointing out, setting up the environment variable is not needed anymore.
0 -
So one can open a CPython console in Mechanical? I though it was just IronPython?
0 -
@ChrisC There is actually a beta option to use CPython in Mechanical. From the WB project page go to tools / options / appearance / and turn on beta options. Then also in tools / option go to the "Mechanical" section and activate the option to use CPython in Mechanical. As this is a beta option, there is no documentation, no support on using it, and no guarantee that it will work.
0