ModuleNotFoundError: No module named 'cmake'

I’m having a weird issue installing obs-studio-git (the version of OBS in extra is missing the websocket plugin for some reason). Essentially, I get this error for a number of dependencies:

==> Sources are ready.
==> Making package: libjuice 1.2.3-1 (Tue 15 Aug 2023 11:48:46 CEST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Removing existing $pkgdir/ directory...
==> Starting build()...
Traceback (most recent call last):
  File "/home/johannes/.local/bin/cmake", line 5, in <module>
    from cmake import cmake
ModuleNotFoundError: No module named 'cmake'
==> ERROR: A failure occurred in build().

I removed and then re-installed python-cmake-build-extension, extra-cmake-modules and cmake itself, but still get the same error. I also noticed that this gives an error:

❯ cmake --version
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
cmake version 3.27.1

CMake suite maintained and supported by Kitware (

I’ve also rebooted and closed the terminal in between, but to no avail.

Can you post the outputs of:

which cmake


pacman -Ql cmake | grep "Modules/$"


$ which cmake
$ pacman -Ql cmake | grep "Modules/$"
cmake /usr/share/cmake/Modules/

That right there is the problem. When you call cmake on your shell, the executable ~/.local/bin/cmake is used instead of /usr/bin/cmake. For cmake to work, the exec needs to be inside the root of the cmake installation. In your case, cmake is installed globally using pacman, so it will only work if /usr/bin/cmake is used.

For now, I recommend 2 options:

  1. Remove ~/.local/bin/ from your PATH variable
  2. Put ~/.local/bin to the end of your PATH variable instead of putting it in front. We want the system to find the global cmake first, not the local cmake exec inside your home directory.

I don’t know how the cmake executable got inside your ~/.local/bin/ directory, that’s a mystery to be cleared up later, hopefully.


Thank you! Removing ~/.local/bin from my PATH did not seem to do anything (I restarted the Terminal), but your answer was spot on anyway. I moved /home/johannes/.local/bin/cmake to the bin and obs-studio-git installed just fine!

How on earth did the cmake executable get from /usr/bin to ~/.local/bin? Did you manually move it?

I would like to know too, but really can’t remember anything that might have caused this. Maybe an AUR package did something weird? Maybe I applied a fix for some other problem? The system was installed almost exactly 3 years ago, so I don’t remember everything I’ve done…

I guess I will soon find out, when I notice that I broke some other package.

I surely hope that this doesn’t happen. For the sake of your sanity.

1 Like

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