ModuleNotFoundError: No module named 'gi' while running Python 3.10 code on Jetson Nano 16GB emmc (SD card customized)

Hello everyone,

I am encountering an issue while running a Python script on my Jetson Nano (Ubuntu 18.04). The script imports the gi module, but when I attempt to run it, I get the following error:

ModuleNotFoundError: No module named 'gi'

Steps I have followed to try and resolve the issue:

  1. Installed the necessary dependencies:
    I ran the following command to ensure that the required libraries were installed:

    sudo apt-get install -y libgirepository1.0-dev libcairo2-dev
    
  2. Installed PyGObject via pip for Python 3.10:
    I upgraded pip and installed PyGObject for Python 3.10:

    python3.10 -m pip install PyGObject
    
  3. Checked the installation:
    I tested the installation in a Python 3.10 environment:

    import gi
    

    This ran without issue.

  4. Confirmed Python 3.10 is the default:
    I made sure that Python 3.10 is being used as the default version:

    python --version
    # Output: Python 3.10.x
    

Despite these steps, I still encounter the error when running my script:

python3.10 deepversion.py

System Information:

  • Jetson Nano Model: Jetson Nano 16GB EMMC
  • Ubuntu version: 18.04
  • Python version: 3.10.x

Has anyone encountered a similar issue, or can provide further guidance on resolving this?

Thank you in advance!

deepversion.py.zip (1.5 KB)

I tried with different PyGObject version and it worked.

python3.10 -m pip install PyGObject==3.38.0

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.