0

I am looking for a solution that allows me to install the "http-parser" package under Python 2.7 32bits and windows 10.

However, the pip install http-parser command returns this error:

Installing collected packages: http-parser
  Running setup.py install for http-parser ... error
    Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\marshall\\appdata\\local\\temp\\pip-install-xjzdsh\\http-parser\\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\marshall\appdata\local\temp\pip-record-tmxbux\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-2.7
    creating build\lib.win32-2.7\http_parser
    copying http_parser\http.py -> build\lib.win32-2.7\http_parser
    copying http_parser\pyparser.py -> build\lib.win32-2.7\http_parser
    copying http_parser\reader.py -> build\lib.win32-2.7\http_parser
    copying http_parser\util.py -> build\lib.win32-2.7\http_parser
    copying http_parser\_socketio.py -> build\lib.win32-2.7\http_parser
    copying http_parser\__init__.py -> build\lib.win32-2.7\http_parser
    running build_ext
    building 'http_parser.parser' extension
    creating build\temp.win32-2.7
    creating build\temp.win32-2.7\Release
    creating build\temp.win32-2.7\Release\http_parser
    C:\msys64\mingw64\bin\gcc.exe -mdll -O -Wall -Iparser -Ic:\python27\include -Ic:\python27\PC -c http_parser\http_parser.c -o build\temp.win32-2.7\Release\http_parser\http_parser.o
    C:\msys64\mingw64\bin\gcc.exe -mdll -O -Wall -Iparser -Ic:\python27\include -Ic:\python27\PC -c http_parser\parser.c -o build\temp.win32-2.7\Release\http_parser\parser.o
    http_parser\parser.c: In function '__Pyx_RaiseArgtupleInvalid':
    http_parser\parser.c:6570:18: warning: unknown conversion type character 'z' in format [-Wformat=]
                      "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                      ^~~~~~~~~~~~~~~~~
    http_parser\parser.c:75:34: note: format string is defined here
       #define CYTHON_FORMAT_SSIZE_T "z"
                                      ^
    http_parser\parser.c:6570:18: warning: format '%s' expects argument of type 'char *', but argument 5 has type 'Py_ssize_t {aka int}' [-Wformat=]
                      "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                      ^~~~~~~~~~~~~~~~~
    http_parser\parser.c:6570:81: note: format string is defined here
                      "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                                                                                    ~^
                                                                                    %d
    http_parser\parser.c:6570:18: warning: unknown conversion type character 'z' in format [-Wformat=]
                      "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                      ^~~~~~~~~~~~~~~~~
    http_parser\parser.c:75:34: note: format string is defined here
       #define CYTHON_FORMAT_SSIZE_T "z"
                                      ^
    http_parser\parser.c:6570:18: warning: too many arguments for format [-Wformat-extra-args]
                      "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                      ^~~~~~~~~~~~~~~~~
    http_parser\parser.c: In function '__Pyx_RaiseTooManyValuesError':
    http_parser\parser.c:6577:18: warning: unknown conversion type character 'z' in format [-Wformat=]
                      "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    http_parser\parser.c:75:34: note: format string is defined here
       #define CYTHON_FORMAT_SSIZE_T "z"
                                      ^
    http_parser\parser.c:6577:18: warning: too many arguments for format [-Wformat-extra-args]
                      "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    http_parser\parser.c: In function '__Pyx_RaiseNeedMoreValuesError':
    http_parser\parser.c:6582:18: warning: unknown conversion type character 'z' in format [-Wformat=]
                      "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
                      ^~~~~~~~~~~~~~~~~~
    http_parser\parser.c:75:34: note: format string is defined here
       #define CYTHON_FORMAT_SSIZE_T "z"
                                      ^
    http_parser\parser.c:6582:18: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t {aka int}' [-Wformat=]
                      "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
                      ^~~~~~~~~~~~~~~~~~
    http_parser\parser.c:6582:68: note: format string is defined here
                      "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
                                                                       ~^
                                                                       %d
    http_parser\parser.c:6582:18: warning: too many arguments for format [-Wformat-extra-args]
                      "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
                      ^~~~~~~~~~~~~~~~~~
    writing build\temp.win32-2.7\Release\http_parser\parser.def
    C:\msys64\mingw64\bin\gcc.exe -shared -s build\temp.win32-2.7\Release\http_parser\http_parser.o build\temp.win32-2.7\Release\http_parser\parser.o build\temp.win32-2.7\Release\http_parser\parser.def -Lc:\python27\libs -Lc:\python27\PCbuild -Lc:\python27\PC\VS9.0 -lpython27 -lmsvcr90 -o build\lib.win32-2.7\http_parser\parser.pyd
    C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:\python27\libs/libpython27.a when searching for -lpython27
    C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:\python27\libs/python27.lib when searching for -lpython27
    C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:\python27\libs\libpython27.a when searching for -lpython27
    C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:\python27\libs/libpython27.a when searching for -lpython27
    C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:\python27\libs/python27.lib when searching for -lpython27
    C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:\python27\libs\python27.lib when searching for -lpython27
    C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpython27
    collect2.exe: error: ld returned 1 exit status
    error: command 'C:\\msys64\\mingw64\\bin\\gcc.exe' failed with exit status 1

This is not the first time I have encountered such an error (gcc.exe failed with exit status 1), but each time I managed to solve it by finding an executable or a wheel of the package ...

But I really do not find anything on this one .. :(

It has been a few hours since I am stuck on this problem. Could you help me?

SOLUTION:

I had to install Microsoft Visual C ++ Compiler for Python from http://www.microsoft.com/en-us/download/details.aspx?id=44266

Then I had to use a command to install it via pip. This command was given by Anton K under this question:

How to use MinGW's gcc compiler when installing Python package using Pip?

Here it is: pip install --global-option build_ext --global-option --compiler = msvc <package_zip>

This solved my problem :)

Marshall Cocop
  • 151
  • 3
  • 16
  • you must simply install the gcc compiler on the packages of mingw64, because it must compile C++ Codes – Skiller Dz Jun 10 '18 at 16:24
  • Thank you for your answer :) Yes, gcc is needed for compilation..But I already have it, that of mingw64 .. And it is well in path and it is functional – Marshall Cocop Jun 10 '18 at 16:49
  • gcc in windows is quite a painful thing. I think this article may help: https://github.com/cython/cython/wiki/CythonExtensionsOnWindows – Andrii Maletskyi Jun 10 '18 at 17:36
  • Your solution has actually helped me to go the right way :) I write my message indicating the solution. thank you very much – Marshall Cocop Jun 11 '18 at 12:23

0 Answers0