Setting up MaRGE and MaRCoS from scratch - josalggui/MaRGE GitHub Wiki
Installation for Users
Index
- Requirements
- Install MaRGE from PyPI
- Install MaRGE from source
- Set up the Red Pitaya and the Host computer (not valid for Windows).
1. Requirements
System Requirements
-
Operating System
- The full setup process has been tested on Ubuntu 22.04.5 LTS.
- Windows users can install MaRGE, but cannot set up the MaRCoS server or client using this method.
- On Windows, MaRCoS server/client installation must follow the legacy method.
-
Python 3
- Python 3 must be installed on your system.
- Tested versions:
- Python 3.10 on Ubuntu
- Python 3.13 on Windows
-
Internet Connection
- Required for installation and dependency setup.
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.
1. 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.
-
Go to your project folder.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 session and hardware following this link.
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.
2. 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.
-
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 python main.py - Windows
cd marge python3 main.py
- Ubuntu
-
Configure your session and hardware following this link.
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
3. Set up the Red Pitaya and the Host computer (Ubuntu).
-
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.
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.