Cmake --version gives ModuleNotFoundError

If I type in cmake --version in the console, I see the following:

Traceback (most recent call last):
  File "/home/datiswous/.local/bin/cmake", line 5, in <module>
    from cmake import cmake
ModuleNotFoundError: No module named 'cmake'

How can I get the version to show normally?

I do not think cmake is something that has to run from the home. Probably has just too many hardcoded dependencies. Have you tried installing it globally, in the normal way?

This is an error typical to Python. I guess you installed cmake (or rather a wrapper or it) with pip or anaconda and and it messed up your PATH.

Use the absolute path /usr/bin/cmake and check again.

1 Like

remove cmake from ~/.local/bin

1 Like

…and actually remove everything from there, that you did not create yourself and knowledgably. Maybe there is more trash there than just the fake cmake.

Then I get this message:

bash: /home/datiswous/.local/bin/cmake: No such file or directory

This does work…

cmake version 3.27.7
CMake suite maintained and supported by Kitware (kitware.com/cmake).