Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
  • Welcome
  • Products
  • Support
  • About
  • More
  • Cancel
PLAXIS | SOILVISION
  • Product Communities
  • More
PLAXIS | SOILVISION
PLAXIS | SOILVISION Wiki How to install additional Python modules in PLAXIS
    • Sign in
    • -Geotechnical Analysis Wiki
      • +Geotechnical SELECT Entitlements [GSE]
      • -PLAXIS
        • +Software and License - PLAXIS
        • +Documentation - PLAXIS
        • -API / Python scripting - PLAXIS
          • Access to Staged Construction settings using Python
          • Adding functionality to PLAXIS Calculation Manager: pre- and post-processing
          • Automatic line cross-section chart generation using Python
          • Automatically generated cross-sections of embankments
          • Changing the material colour using Python scripting
          • Combined plate results in one chart using Python
          • Create custom connection with selection API
          • Export and format plots from PLAXIS Output using Python
          • How to create a tunnel using Python
          • How to get a load - displacement curve using Scripting interface
          • How to install additional Python modules in PLAXIS
          • How to open and close a PLAXIS project with Python
          • How to retrieve results from PLAXIS Output by the node number
          • Identify Python commands from Plaxis command line
          • Material lists in PLAXIS – Python
          • Material Property changes for Python scripting
          • Output scripting example: create curve data
          • Output scripting example: get anchor force
          • Output scripting example: get heave of excavation bottom
          • Output scripting example: get maximum bending moment
          • Polycurves to Polygons in PLAXIS 2D using Python
          • Receive instant notifications for finished calculations on your phone
          • Remove invalid custom connections for PLAXIS 3D
          • Retrieve coordinates of a Polygon in PLAXIS 2D using Python
          • Retrieving soil layer info from boreholes using Python
          • Scripting reference and how to use it
          • Selection API for PLAXIS Input
          • Soil layer material assignment using Python
          • Tunnel advancement script for PLAXIS 3D
          • User defined Python script (3D): Extract displacements by coordinates
        • +Known issues - PLAXIS
        • +Models - PLAXIS
        • +Tips and Tricks
        • +Publications
        • +Videos - PLAXIS
      • +PLAXIS LE
      • +PLAXIS Monopile Designer
      • +SOILVISION
      • +Subscription Entitlement Service
    • +Working from home with PLAXIS
    • +Working from home with PLAXIS LE

     
     Questions about this article, topic, or product? Click here. 

    How to install additional Python modules in PLAXIS

    Application PLAXIS 2D
    PLAXIS 3D
    Version PLAXIS 2D CONNECT Edition V20
    PLAXIS 3D CONNECT Edition V20
    Date created 13 October 2020
    Date modified 13 October 2020

    When using the PLAXIS scripting environment it is common to use Python modules allowing for extending the functionality of a Python script. An example of a Python module is easygui, which offers an easy-to-use interface for simple GUI interaction with the user.

    With PLAXIS CONNECT Edition a PLAXIS-Python Distribution is provided and stored in a dedicated versioned location within the ProgramData folder (see release notes for 2D and 3D), including various Python modules.

    This allows both PLAXIS 2D and PLAXIS 3D applications to access this shared distribution when using Python Scripting facilities, keeping all the modules up to date and fully compatible with PLAXIS.

    This article will explain the available options in PLAXIS applications on how to install and use any Python modules required when scripting.

    Using the modules in the installed PLAXIS-Python Distribution

    With the release of PLAXIS CONNECT Edition V20 Update 3, a separation is made of the deliverable Python environment: one that can be used for user-created Python scripts and the editor, and one trimmed down environment intended for all PLAXIS extensions implemented using Python language, e.g. the PLAXIS 2D to 3D converter and the structural Coupling tool, the parameter optimization tool for UDCAM-S constitutive model.

    The PLAXIS-Python Distribution includes various modules, such as easygui, matplotlib, numpy, pyperclip and it is placed in a dedicated versioned location within the ProgramData folder.
    By default, this is: C:\ProgramData\Bentley\Geotechnical\PLAXIS Python Distribution V1

    Using a custom Python distribution

    With PLAXIS CONNECT Edition V20 Update 3 it is possible to configure PLAXIS to use a custom Python version, which is installed in the computer. To do so, the following steps are required:

    1. Start the PLAXIS Input as administrator from Windows Start menu.
      This is important in order to have proper rights to proceed with installing the required PLAXIS modules in the custom Python directory.
    2. Go to menu option Expert > Python > Configure Python Interpreter, select the option Use the following Python interpreter and browse to the custom Python distribution folder
    3. Select the option to Install required components.
      This will make sure all required modules and files for PLAXIS scripting environment are installed in the custom Python directory.
    4. A popup window will provide information on the progress of the installation of the Python packages.

    Figure 1. Configure and use a custom Python distribution

    Note: changing to a different Python interpreter means that all options for Python, such as Run Python Script/Tool, Interpreter, Editor will use the custom Python interpreter as configured.

    Any errors encountered during the installation of the required components may be linked to the custom Python version.

    Install Python modules in the PLAXIS-Python Distribution

    It is possible to install various Python modules that are not already available in the PLAXIS-Python Distribution via the Command prompt window.

    To do so, the following steps are required:

    1. Start the PLAXIS Input as administrator from Windows Start menu.
      This is important in order to have proper rights to proceed with installing/updating any Python modules in the local Python directory.
      Note: you can also directly launch the Command prompt of Windows, and then move to step #3.
    2. Go to menu option Expert > Python > Command prompt
      This will open the familiar Windows Command prompt with the PLAXIS set as current directory.
    3. If needed, change directory to the PLAXIS-Python Distribution, where the Python packages are installed. This can be done by running the command:
      cd C:\ProgramData\Bentley\Geotechnical\PLAXIS Python Distribution V1\python\Lib\site-packages
    4. In the Command prompt you can now install any new Python modules using the command shown in the example below.
      For instance, if you want to install the pandas module:
      python -m pip install pandas

    Figure 2. Installing pandas module using the PLAXIS Command prompt

    Note that the installation of a Python module may require an updated version of another Python module. This may affect other modules that are available in the PLAXIS-Python Distribution, therefore, make sure to understand the changes made during the installation of any Python module.

    Using a Python Integrated Development Environment

    In the case that one of the various Python IDEs is used, such as PyCharm, Spyder, etc., the way of installing a Python module depends on each IDE.

    Note that it is important in all cases to provide administrative rights to the application in order to allow for installing Python modules in the selected Python environment.

    • PLAXIS 3D
    • python
    • API
    • Scripting
    • PLAXIS
    • Module
    • PLAXIS 2D
    • Share
    • History
    • More
    • Cancel
    • Stefanos Papavasileiou Created by Bentley Colleague Stefanos Papavasileiou
    • When: Tue, Oct 13 2020 6:20 AM
    • Stefanos Papavasileiou Last revision by Bentley Colleague Stefanos Papavasileiou
    • When: Tue, Feb 15 2022 6:11 AM
    • Revisions: 2
    • Comments: 0
    Recommended
    Related
    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2021 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies