How do I install the PyAnsys for Mechanical Simulation and set it up so I can work in Visual Studio?
I have recorded a video on this. This is Ansys INTERNAL ONLY!
Click here for the recording
UPDATE: The repository names have changed after the video was made.
Please use the following names while pip installing the repos.
pip install ansys-mapdl-core
pip install ansys-dpf-core
pip install ansys-dpf-post
To install and configure pyAnsys to work within visual studio you need to check you have the python workflow pack installed. Run the "Visual Studio Installer" tool and click "Modify" on your installation.
This may look different in other versions of Visual Studio (I use 2019).
You should now be able to open and edit python projects within Visual Studio, at this point we can configure the environment to run. I would strongly suggest using a virtual environment for any python development, it will help to minimise dependency issues (as Ayush mentions in his video above).
With a python project opened, click the dropdown next to the debug button and select "Add Environment...".
Give the environment a sensible name (convention is "venv" or "env") and select the base interpreter. If you have a project with a requirements.txt file then you can install dependencies from that, otherwise check the "View in Python Environments window".
The Python Environments window will open, click on the environment you created and click "Open in Powershell".
Open powershell in your project directory (you can shift + right-click to "Open powershell window here")
Create a virtual environment and activate it:
python -m venv ./venv
Currently there are three packages that make up the pyAnsys suite, run
At this point you can now import and use pyansys as in the documentation.