Martin Čejka
Martin Čejka

Reputation: 451

Error when installing cmake for python windows

I have windows 10 and fresh Python 3.6.1. I was trying to install package Cmake 0.6.0 (needed for another package, atari-py) using

pip install cmake

but I'm getting an error.

I have these packages installed: pip,scikit-build, setuptools, wheel, pybdist. I do have a foreign symbol in my account name (lesson learnt), but it works fine when installing other packages. I am not a skilled windows administrator.

Collecting cmake
  Using cached cmake-0.6.0.tar.gz
Building wheels for collected packages: cmake
  Running setup.py bdist_wheel for cmake: started
  Running setup.py bdist_wheel for cmake: finished with status 'error'
  Complete output from command C:\Python\Python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Čejkis\\AppData\\Local\\Temp\\pycharm-packaging1\\cmake\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\EJKIS~1\AppData\Local\Temp\tmp3br7eri7pip-wheel- --python-tag cp36:
  Traceback (most recent call last):
    File "C:\Python\Python36-32\lib\site-packages\skbuild\setuptools_wrap.py", line 405, in setup
      cmkr = cmaker.CMaker()
    File "C:\Python\Python36-32\lib\site-packages\skbuild\cmaker.py", line 67, in __init__
      "Problem with the CMake installation, aborting build.")

  Problem with the CMake installation, aborting build.

  ----------------------------------------
  Running setup.py clean for cmake
Failed to build cmake
Installing collected packages: cmake
  Running setup.py install for cmake: started
    Running setup.py install for cmake: finished with status 'error'
    Complete output from command C:\Python\Python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Čejkis\\AppData\\Local\\Temp\\pycharm-packaging1\\cmake\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\EJKIS~1\AppData\Local\Temp\pip-5ql_x35g-record\install-record.txt --single-version-externally-managed --compile:
    Traceback (most recent call last):
      File "C:\Python\Python36-32\lib\site-packages\skbuild\setuptools_wrap.py", line 405, in setup
        cmkr = cmaker.CMaker()
      File "C:\Python\Python36-32\lib\site-packages\skbuild\cmaker.py", line 67, in __init__
        "Problem with the CMake installation, aborting build.")

    Problem with the CMake installation, aborting build.

    ----------------------------------------

  Failed building wheel for cmake
Command "C:\Python\Python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Čejkis\\AppData\\Local\\Temp\\pycharm-packaging1\\cmake\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\EJKIS~1\AppData\Local\Temp\pip-5ql_x35g-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Čejkis\AppData\Local\Temp\pycharm-packaging1\cmake\

Upvotes: 1

Views: 26423

Answers (7)

xb.
xb.

Reputation: 1677

I encountered a similar issue while installing numpy in Cygwin, which required several dependencies, including the one mentioned here.

This seems to be caused by the latest version of setuptools and is likely connected to the deprecation of the distutils module, as discussed here: No module named 'distutils.util' ...but distutils installed?

Pinning setuptools to a specific, previously working version resolved the problem for me, with pip3 from python3.8 in Cygwin.

pip3 install setuptools==65.5.0

Subsequently, successfully installed numpy.

pip3 install --upgrade numpy

System Info:

python3 -V ## Python 3.8.12

python3 -c "import numpy; print(numpy.version.version)" ## 1.24.4

pip3 -V ## pip 24.3.1 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)

Wanted to share the success.

Upvotes: 0

cookingwgas
cookingwgas

Reputation: 1

I had a similar problem (installing numpy - needed cmake as a dependency).

It turned out I had a conflicting installation (Python 3.9) that had been packaged in when I'd installed gcc using mingw64, and it was preventing pip from installing cmake.

I solved it by excising the offending programs in the mingw64/bin directory, but it could probably also be done by shifting its position in the PATH down... to give it a lower priority than your new (or previously working) Python installation.

Upvotes: 0

Smokey Badazz
Smokey Badazz

Reputation: 1

I just downloaded VS Code with C++ libraries and that did the trick, I was able to install CMake. (I was on Windows 10 btw)

Upvotes: 0

guest
guest

Reputation: 61

if the above answers of pip3 or pip install cmake don't work try

sudo apt-get install cmake

Upvotes: 6

Premium Ayodele
Premium Ayodele

Reputation: 407

python -m pip install --upgrade pip

and then you can run

pip3 install cmake

This works for me on Pyhton 3.8

Upvotes: 6

J-Christophe
J-Christophe

Reputation: 2070

As of today, CMake wheels for python 3.6 are available and pip install cmake is expected to work.

Background

At the time of your first post, there were no wheels for python 3.6, pip was rightfully trying to build the wheel using the source distribution.

Considering that:

  • the project allowing to generate a CMake wheel itself depends on scikit-build and cmake

  • we simply repackage the existing binaries into the windows wheels

... you got the general error message Problem with the CMake installation, aborting build.

References:

Installing atari-py on windows

Looking at the documentation and open pull requests of the corresponding project, it look like windows is not supported. See https://github.com/openai/atari-py

If you would like to help the project and improve their windows support, let me know and I could try to give you some guidance to create a pull request and simplify their build system.

Upvotes: 1

Martin Čejka
Martin Čejka

Reputation: 451

Eventually I installed cmake 0.8 from a binary file from their webpage. I originally wanted to install package atari-py that needed cmake. I downloaded that from git and in cmd with administrator rights I ran

python install setup.py

which worked.

python setup.py install

still didn't work. Unfortunately I can't give any further explanation.

Upvotes: 0

Related Questions