No module named cmake
Asked Answered
C

4

1

When I run the command

cmake --version

It gives me the version. But when I run

import cmake

It gives the error cmake module not present.

I am stuck and not getting how to resolve it

Cromwell answered 22/11, 2019 at 10:33 Comment(0)
G
7

For me on MacOSX when I initially install CMake by pip, it goes to the similar behaviour.

It was solved by uninstalling CMake by pip, and installing CMake first by brew before installing by pip, and before it installing brew itself, by running in terminal commands from How to run CMake in Mac? answer.

Gilded answered 26/10, 2023 at 11:14 Comment(2)
If you're in a virtualenv, then pip uninstall cmake and brew install cmake was needed without the pip install.Long
Suggestion above is really useful, pip uninstall make and then brew install make seems necessaryEndora
S
6

You are talking about two different things:

  1. When running cmake --version, you are calling the command line program CMake
  2. When using import cmake in a Python program (or interactive session) you are using the cmake Python module.

You are missing the second one. You can install it, e.g. by calling

pip install cmake
Sergei answered 22/11, 2019 at 10:42 Comment(0)
B
0

I couldnt install qdldl either and found the cmake module was not found error

after a while i noticed that the virtual environment was no active, try activating your virtual environment and then installing cmake in that directory. after that ive opened jupyter labs and tried installing qdldl and it worked.

Benignant answered 22/2, 2024 at 18:44 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Linguistics
D
0

For macOS users:

brew install cmake

which cmake
# /usr/local/bin/cmake

cmake --version 
# cmake version 3.30.3
Drongo answered 4/9, 2024 at 6:3 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.