Skip to content

Install¤

msl-loadlib is available for installation via the Python Package Index. It can be installed using a variety of package managers

pip install msl-loadlib
uv add msl-loadlib
poetry add msl-loadlib
pdm add msl-loadlib

Optional dependencies¤

You can install msl-loadlib and Python.NET using,

pip install msl-loadlib[clr]
uv add msl-loadlib[clr]
poetry add msl-loadlib[clr]
pdm add msl-loadlib[clr]

msl-loadlib and Py4J,

pip install msl-loadlib[java]
uv add msl-loadlib[java]
poetry add msl-loadlib[java]
pdm add msl-loadlib[java]

msl-loadlib and comtypes,

pip install msl-loadlib[com]
uv add msl-loadlib[com]
poetry add msl-loadlib[com]
pdm add msl-loadlib[com]

or msl-loadlib and all optional dependencies

pip install msl-loadlib[all]
uv add msl-loadlib[all]
poetry add msl-loadlib[all]
pdm add msl-loadlib[all]

Compatibility¤

Prerequisites¤

Windows¤

64-bit Windows already comes with WoW64 to run 32-bit software and therefore no prerequisites are required to load 32-bit libraries. However, the library might have its own dependencies, such as a particular Visual C++ Redistributable, that may need to be installed.

If you need to load a .NET library, you must install Python.NET (see also Configure a .NET runtime).

pip install pythonnet

If you need to load a Java library (i.e., a .jar or .class file), you must install Py4J,

pip install py4j

a Java Runtime Environment, and ensure that the java executable is available on the PATH environment variable. For example, the following should return the version of Java that is installed

> java -version
java version "25.0.1" 2025-10-21 LTS
Java(TM) SE Runtime Environment (build 25.0.1+8-LTS-27)
Java HotSpot(TM) 64-Bit Server VM (build 25.0.1+8-LTS-27, mixed mode, sharing)

If you need to load a Component Object Model or an ActiveX library you must install comtypes

pip install comtypes

Managing library dependencies

When loading a library it is vital that all dependencies of the library are also on the computer and that the directory that the dependencies are located in is available on the PATH variable (and possibly you may need to add a directory with os.add_dll_directory). A helpful utility to determine the dependencies of a library on Windows is Dependencies (which is a modern Dependency Walker). Microsoft also provides the DUMPBIN tool. For finding the dependencies of a .NET library the Dependency Walker for .NET may also be helpful.

Linux¤

Before using msl-loadlib on Debian-based Linux distributions, the following packages are required. For other distributions, use the appropriate system package manager (e.g., yum) and the equivalent command.

Install the packages that are required to load 32-bit and 64-bit C/C++ and FORTRAN libraries

Attention

The following packages are required to run the examples that are included with msl-loadlib. The dependencies for the C/C++ or FORTRAN library that you want to load may be different.

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install g++ gfortran libgfortran5 zlib1g:i386 libstdc++6:i386 libgfortran5:i386

The following ensures that the ss command is available

sudo apt install iproute2

If you need to load a .NET library, you must install either the Mono or .NET Core runtime and Python.NET (see also Configure a .NET runtime).

pip3 install pythonnet

Important

As of version 0.10.0 of msl-loadlib, pythonnet is no longer installed on the 32-bit server for Linux. Mono can load both 32-bit and 64-bit libraries on 64-bit Linux and therefore a 32-bit .NET library can be loaded directly via LoadLibrary on 64-bit Linux.

If you need to load a Java library (i.e., a .jar or .class file), you must install Py4J,

pip3 install py4j

and a Java Runtime Environment

sudo apt install default-jre

Tip

When loading a library it is vital that all dependencies of the library are also on the computer and that the directory that the dependency is located in is available on the PATH variable. A helpful utility to determine the dependencies of a library on Unix is ldd.

macOS¤

The 32-bit server has not been created for macOS; however, the LoadLibrary class can be used to load a library that uses the __cdecl calling convention that is the same bitness as the Python interpreter, a .NET library or a Java library.

The following assumes that you are using Homebrew as your package manager.

Tip

It is recommended to update Homebrew before installing packages with brew update

To load a C/C++ or FORTRAN library install gcc (which includes gfortran)

brew install gcc

If you need to load a .NET library, you must install either the Mono or .NET Core runtime and Python.NET (see also Configure a .NET runtime).

brew install mono

and Python.NET

pip3 install pythonnet

If you need to load a Java library (i.e., a .jar or .class file), you must install Py4J,

pip3 install py4j

and a Java Runtime Environment

brew cask install java