Setting up MaRGE and MaRCoS from scratch - josalggui/MaRGE GitHub Wiki
Installation for Users
Index
- Requirements
- Install MaRGE from PyPI
- Install MaRGE from source
- Full MaRCoS Setup (Red Pitaya Server and Host Computer Client)
- Set up the client Ethernet port (Ubuntu 22.04 LTS)
- Set up the client Ethernet port (Ubuntu 24.04 LTS and 26.04 LTS)
- Set up the client Ethernet port (Windows)
- Setting up the MaRCoS server (Red Pitaya) with a static IP
- Connecting the MaRCoS Client and Server
1. Requirements
Supported Operating Systems
MaRGE has been tested on the following operating systems:
| Operating System | Status |
|---|---|
| Ubuntu 22.04.5 LTS | Supported |
| Ubuntu 24.04 LTS | Supported |
| Ubuntu 26.04 LTS | Supported |
| Windows 10 | Supported |
| Windows 11 | Supported |
Note for Ubuntu 26.04 LTS
Ubuntu 26.04 LTS uses Ptyxis as the default terminal emulator. During testing, some minor issues were encountered when connecting to the server from Ptyxis. For the most reliable experience, it is recommended to use GNOME Terminal instead.
sudo apt update sudo apt install gnome-terminal
Note for Windows
Installation of the MaRCoS server from a Windows is supported only through the legacy setup procedure described in the wiki. Alternatively, the MaRCoS server can be installed from a supported Ubuntu system and later used from a Windows computer running MaRGE. Git Bash must be installed, as MaRGE uses it to communicate with the Red Pitaya.
Python Requirements
Python 3 is required.
Tested Python versions
| Python Version | Platform | Supported MaRGE Versions |
|---|---|---|
| 3.10 | Ubuntu 22.04 LTS | Up to v1.0.0b3 |
| 3.12 | Ubuntu 24.04 LTS | From v1.0.0b4 |
| 3.14 | Ubuntu 26.04 LTS | From v1.0.0b4 |
| 3.13 | Windows 10/11 | Supported with Git Bash |
Other Python 3 versions may work but have not been formally tested.
Required Python Tools
The following tools must be available for the selected Python installation:
pip(Python package manager)venv(Python virtual environment support)git(required to clone repositories and install some dependencies)
On Ubuntu, these packages can be installed with:
sudo apt install git python3-pip python3-venv
If multiple Python versions are installed, ensure that pip and venv correspond to the Python version used for MaRGE.
Network Requirements
Internet Connection
An active internet connection is required during installation to download dependencies and complete the setup process.
Ethernet Connectivity
A dedicated Ethernet connection to the Red Pitaya is required.
- MaRGE communicates with the Red Pitaya using a static IP configuration.
- During the server and client setup process (Section 4 of the installation tutorial), the Ethernet interface is configured automatically on Ubuntu systems.
- If only Ethernet configuration is needed, follow Sections 5, 6, or 7 of the tutorial according to your operating system.
Hardware Requirements
Required Hardware
- Red Pitaya board
- Available Ethernet port on the host computer
Summary
Minimum Requirements
- Supported operating system (Ubuntu 22.04+, Ubuntu 24.04+ for the latest releases, or Windows 10/11)
- Python 3
pipandvenvfor the selected Python installationgit- Internet connection for installation
- Available Ethernet port
- Red Pitaya device
- Git Bash (Windows only)
Hardware Requirements (Full Functionality)
To use MaRGE with full functionality, you must have a working MaRCoS system, including:
- A Red Pitaya board with the MaRCoS server installed
- A host computer configured as a MaRCoS client
- Static IP networking between the host and the Red Pitaya
If MaRCoS + Red Pitaya is not configured, MaRGE can still be launched in Trial Mode, but hardware acquisition features will not be available. The MaRCoS setup procedure is described in Section 4.
2. Install MaRGE from PyPI
MaRGE is available on PyPI, making it easy to install with pip.
This option is ideal for users who want to use the existing sequences and toolkits.
If you plan to customize or add sequences, modify the GUI, or develop new features, proceed to the next section.
Installation
Install MaRGE with pip if you only need to run the GUI and do not plan to modify the source code or add custom sequences.
Note: Tyger capabilities are not supported from pip installation.
-
(Ubuntu only) Install Qt system libraries
Some Ubuntu installations may be missing libraries required by Qt applications. Before running MaRGE by the first time, install the required system packages:
sudo apt update sudo apt install -y \ libxcb-cursor0 \ libxcb-xinerama0 \ libxcb-icccm4 \ libxcb-image0 \ libxcb-keysyms1 \ libxcb-render-util0 \ libxkbcommon-x11-0 \ libxcb-randr0 \ libxcb-shape0 \ libxcb-xfixes0 \ libgl1 \ libegl1 -
Go to your project folder and create and activate a virtual environment:
- Ubuntu
python3 -m venv venv source venv/bin/activate - Windows
python -m venv venv source venv/Scripts/activate
- Ubuntu
-
Install marge-mri
pip install marge-mri==1.0.0b2 -
Launch the GUI from terminal:
marge-mri -
Configure your MaRGE session and hardware by following this Hardware Configuration Guide.
Prerequisite: Hardware configuration requires a working MaRCoS installation (Red Pitaya server, host computer client, and network connection).
If you have not yet installed and configured MaRCoS, you will need to install MaRCoS after MaRGE installation. Section 4: Full MaRCoS Setup (Red Pitaya Server and Host Computer Client).
Project Folder Structure
Once you launch MaRGE for the first time, it automatically creates the required folder structure and configuration files in the current working directory. Some files are created once you access to the Main window by the first time, so do not scare if you miss some files now. Example folder structure:
project-folder/
βββ calibration/ β protocols for autocalibration
βββ configs/ β device configuration and hardware settings
βββ experiments/ β acquired raw data (main output)
βββ logs/ β runtime logs and debugging info
βββ protocols/ β protocols defined by the user
βββ reports/ β reports generated by the user
βββ communicateRP.sh β script to interact with Red Pitaya
βββ copy_bitstream.sh β helper to load FPGA bitstream
βββ marcos_fpga_rp-122.bit β MaRCoS files
βββ marcos_fpga_rp-122.bit.bin β MaRCoS files
βββ marcos_fpga_rp-122.dtbo β MaRCoS files
βββ ps_interpreter.log β low-level interpreter log
βββ marcos_install.sh β script to set up a red pitaya, configuring the server and client
βββ readme.org β MaRCoS files documentation
π Notes:
The experiments/ folder is the most relevant for users:
It stores all acquired raw data, organized by timestamp and experiment name.
Make sure to run MaRGE from the folder where you want this structure to be created.
You can safely delete or move these folders between sessions; MaRGE will recreate them if needed.
3. Install MaRGE from source
Installing MaRGE from source is recommended for users who want full control over the codebase.
This option allows you to modify existing sequences, extend the GUI, contribute new features, or adapt MaRGE to your specific workflows.
Note that the commands indicated here for Windows run on GitBash, not in PowerShell.
-
(Ubuntu only) Install Qt system libraries
Some Ubuntu installations may be missing libraries required by Qt applications. Before running MaRGE by the first time, install the required system packages:
sudo apt update sudo apt install -y \ libxcb-cursor0 \ libxcb-xinerama0 \ libxcb-icccm4 \ libxcb-image0 \ libxcb-keysyms1 \ libxcb-render-util0 \ libxkbcommon-x11-0 \ libxcb-randr0 \ libxcb-shape0 \ libxcb-xfixes0 \ libgl1 \ libegl1 -
Go to the folder where you want to create the project and clone the repo
git clone https://github.com/josalggui/MaRGE.git -
Go into the created
MaRGEfolder. Create and activate a virtual environment. Then, add the current folder (MaRGE) to Python's module search path:- Ubuntu
cd MaRGE python3 -m venv venv source venv/bin/activate export PYTHONPATH=$(pwd) - Windows
cd MaRGE python -m venv venv source venv/Scripts/activate export PYTHONPATH=$(pwd)
- Ubuntu
-
Install requirements
pip install -r requirements.txt -
Go into
MaRGE/margefolder and run themain.py.- Ubuntu
cd marge python3 main.py - Windows
cd marge python main.py
- Ubuntu
-
Configure your MaRGE session and hardware by following this Hardware Configuration Guide.
Prerequisite: Hardware configuration requires a working MaRCoS installation (Red Pitaya server, host computer client, and network connection).
If you have not yet installed and configured MaRCoS, you will need to install MaRCoS after MaRGE installation. Section 4: Full MaRCoS Setup (Red Pitaya Server and Host Computer Client).
Note 1
When you run
main.pyadditional folders are created to save results, configurations, and calibrations data. These folders are created in the directory from whichmain.pyis executed. For this reason, it is strongly recommended to runmain.pyfromMaRGE/margedirectory.
Note 2
export PYTHONPATH=$(pwd)command is required each time you initialize the virtual environment, unless it has been added to the virtual activation script. Some IDEs, such as Pycharm and Visual Studio Code, may automatically configure the Python path or working directory when launching the project, making this step unnecessary.
Note 3
The commands provided for Windows have been tested with Git Bash and should work as expected. As indicated in the requirements, Git Bash is required to run MaRGE on Windows; therefore, it is also recommended to use Git Bash during the installation process. For PowerShell environments, some commands may require adaptation to PowerShell syntax.
Project Folder Structure
Once you launch MaRGE for the first time, it automatically creates the required folder structure and configuration files in the current working directory. Some files are created once you access to the Main window by the first time, so do not scare if you miss some files now. Example folder structure:
MaRGE/
βββ marge
βββββ autotuning/ β RFAutoMaTE related files
βββββ calibration/ β protocols for autocalibration
βββββ configs/ β device configuration and hardware settings
βββββ controller/ β scripts to control the behavior of the GUI
βββββ docs/ β documents for sphinx
βββββ experiments/ β acquired raw data (main output)
βββββ logs/ β runtime logs and debugging info
βββββ manager/ β dicom manager
βββββ marcos/ β marcos files
βββββ marge_tyger/ β tyger scripts
βββββ marge_utils/ β usefull standalone methods
βββββ protocols/ β protocols defined by the user
βββββ recon/ β standalone reconstruction methods
βββββ reports/ β reports generated by the user
βββββ resources/ β folder that contains images and icons
βββββ seq/ β sequences (can be executed in standalone)
βββββ ui/ β scrits with the user interface windows
βββββ vna/ β scripts related to the nanovna
βββββ widgets/ β widget used to build the ui
βββββ communicateRP.sh β script to interact with Red Pitaya
βββββ main.py β Main script to run MaRGE
βββββ marcos_install.sh β script to set up a red pitaya, configuring the server and client
βββββ ps_interpreter.log β low-level interpreter log
βββ README.md β MaRGE readme file
βββ pyproject.toml β pypi related file
βββ setup.py β pypi related file
βββ MANIFEST.in β pypi related file
βββ requirements.txt β required modules to make it work properly
4. Full MaRCoS Setup (Red Pitaya Server and Host Computer Client)
This is the recommended setup method for Ubuntu users. The marcos_install.sh script performs the complete MaRCoS installation and configuration process, including:
- Preparing the Red Pitaya SD card
- Installing and configuring the MaRCoS server
- Assigning the Red Pitaya static IP address
- Configuring the host computer Ethernet interface
- Updating SSH keys and client configuration
- Installing Tyger in the host computer
If you successfully complete this section, you do not need to follow Sections 5 or 6 manually. Those sections are provided only for users who need to configure the Ethernet interface separately or troubleshoot network settings.
Who should use this section?
Use this procedure if you are setting up a new Red Pitaya or a new MaRCoS installation from scratch on Ubuntu. The script automates both server and client configuration and is the fastest way to obtain a working MaRCoS environment.
The procedure described in this section has been developed and tested on Ubuntu systems. Other Linux distributions may not be compatible, and Windows or macOS are not supported.
-
Execute the
marcos_install.shfile as sudo user. There are three alternatives to access the file:- If MaRGE is already in the computer, find it in the
margefolder. - Download the file from this link.
- Run the main GUI and call it from button located in the MaRCoS toolbar (only if hardware is already configured).
For options i. and ii., execute the file as sudo user:
sudo ./marcos_install.sh - If MaRGE is already in the computer, find it in the
-
Follow the instructions indicated in the terminal.
The marcos_install.sh script will guide the user through the full process from inserting the SD card into your computer
up to installing MaRCoS server into the red pitaya.
The steps followed by the script are:
- Download the OS image (if not already present).
- Extract the image archive (if needed).
- Write the image to the SD card.
- Mount the SD cardβs root partition.
- Set a static IP for the Red Pitaya.
- (Optional) Configure the host PC Ethernet interface.
- Modify client computer Ethernet configuration.
- Remove old SSH keys for the Red Pitaya and add the new one.
- Install and configure the MaRCoS server on the Red Pitaya.
- Install Tyger into the Host computer
Just follow the instructions to configure your SD card, Ethernet port, server, and client.

Warning
- This script will modify your Ethernet configuration, a backup will be created in /etc/netplan
- .ssh/known_hosts ownership will pass from user to sudo user
- Run this script under your own risk.
5. Set up the client Ethernet port (Ubuntu 22.04 LTS)
Steps
- Open Netplan Configuration File:
cd /etc/netplan sudo nano 01-network-manager-all.yaml - Edit the Configuration File:
- Modify the file to include the following configuration (replace
**your_ethernet_interface**with the actual name of your Ethernet interface, which you can find by typingifconfigin the terminal):network: version: 2 renderer: NetworkManager ethernets: **your_ethernet_interface**: dhcp4: no addresses: [192.168.1.100/24] gateway4: 192.168.1.1 nameservers: addresses: [8.8.8.8, 8.8.4.4]
- Modify the file to include the following configuration (replace
- Apply the Configuration:
- Save and exit the editor.
- Apply the configuration by typing:
sudo netplan try - Confirm the changes when prompted.
- Restart the Computer:
- After restarting, verify the IP address by typing
ifconfigin the terminal. You should see192.168.1.100assigned to your Ethernet interface.
- After restarting, verify the IP address by typing
6. Set up the client Ethernet port (Ubuntu 24.04 LTS)
Note: New versions of Ubuntu allows to do the network configuration through the graphical interface. The method described in previous section still work (tested on Ubuntu 26.04 LTS), but here I add information about how to do the configuration from the Ubuntu graphical interface.
- With the Red Pitaya connected to the computer, open the Ethernet configuration

- Click on the configuration button corresponding to the Ethernet interface you want to configure

- Select the IPv4 tab, and configure a Manual IP address as indicated. A different IP address can be configured, but
it needs to be compatible with the IP of the red pitaya.

7. Set up the client Ethernet port (Windows)
Steps:
- Open Network Connections:
- Press
Windows + Rto open the Run dialog box. - Type
ncpa.cpland press Enter to open the Network Connections window.
- Press
- Access Ethernet Properties:
- Right-click on your Ethernet connection and select
Properties.
- Right-click on your Ethernet connection and select
- Select IPv4 Properties:
- In the Ethernet Properties window, select
Internet Protocol Version 4 (TCP/IPv4)and click on thePropertiesbutton.
- In the Ethernet Properties window, select
- Configure Static IP:
- In the Internet Protocol Version 4 (TCP/IPv4) Properties window, select
Use the following IP address. - Enter the following details:
- IP address:
192.168.1.100 - Subnet mask:
255.255.255.0
- IP address:
- Select
Use the following DNS server addressesand leave them blank.
- In the Internet Protocol Version 4 (TCP/IPv4) Properties window, select
- Save and Exit:
- Click
OKto save the changes and close the properties window. - Click
Closeto close the Ethernet Properties window.
- Click

8. Setting up the MaRCoS server (Red Pitaya) with a static IP
Steps
- Insert the SD Card: Insert the SD card into your computer SD card slot.
- Download compressed SD image.
- Extract SD image.
tar -xvf sdimage-bootpart-202004030120-mmcblk0.direct.tar.bz2 - Flash SD image into the SD card.
wheresudo dd if=./sdimage-bootpart-202004030120-mmcblk0.direct of=/dev/mmcblk0 bs=1M && sync/dev/mmcblk0is the SD card device; it may be different on your system. - Access the Network Configuration File: Navigate to the
/etc/networkfile inside the SD card. Then open theinterfacesfile:sudo nano interfaces - Modify
interfacesfile: Replace the# Wired or wireless interfacessection with the following content to set a static IP:# Wired or wireless interfaces auto eth0 iface eth0 inet static address 192.168.1.101 netmask 255.255.255.0 gateway 192.168.1.1 - Save and Exit: Save the changes and safely remove the SD card.
- Insert the SD Card into Red Pitaya.
This fixes the IP of your sever to 192.168.1.101.
9. Connecting the MaRCoS Client and Server
Once the Red Pitaya has been configured and the host computer Ethernet interface has been set up, connect both devices using an Ethernet cable.
Verify the Connection
-
Connect the Red Pitaya to the Host Computer
- Use an Ethernet cable to connect the Red Pitaya directly to the configured Ethernet port on your computer.
-
Access the Red Pitaya via SSH
- Open a terminal on your computer and run:
ssh [email protected]
- Open a terminal on your computer and run:
-
Verify Access
- If the connection is successful, you should obtain a shell prompt on the Red Pitaya and be able to interact with the MaRCoS server.
First Connection
If this is the first time you connect to the Red Pitaya, your SSH client may ask you to verify the host authenticity:
The authenticity of host '192.168.1.101 (192.168.1.101)' can't be established.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Type yes and press Enter to continue. The Red Pitaya will then be added to your list of known SSH hosts.
If the MaRCoS server was installed using marcos_install.sh, the SSH keys should already have been configured automatically and the connection may proceed without additional prompts.
SSH Host Key Changes
If the Red Pitaya has been reinstalled, reimaged, or configured with a different SD card, SSH may report a host key mismatch. This is expected because the device has generated a new SSH key.
To remove the outdated key, run:
ssh-keygen -R 192.168.1.101
Then reconnect:
ssh [email protected]
and accept the new host key when prompted.
When using marcos_install.sh, outdated SSH keys are removed automatically during the installation process. Otherwise, remove the old entry from ~/.ssh/known_hosts and reconnect.
Troubleshooting
-
Verify that the Ethernet cable is properly connected.
-
Confirm that the host computer Ethernet interface is configured with the static IP address
192.168.1.100. -
Wait a few moments after powering on the Red Pitaya, especially after a fresh installation, as the first boot may take longer than subsequent boots.
-
If the connection still fails, try:
ping 192.168.1.101to verify network connectivity.
Once communication is established, the MaRCoS client and server are ready to be used with MaRGE.