Installing Python on your own computer¶
To run Python projects on your own computer, you will need to:
- Install Python and a virtual environment manager
- Install a C-compiler (optional, only needed for modeling courses)
Install Python¶
We strongly recommend installing Python via uv, a modern Python package and project manager that handles Python versions, virtual environments, and dependencies all in one tool. This is the approach we support and can help you with.
Alternative environment managers
While we document other environment management approaches (pipenv, venv) in our virtual environments guide, please note that we can only provide support for uv-based installations. If you choose to use other tools, you'll need to troubleshoot issues on your own.
Windows might redirect python to the windows store
If you are running Windows 10 1905 or newer, you might need to disable the built-in Python launcher via Start > "Manage App Execution Aliases" and turning off the "App Installer" aliases for Python
Install uv using winget (available on most recent Windows versions):
winget install --id=astral-sh.uv -e
Then install Python 3.14:
uv python install 3.14
Install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh
Then install Python 3.14:
uv python install 3.14
⚠️ Note: macOS comes with Python pre-installed, but we strongly recommend using uv to install Python rather than using the system Python. The system Python is often outdated and modifying it can cause system issues.
Install uv via your package manager, or use curl:
curl -LsSf https://astral.sh/uv/install.sh | sh
Then install Python 3.14:
uv python install 3.14
⚠️ Note: Most Linux distributions come with Python pre-installed, but we strongly recommend using uv to install Python rather than using the system Python. This avoids conflicts with system packages and allows you to use different Python versions for different projects.
Installing a C-compiler¶
When doing modeling (e.g. in thesis work), you can achieve much faster simulations by compiling models to C-code. This requires a C-compiler.
The full official Windows instructions are available here, but in short you can either install the smaller standalone compiler (Build Tools for Visual Studio 2022/2019), or the full version of visual studio. We recommend using the standalone compiler.
On most modern Windows installations, you can download and install the compiler needed via winget. Open a powershell (or Windows terminal) shell and run
winget install Microsoft.VisualStudio.2022.Community --override "--wait --quiet --add ProductLang En-us --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended"
Note that the installation will take a long time without much feedback, so have patience. Also note that you will likely get a popup asking for elevated permissions.
Alternatively, you can download the Build Tools for Visual Studio 2022/2019 installer, and run it. Make sure to install Desktop development with C++ or alternatively the C++ build tools and ensure the latest versions of MSVCv143 - VS 2022 C++ x64/x86 build tools and Windows 10 SDK.
Download the full version installer of Visual Studio, make sure to install Python development, Python native development tools, and Windows SDK (which can be found under Native development).
Also, make sure that you install Desktop development with C++ and make sure that the latest version of MSVC is checked. You might have to open the visual studio installer again and "modify" the installation to check if the compiler is installed.
If the installer doesn't detect your toolset version, Set $env:PlatformToolset before building.
Xcode tools typically require a recent macOS version
Installing Xcode tools typically requires an up-to-date macOS version. If you're running an older macOS version, you may need to update your system first, or the installation may fail or install outdated tools.
Minimal command line tools install (recommended)¶
To get a C-compiler, it is typically enough with the Xcode command line tools. You can get these by opening a new terminal and running:
xcode-select --install
A popup should appear, follow the instructions. The installation might take a while, so have patience. You can can test that the installation worked by running clang --version in a terminal. For a more extensive test, see below.
The full Xcode install¶
If this did not work, you might need the full Xcode from the app store. After installation, start Xcode and agree to the license agreement.
You probably already have a compiler available, otherwise install e.g. gcc through your package manager.
Verifying the installation¶
The easiest way to verify that Python and the C-compiler are installed correctly is to use the SUND toolbox's built-in test:
uv run --with sund python -c "import sund; sund.test_distribution()"
Successful output:
================================================================================
✅ DISTRIBUTION TEST PASSED: All sund modules imported successfully, and model simulation completed without errors.
================================================================================