Complete Setup Guide for Metavision SDK on Ubuntu: From Installation to Running Your First Script

This guide walks through installing and configuring the Metavision SDK on Ubuntu. It covers adding the Prophesee APT repository, installing the SDK packages, setting up a compatible Python environment, configuring paths, and running a small verification script.

System and Software Requirements

  • Operating system: Ubuntu 20.04 or 22.04
  • Python version: Python 3.9 or 3.10, depending on the Metavision package you install
  • Package manager access: sudo access for APT installation
  • Python environment manager: Conda or another environment manager capable of creating a Python 3.9/3.10 environment

Before changing the system, check your Ubuntu and Python versions:

lsb_release -a
python3 --version

Step 1: Add the Prophesee Repository

Create a new APT source list file for the Prophesee repository:

sudo nano /etc/apt/sources.list.d/prophesee.list

Add the repository line:

deb [arch=amd64 trusted=yes] https://apt.prophesee.ai/dists/public/baiTh5si/ubuntu jammy sdk

Save the file, exit the editor, and update the package list:

sudo apt update

If apt update fails, verify that the repository URL, Ubuntu codename, and network access are correct. The example above uses jammy, which corresponds to Ubuntu 22.04. For other Ubuntu releases, confirm the supported repository line from Prophesee’s current documentation.

Step 2: Install Metavision SDK and Dependencies

Install the Metavision SDK packages and development libraries:

sudo apt install metavision-sdk-python metavision-sdk-dev metavision-studio metavision-hal-dev metavision-hal-python3.10

If you are using Python 3.9 instead of Python 3.10, check whether the matching HAL Python package is available for your distribution and SDK version:

apt search metavision-hal-python

Use the package that matches your target Python version.

Step 3: Set Up the Python Environment

Create a Conda environment with a Python version compatible with the installed SDK package:

conda create -n evk python=3.10
conda activate evk

Install common scientific and computer-vision packages:

conda install -c conda-forge numpy pandas matplotlib scipy h5py opencv pytorch tqdm libstdcxx-ng

If Conda reports conflicts, install the packages in smaller groups and check which dependency is causing the conflict. For a minimal verification environment, numpy is usually enough to start testing imports.

Step 4: Configure Python and System Paths

The Metavision Python modules installed by APT are commonly placed under the system Python package directory. If your Conda environment cannot find them, add the system package path inside your script:

import sys
sys.path.append("/usr/lib/python3/dist-packages/")

Alternatively, add the required paths to your shell environment:

echo 'export PYTHONPATH="/usr/lib/python3/dist-packages/:$PYTHONPATH"' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH"' >> ~/.bashrc
source ~/.bashrc

After changing these variables, confirm that the shell sees them:

echo "$PYTHONPATH"
echo "$LD_LIBRARY_PATH"

Step 5: Verify the Installation

Create a Python file named test_metavision.py:

from metavision_core.event_io import EventsIterator

print("Metavision SDK is properly installed if this script runs without errors!")

Run it from the active Conda environment:

python test_metavision.py

If the script exits without an import error, the Python bindings are visible to the environment.

You can also inspect where Python is loading the package from:

python - <<'PY'
import metavision_core
print(metavision_core.__file__)
PY

Troubleshooting Common Issues

Python Version Mismatch

Make sure the active Python interpreter matches the installed Metavision Python package. Check the interpreter currently used by your shell:

which python
python --version

If you installed metavision-hal-python3.10, use a Python 3.10 environment. If you use Python 3.9, install the matching package if it is available for your SDK release.

ModuleNotFoundError

If you see an error such as ModuleNotFoundError: No module named 'metavision_core', check whether the system package directory is visible:

python - <<'PY'
import sys
for path in sys.path:
    print(path)
PY

If /usr/lib/python3/dist-packages/ is missing, set PYTHONPATH or append the path inside the script as shown above.

Shared Library Loading Errors

If Python finds the module but fails to load a shared library, verify LD_LIBRARY_PATH:

echo "$LD_LIBRARY_PATH"

Then check whether Metavision libraries are installed under the expected system library directory:

ls /usr/lib/x86_64-linux-gnu | grep -i metavision

Package Availability

If APT cannot find one of the Metavision packages, refresh the package index and inspect available package names:

sudo apt update
apt search metavision

Package names can vary across SDK releases, Ubuntu versions, and Python versions, so prefer checking the repository contents locally before assuming a package name.

Conclusion

After adding the Prophesee repository, installing the SDK packages, creating a compatible Python environment, and configuring the required paths, you should have a working Metavision SDK setup on Ubuntu. The final import test is the most important check: it confirms that the active Python environment can see the Metavision bindings and load their system libraries correctly.

Leave a Reply