Resolving ImportError: No module named 'gi' when using Anaconda | Ibus Preferences/ibus-setup not opening

July 05, 2020

Using anaconda as your python virtual env can cause some confounding issues sometimes. It didn't disappoint me this time around. When opening Ibus preferences or ibus-setup, I got this error: ImportError: No module named 'gi'.

To solve this problem, first make sure you have gi installed. Then you want to create a soft link so Anaconda's python can load the module from your system install.

  1. Run your system python install /usr/bin/python3
  2. See the path to gi

    • import gi
    • print(gi)
    • exit()
  3. Create a softlink. Make sure both python versions match. Otherwise an error may occur.

    • ln -s /usr/lib/python3.8/site-packages/gi/ ~/miniconda3/lib/python3.8/site-packages/(Change the path correctly according to your system)
  4. Test if you can import in your anaconda python install

    • python
    • import gi
  5. Your Ibus preferences should run now.

Subscribe to my email list

© 2023 ALL RIGHTS RESERVED