Simplifying Python Package Management in SAMSON: An Overview

For molecular modelers utilizing the power of Python within SAMSON, managing Python packages is a common and often critical task to streamline workflows and analyses. Whether you need specific libraries for computational tasks or require precise package versions for your projects, effective package management is key. Let’s dive into how SAMSON makes this process seamless.

Accessing the Python Package Manager

Managing Python packages in SAMSON starts with the Python Console. To access the Python Package Manager:

  • Open the Python Console by navigating to Interface > Python Console.
  • In the Python Console, go to Edit > Manage packages…, which will open the Python Package Manager window.

Here is what the Package Manager interface looks like:

Manage packages...

Installing Python Packages

Installing Python packages is straightforward in SAMSON:

  • In the Package Manager, type the name of the package you wish to install in the input field.
  • Click Install, and the Package Manager will use pip to fetch and install the package.

Benefit from familiar pip functionalities, such as:

  • Specifying package versions, e.g., foo==1.2.0 (for version 1.2.0).
  • Setting version constraints, e.g., foo>=2.1.0.
  • Adding pip flags, e.g., foo --upgrade to upgrade to the latest version.

If you need to manage a local Python package, SAMSON can handle that too:

  • Provide the path to the local package (it must contain the required files, like setup.py).
  • Select whether to install in editable mode, which is useful for active development on the package.
  • Click Install.

Package Manager: install a local Python package

Uninstalling Python Packages

Removing Python packages is just as simple:

  • Enter the name of the package you want to uninstall in the Package Manager.
  • Click Uninstall, and it will be removed from your environment.

Key Tips for Efficient Management

Here are some useful pointers to keep in mind:

  • For packages not available on PyPI, see the documentation on installing local packages.
  • If working on macOS and encountering issues with editable mode, try installing in non-editable mode or updating the sys.path with source file directories.

By leveraging SAMSON’s intuitive Python Package Manager, you can improve your workflow efficiency, unlock new possibilities with advanced libraries, and focus on your molecular modeling tasks without worrying about dependency hurdles.

To dive deeper into SAMSON’s scripting functionalities, visit the official scripting documentation.

SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.

Comments are closed.