Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (3.12)

I am trying to install a dependency for Quake 3.

Having some problems.

game-data-packager -i quake3 /home/andy/Quake3/pak0.pk3
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/share/games/game-data-packager/game_data_packager/command_line.py", line 28, in <module>
    from .data import (ProgressCallback)
  File "/usr/share/games/game-data-packager/game_data_packager/data.py", line 21, in <module>
    import yaml
ModuleNotFoundError: No module named 'yaml'
andy@7 ~/Python> pip install pyyaml
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (3.12)

You have at least two different Python installations.

When you run game-data-packager, you are using Python 3.10, which doesn’t have yaml. When you run pip, you are using Python 3.12, which does have yaml.

You should never run pip alone unless you only have a single Python installation, because it is not clear which version of Python is running. You should specify the specific Python you want: python3.10 -m pip install pyaml

Thanks. I see the python 3.1 and I need python 3.6, but I don’t know how to change that.

python3.6 -m pip install pyaml
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pyaml in ./.local/lib/python3.6/site-packages (21.10.1)
Requirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from pyaml) (3.12)


game-data-packager -i quake3 /home/andy/Quake3/pak0.pk3
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/share/games/game-data-packager/game_data_packager/command_line.py", line 28, in <module>
    from .data import (ProgressCallback)
  File "/usr/share/games/game-data-packager/game_data_packager/data.py", line 21, in <module>
    import yaml
ModuleNotFoundError: No module named 'yaml'

Have a look at the #! line in game-data-packager and either edit it to use python3.6
or add an symlink from python3.6 to name used into your path.

Thanks for your help.

Don’t do that.

It looks to me that game-data-packager is provided by your OS, which I think is Debian, or maybe a Debian derivative. Am I right? I think that it’s hash-bang line just refers to “python3”, and it expects to use the system-installed Python.

You should not touch the system-installed Python, and you should make sure that /usr/bin/python3 continues to point to the system-installed Python. Otherwise you will have problems, as you are having here.

Under Linux, we have the OS package manager that is trying to manage the system python, and it is far too easy to break that and interfere with it, even breaking the whole OS, but making willy-nilly manual changes to the system python.

If you compile and install new versions of Python from source by hand, you should always use the altinstall option:

make
make test
sudo make altinstall

If you have accidently done sudo make install, you should fix the symlink to point to your OS’s system install python, rather than editing each system-installed Python script by hand.

Or just make altinstall to somewhere like your homedir and don’t use
sudo at all, so that you’re less likely to overwrite something
important to the operating system. This is exactly what I do, and it
allows me access to a vast array of different python versions
entirely independent of the operating system.

Thanks to all the replies.