Skip to main content

Installation Guide

Installing Python

If you don't already have Python, download and install Python.

The SDK officially supports Python versions 3.10, 3.11, 3.12 and 3.13

We strongly suggest working in a virtual environment when installing the SDK. See "Setting up a Virtual Environment".

Installing Python on Windows:

Option A: Use WSL

We recommend using Ubuntu with WSL on Windows. With that setup, follow the instructions on how to install on Linux.

Option B: Installing Python on Windows

You can either install python via the Microsoft Store or download python from www.python.org. On Windows we currently recommend version 3.12 for PyVista support.

Option C: Installing Python using Anaconda:

Install Anaconda from https://docs.anaconda.com/free/anaconda/install/windows/.

Install Python on Linux (Ubuntu):

You can either install Python using the Ubuntu package manager or using Miniconda.

Option A: Using Ubuntu package manager

Different version of Ubuntu ship with different python versions. You can check the version available for your Ubuntu by doing:

sudo apt update
apt show python3

If the Version value displayed is 3.13, 3.12, 3.11 or 3.10 you can install python by doing

sudo apt install python3 python3-pip python3-venv

If the version value is lower or higher than the supported python version you will need to add a PPA which provides supported python versions f.ex. the deadsnakes PPA:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.13 python3.13-venv

Option B: Using Miniconda

Install Miniconda from https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html.

Install python on MacOS:

Check the version of Python installed by running the following in a terminal

python3 --version

If the version is less than 3.10, download Python from http://www.python.org and install. We currently recommend Python 3.12 on Mac for PyVista support.


Setting up a Virtual Environment

We strongly recommend using a virtual environment when installing the SDK to keep dependencies isolated.

You can create and manage virtual environments using either Python's built-in venv module or Conda.

The virtual environment can be placed anywhere you want but we recommend placing it under ~/.venv/TrebleSDK.

Using Linux:

To create and activate a virtual environment named TrebleSDKEnv:

python3 -m venv ~/.venv/TrebleSDK
source ~/.venv/TrebleSDK/bin/activate

Using Windows (PowerShell)

python -m venv C:\venv\TrebleSDK
C:\venv\TrebleSDK\Scripts\Activate.ps1

Using Conda

conda create -n TrebleSDKEnv python=3.12
conda activate TrebleSDKEnv

To deactivate the virtual environment

deactivate

Installing the SDK package

The SDK depends on a package called Rhino3dm for model import/export, we suggest users install it from a whl file (using pip install) before the SDK to prevent pip trying to build the Rhino3dm library from source. Please see notes in Appendix Installing the rhino3dm dependency

To install the SDK and it's dependencies, save the whl file on your working directory and run:

pip install treble_tsdk-<VERSION>-py3-none-any.whl

Installing optional dependencies

For a smoother experience when running the examples in the Jupyter notebooks provided you may want to install these additional packages: A Jupyter notebook kernel:

pip install notebook

If you need pyvista plotting in-line in the notebooks install the following packages:

pip install trame trame-vuetify trame-vtk pythreejs

Opening the example notebooks

Using VSCode

Open the notebook in VSCode, code will suggest installing the "Python" extension if it's missing.

  • Press the "Select interpreter" button if visible at the bottom of the window. Choose the Python executable with the SDK installed.
  • Press the "Select kernel" button, if you're missing a kernel the "Jupyter" extension VSCode will suggest installing it.
    • Now under the "Select Kernel" dialog choose "Python Environments". Select the python environment with the SDK installed. Now you should be ready to run the examples provided in the Jupyter notebooks using VSCode.

Now you should be ready to run the examples provided in the Jupyter notebooks using VSCode.

Using jupyter web UI

You can also run the Jupyter notebook using the jupyter-notebook command provided by the notebook python package. Within your python environment run this command:

jupyter-notebook

Which will open up a browser with a window into your directory structure from the directory where you ran the command. From there you can either create a new notebook or open an existing one.


Appendix: Installing the rhino3dm dependency

The SDK depends on a package called Rhino3dm for model import/export, we suggest users install it from a whl file (using pip install) before the SDK to prevent pip trying to build the Rhino3dm library from source.

The whl files can be found here: https://pypi.org/project/rhino3dm/#files. Find the correct file for your operating system and version of Python and then install with

pip install <downloaded-wheel-file>

If there are no whl files available for your OS+Python combo you will need to install the build dependencies of Rhino3dm.

On ubuntu this can be done using the following commands:

sudo apt install cmake build-essential