Setting up Python Scripting
In SAMSON, Python scripting relies on Python 3.9, which you need to install separately.
On Windows, we recommend using Anaconda to install Python and all required dependencies.
During the installation, make sure to check the option to add Anaconda3 to your PATH environment variables such that it could be found by SAMSON, see the image below:
If you have not opted for this option during the installation then after installation, you will need to modify your PATH environment variable to make Python accessible.
If you have installed Anaconda for all users (in admin mode), add the following paths:
If you have installed Anaconda for yourself only, add the following paths instead:
YourUserName should be replaced by your user name. Here is an example for user
For Linux, we recommend installing Python via Anaconda.
During the installation, the installer prompts “Do you wish the installer to initialize Anaconda3 by running conda init?” We recommend choosing “yes” such that it will be added into your PATH environment variable in your
If you chose not to initialize conda during the installation, then after installation you will need to initialize Anaconda3 (see here) and modify your PATH environment variable to make Python accessible. To do this, append the following line into your
YourUserName should be replaced by your user name.
On Mac OS, you will need Python v.3.9 and Jupyter QtConsole v.5.1.
Warning: The Python Scripting Extension might not work with the Anaconda installation on Mac OS due to a possible clash between the versions of Qt Framework used by SAMSON and the Qt library used by the Jupyter QtConsole provided by Anaconda.
If you have a single user or would like to install homebrew for all users, then you only have to run the following command:
– for x86_64 architecture:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
– for Apple M1 architecture specify to use homebrew for x86_64 architecture:
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
If you would like to install homebrew only for your user, please check out the Installation of homebrew in a local directory section below.
If you would like, you can update homebrew:
Now, to install Python 3.9 run the next command:
brew install email@example.com
After that, you may be asked to link the executable:
brew link firstname.lastname@example.org
To verify the version of Python run:
The pip3 package manager should be automatically installed with Python 3 by Homebrew.
Optionally, you may want to update pip3:
pip3 install --upgrade pip setuptools wheel
To be able to use Python Scripting in SAMSON, it’s necessary to install the following packages in the specified order:
pip3 install sip PyQt5==5.12.3 jupyter qtconsole
brew install pkg-config libpng freetype
pip3 install matplotlib
Mac OS: Installation of homebrew in a local directory
If you don’t have root privileges, you might follow the multiple installations instructions to install homebrew in your user’s directory. For example, to install it in the
~/homebrew directory execute the following commands in the terminal:
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
As suggested in the install script, add Homebrew to your
If you installed Homebrew for all users in a non-default folder (e.g., in
/opt/ ), then execute in the terminal (please modify the path to homebrew if necessary):
echo 'PATH=/opt/homebrew/bin/:$PATH' >> $HOME/.zprofile
If you installed Homebrew only for your user (e.g., in
~/homebrew), then execute in the terminal (please modify the path to homebrew if necessary):
echo 'PATH=$HOME/homebrew/bin/:$PATH' >> $HOME/.zprofile
Then restart your terminal – simply close and open it again.
If you have a mac with the Apple M1 architecture, please run:
arch -x86_64 brew update
arch -x86_64 brew install email@example.com
to use the x86_64 architecture.
Proceed with the next steps in the installation on mac OS section.
Please note that in the case of the installation of homebrew in a local or non-default folder, SAMSON might not be able to find the proper python and you might need to launch SAMSON from the terminal as follows:
Verifying your installation
To test the installation, you can try to open the Jupyter Qt Console by executing the next command in the terminal (for Windows: Anaconda terminal):
Now, you should be able to use Python Scripting in SAMSON. Launch SAMSON, and go to the Interface menu to start Python Scripting. You can also use the Apps menu (Apps > General > Python Scripting).
The Python Scripting console should appear after a few seconds of its initialization:
If neither option seems available, please verify that you properly specified the environment variables as described above.
Contact us if you experience any problems.