Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python package install error

Not exactly programming related, but about an error I am facing while trying to install a python package using python setup.py install.

I have downloaded the tar file for PyML package. Then after extracting I have done below steps:

On DOS prompt set the variable as below:

SET VS90COMNTOOLS=%VS110COMNTOOLS%

Go to the directory having setup.py in the extracted PyML folder and run:

python setup.py build

python setup.py install

But on both steps I get errors as below, related to ext/hash_map no such file found.

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xlocale(336) : wa rning C4530: C++ exception handler used, but unwind semantics are not enabled. S pecify /EHsc

e:\ajit\pyml-0.7.13.tar\dist\pyml-0.7.13\pyml\containers\ext\SparseDataSet.h(14) : fatal error C1083: Cannot open include file: 'ext/hash_map': No such file or directory

error: command '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\cl.e xe"' failed with exit status 2

What am I missing? How to resolve this error and install PyML.

Python version : 2.7.5 MSC v.1500 32 bit (Intel)] on win32 on Windows 8 machine.

PyML version:0.7.13

like image 529
goldenmean Avatar asked Oct 23 '13 22:10

goldenmean


Video Answer


1 Answers

First, it is recommended to use the same compiler as was used to build Python binaries, which is VS8:

Python 2.6, 2.7, and 3.1 are all built with that release (i.e. 2008). Because of another long tradition, Python extension modules must be built with the same compiler version (more specifically, CRT version) as Python itself. So to build extension modules for any of these releases, you need to have a copy of VS 2008 or VS 2008 Express.

So probably your next question fill be "How to Enforce C++ compiler to use specific CRT version?"

Second, this is not a solution in your case since there is different sintax in including tr1 libraries in gcc and msvs, see this question for example. Instead of # include <ext/hash_map> for MSVS it must be # include <hash_map>. If you insist on using MSVS, you'll probably end up modifying PyML code.

Probably, you can switch to MinGW usage, here is a step-by-step how-to, althrough I didn't check whether PyML can be built this way. Won't be able to do it earlier that Nov, 14.

like image 63
alko Avatar answered Oct 01 '22 05:10

alko