Installation and environment
This page describes how to install midas and the packages it needs, set up its environment, and rebuild it when you add optional packages.
Once midas is installed, see Set up your first experiment.
Required packages
The following packages are required to build midas:
- git so you can clone the code
- g++ or clang so you can compile C++ code
- cmake to run the compilation
- zlib to create compressed
.gzfiles
If your OS uses apt, you can install using:
sudo apt-get install git g++ cmake zlib1g-dev
Optional packages
Midas provides optional support for the following packages. They are not required, but may provide useful functionality.
A large number of experiments to not require any of these extra packages!
- MySQL, MariaDB, PostgreSQL or SQLite for logging data to an SQL database
- ROOT for some analysis tools
- CUDA, lm-sensors for some resource monitoring
- curl and/or OpenCV for logging webcam images
Standard install
Install script
Most people install midas manually, but you can install the package using an interactive script by running this command in a terminal:
/bin/bash -c "$(curl -sS https://gitlab.triumf.ca/midas/midas/-/raw/develop/install.sh)"
For an unattended install with default parameters do:
/bin/bash -c "$(curl -sS https://gitlab.triumf.ca/midas/midas/-/raw/develop/install.sh)" -- -f
Install script actions
- Check if all necessary tools and libraries are installed and break if not
- Ask for the installation directory, the midas experiment directory and the experiment name
- Download midas via git clone
- Compile midas via cmake
- Install midas under the user
$MIDASSYS/bindirectory where$MIDASSYSis the midas installation directory - Add the above directory to the path and put the environment variables
MIDASSYS,MIDAS_DIRandMIDAS_EXPT_NAMEin your environment - Add
$MIDASSYS/pythontoPYTHONPATH - Create your experiment directory
- Load an initial ODB file which configures mhttpd to accept insecure connections through port 8081. Change that later to secure your connections.
- Install the midas web server mhttpd as a system daemon via systemctl and start it
- Start a midas example frontend and the logger
After a successful installation, you should be able to connect to mhttpd via http://localhost:8081 and see your experiment.
It is also possible to first download the install.sh file using the curl command and then executing it directly with ./install.sh. Add the flag -f to force the installation at the default directories without asking for any user input. This can be useful for automated installations such as in a Docker.
Python
Note that the install script makes the simplest possible choice to get the midas python bindings working, as it is not trivial to support all the different package managers and virtual environments that you may be using.
You are strongly recommended to follow the set up python section after running the install script.
Manual installation
Download and compile
mkdir -p $HOME/packages
cd $HOME/packages
git clone https://gitlab.triumf.ca/midas/midas.git --recurse-submodules
cd midas
mkdir build
cd build
cmake ..
make install -j
ls -l ../bin/odbedit #(1)!
- Check to see that the
odbeditexecutable has been created
The cmake command allows you to specify various flags to enable/disable features. For example, you may wish to disable any ROOT integration from midas, even if you have ROOT installed on your system. This would be done by specifying cmake .. -DNO_ROOT=1 rather than cmake ...
cmake option |
Meaning | Default |
|---|---|---|
-DCMAKE_INSTALL_PREFIX=/path/abc |
Where to install bin and lib directories |
Where you cloned the git repository |
-DMIDAS_CXX17_FALLBACK=1 |
Compile using C++17 | Compile using C++20 |
-DNO_ROOT=1 |
Disable ROOT support | Try to find ROOT using $ROOTSYS |
-DNO_CURL=1 |
Disable CURL support in mlogger | Try to find CURL |
-DNO_MYSQL=1 |
Disable MySQL support in mlogger | Try to find MySQL/MariaDB |
-DNO_PGSQL=1 |
Disable PostgreSQL support in mlogger | Try to find PostgreSQL |
-DNO_ODBC=1 |
Disable ODBC support in mlogger | Try to find ODBC |
-DNO_SQLITE=1 |
Disable SQLITE support in mlogger | Try to find SQLITE |
-DNO_NVIDIA=1 |
Disable counting number of Nvidia GPUs in msysmon | Try to find cuda |
-DNO_SENSORS=1 |
Disable LM_SENSORS in msysmon | Try to find libsensors |
-DNO_OPENCV=1 |
Disable OPENCV in mlogger (for image history) | Try to find OpenCV |
-DMIDAS_ENABLE_TERMINAL=1 |
Enable a webpage that provides a terminal interface to your machine | No terminal |
-DUSE_ADDRESS_SANITIZER=1 |
Enable address sanitizer for debugging | Disabled |
-DUSE_THREAD_SANITIZER=1 |
Enable thread sanitizer for debugging | Disabled |
-DCMAKE_BUILD_TYPE=Coverage |
cmake build type that will work with lcov | RelWithDebInfo |
-DNO_LOCAL_ROUTINES=1 |
Only support remote connections to a midas experiment | Support local and remote connection |
-DMIDAS_BUILD_TESTS=1 |
Build GoogleTest-based automated tests | Disabled (only build hand-crafted test scripts/executables) |
-DMIDAS_BUILD_DOCS=1 |
Build this documentation as a static website in doc/mkdocs/html_local, after the other targets. Needs Zensical. See Build with CMake |
Disabled |
Set up environment
Midas programs need to know where midas is installed, and you need the midas programs in your PATH. Add these to your shell's startup file (.bashrc, .cshrc or .zshrc), so they are set whenever you log in. MIDASSYS should be the directory where you cloned midas (or the CMAKE_INSTALL_PREFIX, if you set one).
export MIDASSYS=$HOME/packages/midas
export PATH=$PATH:$MIDASSYS/bin
setenv MIDASSYS $HOME/packages/midas
setenv PATH ${PATH}:${MIDASSYS}/bin
export MIDASSYS=$HOME/packages/midas
export PATH=$PATH:$MIDASSYS/bin
Then open a new terminal, or run source ~/.bashrc (or the equivalent for your shell).
You also need to tell midas which experiment to connect to. This is covered in Set up your first experiment. The full list of variables midas uses is in Environment variables.
Set up python
Python supports many package managers and virtual environment solutions. In general it is frowned upon to install packages in the default environment used by your operating system (and some OSes will explicitly prevent you from running pip install if it would touch that environment).
Below are three different ways to configure your python setup. Most experiments use the first option.
venv comes pre-installed with python.
If you do not already have a virtual environment set up, create one with:
cd /path/to/somewhere
python -m venv my_venv
source my_venv/bin/activate
You should probably source this virtual environment in your .bashrc file or similar. You can deactivate it using source /path/to/somewhere/my_venv/bin/deactivate.
To install the midas python packages, do:
pip install -e $MIDASSYS/python
The -e flag makes this an "editable" install. If you upgrade midas in future, python will automatically see the new code without you having to re-install. You may need to add a --user flag to the pip install command, depending on your pip setup.
uv is an alternative to venv. See the uv documentation for installation instructions.
If you do not already have a virtual environment set up, create one with:
cd /path/to/somewhere
uv venv my_venv
source my_venv/bin/activate
You should probably source this virtual environment in your .bashrc file or similar. You can deactivate it using source /path/to/somewhere/my_venv/bin/deactivate.
To install the midas python packages, do:
uv pip install -e "midas @ $MIDASSYS/python"
The -e flag makes this an "editable" install. If you upgrade midas in future, python will automatically see the new code without you having to re-install.
If you don't want to commit to proper python tooling, you can make the midas python package visible to your python interpreter by setting the $PYTHONPATH environment variable. This is what the install script does.
export PYTHONPATH=$PYTHONPATH:$MIDASSYS/python
Optional dependencies
The python code has some optional dependencies that enable extra functionality:
numpycan be used to improve performance in midas python frontends that are running at high data rateslz4allows the midas file reader to parse .mid.lz4 files (.mid and .mid.gz files do not need any extra packages)pyflakesallows the PySequencer to validate the syntax of your script before it gets executed, catching many errors before they are encountered
As of September 2026, the optional dependencies will be installed automatically when you pip install the midas package. They will not be installed if you just set the $PYTHONPATH environment variable.
The zensical python package is used to build this documentation. It is not installed by default. See building this documentation for more details.
Special builds (32-bit, cross-compilation etc)
If you are running midas on multiple machines, some of those machines may be embedded devices that use different architectures (e.g. 32-bit instead of 64-bit). You can run special make commands to compile specifically for these architectures, and avoid clashing with the default 64-bit binaries and libraries.
OS packages for cross-compilation
If your embedded machines have poor compiler support (or are just very slow) you may wish to cross-compile from your main machine. You will likely need to install multilib support for your compiler, for example:
# 32-bit support
sudo apt-get install g++-multilib
# ARM64 support
sudo apt-get install g++-aarch64-linux-gnu
# ARMv7 support
sudo apt-get install g++-arm-linux-gnueabihf gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
Note that if your OSes are very different vintages, you may end up with issues related to GLIBC version mismatches if you cross-compile. This is particularly true for 32-bit architectures, where very few OSes continue to provide support.
Note that the special builds are compiled using make rather than cmake.
Example - 32-bit build
If you run make linux32, we will compile midas for a 32-bit architecture, and install the results in the $MIDASSYS/linux-m32 directory.
cd $MIDASSYS
make linux32
ls -l linux-m32/bin/odbedit #(1)!
- Check to see that the 32-bit
odbeditexecutable has been created in the special directory. The defaultodbeditis inbinrather thanlinux-m32/bin.
The full list of special builds are:
| Style | Build command | Cleanup command | Install location |
|---|---|---|---|
| Minimal x86 32-bit | make linux32 |
make clean32 |
linux-m32 |
| Minimal x86 64-bit | make linux64 |
make clean64 |
linux-m64 |
| Minimal x32 32-bit | make linuxx32 |
make cleanx32 |
linux-x32 |
| Minimal ARM | make linuxarm |
make cleanarm |
linux-arm |
| ARM64 (Xilinx MP SoC, RPi4, RPi5 etc) | make arm64_remoteonly |
make arm64_cleanremoteonly |
linux-arm64-remoteonly |
| ARMv7 32-bit (Cyclone-5 SoC, RPi3, RPi4 etc) | make armv7_remoteonly |
make armv7_cleanremoteonly |
linux-armv7-remoteonly |
| Minimal build | make mini |
make cleanmini |
linux |
| Minimal build, remote connection only | make remoteonly |
make cleanremoteonly |
linux-remoteonly |
Re-compiling with new dependencies
cd $MIDASSYS/build
cmake ..
make install
You can also add more flags to your cmake command. For example, if you previously compiled with cmake .. -DNO_SQLITE=1, you can re-enable SQLite support with cmake .. -DNO_SQLITE=0.