Configure PyCharm and Visual Studio Code for your PLAXIS automations


 

Application PLAXIS 2D
PLAXIS 3D
Version PLAXIS 2D CONNECT Edition and later
PLAXIS 3D CONNECT Edition and later
Date created 4 October 2024
Date modified 4 October 2024
Original author Stefanos Papavasileiou - Technical Support Group
Keywords PLAXIS, Python, PyCharm, Visual Studio, IDE, scripting, automation, custom

In this article you will learn how to configure PyCharm (JetBrains) and Visual Studio Code (Microsoft) to empower you with an advanced IDE (integrated development environment) when running PLAXIS automations.

Most of the advanced IDEs require similar steps to properly configure which Python distribution to use when running the code. Always refer to the application's documentation to learn how to configure your IDE properly.

Note that PLAXIS provides with every installation the SciTE application, which is a simple editor that can be used to run PLAXIS Python automations. 
You can find SciTe under Expert > Python > Editor… menu option. 
Remember to save your Python scripts as *.py files before you hit Tools > Go (F5).

Check here for information about Using PLAXIS Remote scripting with the Python wrapper.

 

Configure PyCharm

General steps for configuration

1.    Start the PyCharm application.
2.    Visit the documentation for PyCharm on the subject of how to “Configure a Python interpreter”: https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html
3.    Make sure to select the System interpreter option as explained here: https://www.jetbrains.com/help/pycharm/configuring-local-python-interpreters.html 

Add the PLAXIS Python Distribution

4.    Browse to the directory: C:\ProgramData\Seequent
       and select the PLAXIS Python Distribution V3 (for PLAXIS 2024.2) or V2 (for older versions).
       You can ignore the Internal Distribution as this is used by PLAXIS tools.
5.    Navigate inside the python folder and select python.exe by pressing on OK.
6.    Press again OK on Python Interpreters window and make sure it is selected in your Settings window for the current project.
7.    Done! Your Python script should use the Python distribution PLAXIS to run your automation.

Use a custom Python distribution

To avoid conflicts with the Python modules which PLAXIS is using (encryption, security, etc.), you are advised to use the same Python version as the one PLAXIS delivers.

For example, in PLAXIS 2024.2 the Python version is 3.12.3.

To find the Python version PLAXIS is using, you can go to Expert > Python > Interpreter and check the version mentioned in the first lines in the Python console window.

python_interpreter_show_version.png

The steps for installing the required components (modules) in the custom Python distribution and using it with PyCharm are:

8.      Find the PLAXIS Input application via Windows Start and select Run as administrator.
9.      Start a new project and open the Expert > Python > Configure Python interpreter menu option.
10.    In the Configure window, select the Use the following Python interpreter option, and Browse to the directory of the python.exe file from your custom Python distribution:

configure_python_interpreter_dialog.png

11.    Click on Install required components.

configure_python_interpreter_dialog_2.png

12.    A prompt window will inform you that all necessary packages have been successfully installed. 

installation_python_modules_success.png

13.    Switch back to the PyCharm application.
14.    Follow steps 2-3 to search for specifying the interpreter and browse to the python.exe file in your computer for your custom Python distribution.
15.    Press again OK on Python Interpreters window and make sure it is selected in your Settings window for the current project.
16.    Done! Your Python script should use the custom Python distribution to run your automation with the required components from PLAXIS.

 

Configure Visual Studio Code

General steps for configuration

1.    Start the Visual Studio Code application.
2.    Visit the documentation for Visual Studio Code on the subject of “Working with Python interpreter”: https://code.visualstudio.com/docs/python/environments#_working-with-python-interpreters
3.    Make sure to check the “Manually specify an interpreter” section: https://code.visualstudio.com/docs/python/environments#_manually-specify-an-interpreter 

Add the PLAXIS Python Distribution

4.    Browse to the directory: C:\ProgramData\Seequent
and select the PLAXIS Python Distribution V3 (for PLAXIS 2024.2) or V2 (for older versions).
You can ignore the Internal Distribution as this is used by PLAXIS tools.
5.    Navigate inside the python folder and select python.exe.
6.    Done! Your Python script should use the Python distribution PLAXIS to run your automation.

Use a custom Python distribution

To avoid conflicts with the Python modules which PLAXIS is using (encryption, security, etc.), you are advised to use the same Python version as the one PLAXIS delivers.

For example, in PLAXIS 2024.2 the Python version is 3.12.3.

To find the Python version PLAXIS is using, you can go to Expert > Python > Interpreter and check the version mentioned in the first lines in the Python console window.

python_interpreter_show_version.png

The steps for installing the required components (modules) in the custom Python distribution and using it with Visual Studio Code are:

7.    Find the PLAXIS Input application via Windows Start and select Run as administrator.
8.    Start a new project and open the Expert > Python > Configure Python interpreter menu option.
9.    In the Configure window, select the Use the following Python interpreter option, and Browse to the directory of the python.exe file from your custom Python distribution:

configure_python_interpreter_dialog.png

10.    Click on Install required components.

configure_python_interpreter_dialog_2.png

11.    A prompt window will inform you that all necessary packages have been successfully installed.

installation_python_modules_success.png

12.    Switch back to the Visual Studio Code application.
13.    Follow steps 2-3 to search for specifying the interpreter and browse to the python.exe file in your computer for your custom Python distribution.
14.    Done! Your Python script should use the custom Python distribution to run your automation with the required components from PLAXIS.

 

See also