Repair or reinstall python

Hi all,

I might have messed my python installation (to many things not working and complaining with python related messages).

I blame myself for not using more virtual environments when trying out stuff…

The question(s) now are:

  • How can I be sure my Pyhton 3 (3.10…) is working flawlessly?
  • How can I reinstall it, if needed>

Thanks in advance!


some python packages need to rebuild if you got a new python version.

example, optimus-manager, if python updates to next version 3.11 example, it need a rebuild to that version

so any python packages from aur need to rebuild

What issues are you seeing exactly?

As you said virtual envs are a very good way to keep things organized. I highly recommend

You can also check pyenv if you want to have multiple versions of python installed.


Apart some SDL error I got in Pygame but that should not have anything to do…

If I try to run Lutris, for example I get this message:

File "/usr/bin/lutris", line 52, in <module>
    from lutris.gui.application import Application  # pylint: disable=no-name-in-module
  File "/usr/lib/python3.10/site-packages/lutris/gui/", line 36, in <module>
    from lutris.api import parse_installer_url, get_runners
  File "/usr/lib/python3.10/site-packages/lutris/", line 9, in <module>
    import requests
  File "/home/nuno/.local/lib/python3.10/site-packages/requests/", line 43, in <module>
    import urllib3
  File "/home/nuno/.local/lib/python3.10/site-packages/urllib3/", line 8, in <module>
    from .connectionpool import (
  File "/home/nuno/.local/lib/python3.10/site-packages/urllib3/", line 29, in <module>
    from .connection import (
  File "/home/nuno/.local/lib/python3.10/site-packages/urllib3/", line 39, in <module>
    from .util.ssl_ import (
  File "/home/nuno/.local/lib/python3.10/site-packages/urllib3/util/", line 3, in <module>
    from .connection import is_connection_dropped
  File "/home/nuno/.local/lib/python3.10/site-packages/urllib3/util/", line 3, in <module>
    from .wait import wait_for_read
  File "/home/nuno/.local/lib/python3.10/site-packages/urllib3/util/", line 1, in <module>
    from .selectors import (
  File "/home/nuno/.local/lib/python3.10/site-packages/urllib3/util/", line 14, in <module>
    from collections import namedtuple, Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/

While the first few lines are or appear to be Lutris related what concerns me is the problem with finding stuff on the python3.10 site_packages… Am I missing some package? Did I overwrote something with Pip or…?

Thanks for your time!


I had no idea about that! If it happened to me I would probably wait for the update… :zipper_mouth_face:

I’m not sure that’s the my case anyway but…


So, with a quick search, it looks the issue here isn’t with your python install.
The issue is this

from collections import namedtuple, Mapping

This is a python 3.9 import so I assume lutris is expecting python 3.9. Apparently collections interface changed in python 3.10 so it has to be like this now

from import Mapping

A virtual env here would be perfect to handle this, if you’ve followed the virtualenvwrapper guide I posted above then you can do this.

mkvirtualenv -p python3.9 lutris_playground

This will create a virtual env with python 3.9 and it’ll work as it should.

1 Like

i dont know what is in lutris, also lutris is also a kinda environment like steam, even lutris wine

Scratch that, I thought lutris was a python package that you were trying to install.
What does lutris -v give you?

I’m afraid it doesn’t give me anything… except the same (?) error…

I did install it with yay and a quick yay lutris returned

1 community/lutris (722.1 KiB 2.5 MiB) (Installed)
    Open Gaming Platform

Don’t know if this helps!

PS - And thank you for the virtualenv doc!

Yeap, exactly!

Can you try upgrading your pip installed packages maybe
run this and try again.

pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip install -U


I had no idea I had so many pip packages in need of being updated!
Lutris now runs and I’m off to test other stuff with funky behaviours!

Many thanks!

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