Installation#

Important

To install this package, ensure that you are using one of the supported Python versions Supported Python versions

There are several ways in which you can install sdf_xarray. If you are unfamiliar with Python, follow the guide below. If you are already familiar with Python and pip then you can install this using the following.

Install sdf-xarray from PyPI with:

pip install sdf-xarray

or download this code locally:

git clone --recursive https://github.com/epochpic/sdf-xarray.git
cd sdf-xarray
pip install .

New to Python?#

Installing uv#

We recommend installing uv which is a command line tool that can install both Python versions and packages. This tool is widely used in the Python community and is significantly faster than other tools that do the same.

curl -LsSf https://astral.sh/uv/install.sh | sh
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

You might need to change the execution policy to allow running a script from the internet.

You can then check uv is correctly installed by running:

uv --version

Installing Python#

If Python is already installed on your system then uv will detect and use it. If you don’t have python already installed on your machine you can use uv to install it:

uv python install 3.14

Once installed, it should be possible to run Python using

python3.14 --version

Setting up a virtual environment#

Now that you’ve installed uv and have a supported Python version you need to create a virtual environment. You need to do this because Python doesn’t allow you to install libraries globally on your system. From a folder of your choosing run the following command to create a subfolder called .venv containing all the Python libraries you install.

uv venv

Depending on your operating system you’ll need to follow the activation command that appears after running uv venv. This will tell Python to use the libraries installed in this package.

Installing sdf-xarray#

Finally we can install sdf_xarray to the venv using the following command. Any additional packages that can be installed using pip can also be installed using this method.

uv pip install sdf-xarray

Getting an error about a missing CMAKE_C_COMPILER?#

Are you getting an error that looks like this?

$ uv pip install sdf-xarray
Resolved 16 packages in 293ms
  x Failed to build `sdf-xarray==0.7.0`
  |-> The build backend returned an error
  `-> Call to `scikit_build_core.build.build_wheel` failed (exit status: 1)

      [stdout]
      *** scikit-build-core 0.12.2 using CMake 4.3.1 (wheel)
      *** Configuring CMake...
      loading initial cache file /tmp/tmp8ch254_2/build/CMakeInit.txt
      -- Configuring incomplete, errors occurred!

      [stderr]
      CMake Error at
      /nix/tmp/debug-tools/.cache/uv/builds-v0/.tmpa3v1oF/lib/python3.14/site-packages/cmake/data/share/cmake-4.3/Modules/CMakeDetermineCCompiler.cmake:48
      (message):
        Could not find the compiler specified in the environment variable CC:

        cc -pthread.
      Call Stack (most recent call first):
        CMakeLists.txt:3 (project)


      CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage

      *** CMake configuration failed

      hint: This usually indicates a problem with the package or the build environment.

Don’t panic, this error means you’ve not installed a C compiler onto your computer.

If you’re on a fresh or recent Linux install then there’s a good chance you might be missing a it, you can remedy this by running sudo apt install build-essential on Debian-based Linux systems such as Ubuntu.

Make sure you’ve installed the Command Line Tools package.

If you’ve encountered this error then I have no idea… But I strongly recommending installing Windows Subsystem for Linux and running a mini Ubuntu install on your machine instead of fighting windows.

How do I run my Python scripts?#

As long as you’ve “activated” your venv you can run a Python script from anywhere on your computer.