ModuleNotFoundError: No module named 'cmake'

Sorting through a bunch of weirdness after the major Plasma 6 update, and trying to learn how to learn the fundamentals of how to solve these issues Im facing.

Im updating more applications with the Pamac gui. I am trying to update CPU-X and I get the following error:

Traceback (most recent call last):
  File "/home/hardbrocklife/.local/bin/cmake", line 5, in <module>
    from cmake import cmake
ModuleNotFoundError: No module named 'cmake'
==> ERROR: A failure occurred in build().
    Aborting...

I read in another thread that /.local/bin/cmake is a “fake cmake” or something? The cmake file there is a python script that looks like this:

#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from cmake import cmake
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(cmake())

What Im trying to learn is if Pamac should not be looking here for that python cmake script, or if that python cmake script is telling the build to look in the wrong place, of if my PATH variables or something are screwed up after the update.

I am also getting dependency issues with node/NPM when trying to update balena-etcher:

npm ERR! code 1
npm ERR! path /var/tmp/pamac-build-hardbrocklife/balena-etcher/src/etcher/node_modules/@ronomon/direct-io
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! make: Entering directory '/var/tmp/pamac-build-hardbrocklife/balena-etcher/src/etcher/node_modules/@ronomon/direct-io/build'
npm ERR!   CC(target) Release/obj.target/binding/binding.o
npm ERR! make: Leaving directory '/var/tmp/pamac-build-hardbrocklife/balena-etcher/src/etcher/node_modules/@ronomon/direct-io/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.1
npm ERR! gyp info using node@20.13.1 | linux | x64
npm ERR! gyp info find Python using Python version 3.12.3 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/var/tmp/pamac-build-hardbrocklife/balena-etcher/src/etcher/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/var/tmp/pamac-build-hardbrocklife/balena-etcher/src/etcher/node_modules/@ronomon/direct-io/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/var/tmp/pamac-build-hardbrocklife/balena-etcher/src/etcher/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/hardbrocklife/.cache/node-gyp/20.13.1/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/hardbrocklife/.cache/node-gyp/20.13.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/var/tmp/pamac-build-hardbrocklife/balena-etcher/src/etcher/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/hardbrocklife/.cache/node-gyp/20.13.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/var/tmp/pamac-build-hardbrocklife/balena-etcher/src/etcher/node_modules/@ronomon/direct-io',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! make: *** No rule to make target '/var/tmp/pamac-build-hardbrocklife/balena-etcher/src/etcher/node_modules/@ronomon/direct-io/build/Release/binding.node', needed by '/var/tmp/pamac-build-hardbrocklife/balena-etcher/src/etcher/node_modules/@ronomon/direct-io/binding.node'.  Stop.
npm ERR! make: *** Waiting for unfinished jobs....
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/var/tmp/pamac-build-hardbrocklife/balena-etcher/src/etcher/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:519:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm ERR! gyp ERR! System Linux 6.6.30-2-MANJARO
npm ERR! gyp ERR! command "/var/tmp/pamac-build-hardbrocklife/balena-etcher/src/.nvm/versions/node/v20.13.1/bin/node" "/var/tmp/pamac-build-hardbrocklife/balena-etcher/src/etcher/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /var/tmp/pamac-build-hardbrocklife/balena-etcher/src/etcher/node_modules/@ronomon/direct-io
npm ERR! gyp ERR! node -v v20.13.1
npm ERR! gyp ERR! node-gyp -v v9.4.1
npm ERR! gyp ERR! not ok

I see NPM ERR and referencing python location, node versions, etc…

Im curious if these issues are being cause by a singular underlying problem that occurred after the update. Like my PATH is broken or something.

Below is the PATH section from printenv if that helps:

PATH=/home/hardbrocklife/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/cuda/bin:/opt/cuda/nsight_compute:/opt/cuda/nsight_systems/bin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin:/var/lib/snapd/snap/bin:/home/hardbrocklife/.local/share/JetBrains/Toolbox/scripts

I have both cmake and node installed via pamac:

Your local Cmake installation is interfering with the system Cmake installation.

1 Like

Cpu-x is an aur package. So you are trying to rebuild it. Maybe you can try a different aur builder? Like yay?
And after fully updating everything first
sudo pacman -Syu
you rebuild the aur stuff
yay -Sua
And maybe clean the cache folder

I cannot say anything about npm, except NEVER run it with sudo.

1 Like

This is what I assumed based on the other thread I read. The other thread said to delete that file in /home/hardbrocklife/.local/bin/cmake and it would solve the problem. I tried that and instead I got an immediate “Build failed”.

P.S. I just tried it again cutting/pasting the cmake file from .local/bin to my desktop because I wanted to provide the exact error it gave me the last time I tried and now it worked.

In this instance is there a way to change the priority for which one is used first, or does that cmake file really not even need to be in .local/bin? Im assuming one of my Jetbrains IDEs created that local cmake file.

I would remove the one at .local and rely on the system one.

1 Like

Exactly, overriding default packages should only be done carefully if they are not self contained like flatpaks.

1 Like

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