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

This guide provides a comprehensive walkthrough for installing and configuring the Metavision SDK on Ubuntu systems. It includes detailed steps for adding the Prophesee repository, installing the SDK, setting up the Python environment, and troubleshooting common installation issues.

System and Software Requirements

  • Operating System: Ubuntu 20.04 or 22.04
  • Python Version: 3.9 or 3.10 (recommended for compatibility)

Step 1: Adding the Prophesee Repository

Begin by adding the Prophesee repository to your system to access the SDK packages:

  1. Open a terminal and use nano or another editor to create a new source list file:
   sudo nano /etc/apt/sources.list.d/prophesee.list
  1. Add the following repository line to the file:
   deb [arch=amd64 trusted=yes] https://apt.prophesee.ai/dists/public/baiTh5si/ubuntu jammy sdk
  1. Save the file and exit the editor.
  2. Update your package list to recognize the new repository:
   sudo apt update

Step 2: Installing Metavision SDK and Dependencies

Install the Metavision SDK along with necessary development libraries and tools:

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

Step 3: Setting Up the Python Environment

Set up a Python environment using Conda that matches the SDK requirements:

  1. Create and activate a new Conda environment:
   conda create -n evk python=3.10  # or python=3.9 if preferred
   conda activate evk
  1. Install necessary Python packages:
   conda install -c conda-forge numpy pandas matplotlib scipy h5py opencv pytorch tqdm libstdcxx-ng

Step 4: Configure Python and System Paths

Adjust your Python and system paths to ensure proper library loading:

  1. Dynamically add the SDK’s Python path in your scripts:
   import sys
   sys.path.append("/usr/lib/python3/dist-packages/")
  1. Or, set the PYTHONPATH environment variable globally in your .bashrc:
   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

Step 5: Verify Installation

Ensure that everything is set up correctly by running a test script:

  • Create a Python file test_metavision.py with the following content:
  from metavision_core.event_io import EventsIterator
  print("Metavision SDK is properly installed if this script runs without errors!")
  • Run the script:
  python test_metavision.py

Troubleshooting Common Issues

  • Python Version: Make sure the Python version is either 3.9 or 3.10.
  • Environment Variables: Verify that LD_LIBRARY_PATH and PYTHONPATH are set correctly in your .bashrc.
  • Python Packages: Check that all required Python packages are installed in the active Conda environment.

Conclusion

This guide ensures that you have a fully functional development environment for the Metavision SDK on Ubuntu. It addresses setup from repository addition to environment configuration, ensuring a smooth start for your projects. Always check each step and validate configurations with tests to ensure everything is ready for your development activities with the Metavision SDK.

发表评论

zh_CN简体中文