1

Python 2.7.7 is giving Visual C++ issues when installing a package. I get the following error:

error: Setup script exited with error: command 'C:\\Program Files\\Common Files\
    \Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status
     2*
  1. I am on Windows Vista, Python 2.7.7
  2. I installed the package via the Windows cmd terminal, using "setup.py install"
  3. I have installed "Microsoft Visual C++ Compiler for Python 2.7" and ensured the path "C:\Program Files\Common Files\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe" contains "cl.exe"
  4. As per the advice here. I have checked that my Visual C++ version is compatible with my version of Python. (I have a "Visual C++ 2008 32-bit Command Prompt" shortcut at "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Visual C++ Compiler Package for Python 2.7". The 2008 version is the correct version for my version of python. (both are MSC v.1500.) )
  5. I have updated python setuptools to setuptools 17.1.1

Below is a transcript of the installation process just before the error occured:

Searching for python-axolotl-curve25519
Reading https://pypi.python.org/simple/python-axolotl-curve25519/
Best match: python-axolotl-curve25519 0.1
Downloading https://pypi.python.org/packages/source/p/python-axolotl-curve25519/
python-axolotl-curve25519-0.1.tar.gz#md5=f28d902df9044f0bf86a35a4bd2ec092
Processing python-axolotl-curve25519-0.1.tar.gz
Writing c:\users\eg\appdata\local\temp\easy_install-l68mxp\python-axolotl-curve2
5519-0.1\setup.cfg
Running python-axolotl-curve25519-0.1\setup.py -q bdist_egg --dist-dir c:\users\
eg\appdata\local\temp\easy_install-l68mxp\python-axolotl-curve25519-0.1\egg-dist
-tmp-hvxf2n
curve25519module.c
curve25519module.c(76) : error C2143: syntax error : missing ';' before 'type'
curve25519module.c(78) : error C2065: 'result' : undeclared identifier
curve25519module.c(82) : error C2143: syntax error : missing '{' before '*'
curve25519module.c(100) : warning C4133: 'return' : incompatible types - from 'P
yObject *' to 'int *'
curve25519module.c(146) : warning C4133: 'initializing' : incompatible types - f
rom 'int *(__cdecl *)(PyObject *,PyObject *)' to 'PyCFunction'
**error: Setup script exited with error: command 'C:\\Program Files\\Common Files\
\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status
 2**

I am new to this and have no idea what else to try. Would appreciate any help. Thanks in advance.

Community
  • 1
  • 1
datajunkie
  • 31
  • 1
  • 4
  • 1
    The `python-axolotl-curve` package looks like it requires the `gcc` compiler in the `mingw` GNU development environment. The [instructions for installing it on Windows](https://github.com/tgalal/python-axolotl) specifically say to install and use it. This compiler is also compatible with the version of Python you're using. – martineau Jun 20 '15 at 23:58
  • The instructions for installing it on windows says to install zlib. I downloaded zlib-1.2.8 and unzipped it but there is no setup.py file. Any idea how i can get it installed? I have completed the instructions up to that point, including nstall gcc: mingw-get.exe install gcc with no issues – datajunkie Jun 21 '15 at 06:05
  • I have completed the installation of zlib via "mingw-get.exe install zlib" (silly me!) with no issues. However I am getting the same error when i do "python setup.py install" on the "python-axolotl-0.1.7" package. (Again, the setup process will search for python-axolotl-curve25519, and the exact same code as above is repeated.) I tried downloading python-axolotl-curve25519 to install it as well and also got the exact same process and error. – datajunkie Jun 21 '15 at 06:57
  • If you're getting the same error from the `gcc` compiler, it sounds like there's something wrong with the source code itself. You might be able to find a pre-built version of the extension somewhere. [Python Extension Packages for Windows](http://www.lfd.uci.edu/~gohlke/pythonlibs/) by Christoph Gohlke is usually an good source of these, but the website appears to be down at the moment. – martineau Jun 21 '15 at 07:15
  • I read here (https://github.com/tgalal/yowsup/issues/500) that the correct axolotl package to use is 0.1.5. downloaded and tried that as well. Same issue – datajunkie Jun 21 '15 at 07:47
  • Thanks Martineau, I'm quite new and do not fully understand what I should do. Do you mean there is an issue with the gcc compiler's source code and I should find a pre-built version of the compiler? – datajunkie Jun 21 '15 at 07:50
  • No, I meant if two different compilers can't compile the C/C++ code, there's something wrong with the extension's source code. – martineau Jun 21 '15 at 09:52
  • Thanks Martineau. I think so too. Will post again if make any further progress. – datajunkie Jun 23 '15 at 17:22

1 Answers1

1

Came across this issue when installing pycocotools on windows 10. Python 2.7 does not support Visual C++ 14 that is required to compile C99 code. This is the reason for the compiling errors (C2065,C4133 etc).

I was able to solve this by,

  1. Installing Visual Studio 2015 build tools (this will install C++ 14 compiler).
  2. Installing a new newer version of Python (3.6 recommended)

More about Windows Compilers for Python here. Also check this post.

enter image description here

rakidedigama
  • 714
  • 7
  • 11