CMake can no longer find Python 2/3

Zeex's Avatar


07 Apr, 2015 10:23 PM

It seems that somtehing have changed in the Python installation, not sure what, but CMake can no longer find the Python interpreter. I always get this error:

CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
  Could NOT find PythonInterp: Found unsuitable version "1.4", but required
  is at least "2.7" (found C:/Python27/python.exe)

1.4 means that CMake was not able to determine the version of Python. When I tried to do the same by running 'C:\Python27\python.exe -c "import sys; sys.stdout.write(sys.version)"' I got this:

  File "C:\Python34\lib\", line 176
SyntaxError: invalid syntax

Exactly the same errors popped up when chocolatey was installing pip (the python package manager):

easy.install v0.6.11.4
PATH environment variable does not have C:\Python34 in it. Adding...
PATH environment variable does not have C:\Python34\Scripts in it. Adding...
Setting PYTHONHOME environment variable to 'C:\Python34'
PS: PYTHONHOME variable is not required to Python works, but it is a good practice to have it.
Using python home at 'C:\Python34'
Installing easy_install for Python(2.7.9)...
Installing setuptools from ...
Downloading easy.install 32 bit
  from ''
Running python file: 'C:\Users\appveyor\AppData\Local\Temp\'
  File "C:\Python34\lib\", line 176
SyntaxError: invalid syntax

It seems like it installs easy setup for Python 2.7 with Python 3.4, which is kind of messed up.

  1. Support Staff 1 Posted by Feodor Fitsner on 07 Apr, 2015 11:20 PM

    Feodor Fitsner's Avatar

    It was Python 2.7.9 installed to the same location C:\Python27 ( - we were sending notification on Saturday (you can subscribe/unsubscribe on page). I'm not sure what that error means or is there any breaking changes in 2.7.9 making it unsuitable for CMake, but PATH still has the same original C:\Python27 location. If you have an idea what might cause this error or missing/outdated on build workers please let me know so we could fix the environment.

  2. Support Staff 2 Posted by Feodor Fitsner on 07 Apr, 2015 11:35 PM

    Feodor Fitsner's Avatar

    What build worker image do you use?

    I've got this result for default image on both Azure and Pro environments:

  3. 3 Posted by Zeex on 08 Apr, 2015 02:29 AM

    Zeex's Avatar

    Here are two builds for comparison, one worked fine and the other one failed (both had the same appveyor.yml):

    The only difference that I could spot is Python 2.7 had been already installed in the second (failed) build.

    I've kind of fixed this temporarily by adding C:\Python27\Scripts to PATH instead of installing pip (Python now ships with pip.exe, but it's not in PATH after installation). I guess it's a bug in the pip package from chocolatey, I'll do some more research.

  4. Support Staff 4 Posted by Feodor Fitsner on 08 Apr, 2015 02:43 AM

    Feodor Fitsner's Avatar

    Why would you need installing Python and CMake if they are already installed on build machine?

    - Feodor

  5. 5 Posted by Zeex on 08 Apr, 2015 08:01 AM

    Zeex's Avatar

    Well, you know, just in case... Actually installing python2 used to be helping me to fix some other error, can't remember which exactly right now.

  6. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:55 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac