Open scerbos opened 6 years ago
same question!
Thanks for reporting the issue.
I don't have a Windows machine to try it, but it looks like you don't have make
available in your PATH.
If it's not the case, could you clone the repo and run make
in it and report what you got?
Huzzah! thanks @sbarzowski. Adding make
did the trick, although it seems it still errors out with the Visual Studio compiler so having the distutils.cfg I mentioned in my previous post was necessary.
For others having this problem, I installed msys-base and added it to my windows PATH and created a distutils.cfg, specifying to use the mingw32 compiler, in C:\YourPythonDirectoryRoot\Lib\distutils.
For Google Fu and cross platform debugging purposes I am adding the error I got when using the Visual Studio compiler. You'll notice it is trying to use the C++ for Python library and still fails.
C:\Python27\Scripts>pip install jsonnet
Collecting jsonnet
Using cached jsonnet-0.10.0.tar.gz
Installing collected packages: jsonnet
Running setup.py install for jsonnet ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\scerbos\\appdata\\local\\temp\\pip-build-bzkhqc\\jsonnet\\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\scerbos\appdata\local\temp\pip-szciat-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 core/desugarer.cpp -o core/desugarer.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 core/formatter.cpp -o core/formatter.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 core/libjsonnet.cpp -o core/libjsonnet.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 core/lexer.cpp -o core/lexer.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 core/parser.cpp -o core/parser.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 core/pass.cpp -o core/pass.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 core/static_analysis.cpp -o core/static_analysis.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 core/string_utils.cpp -o core/string_utils.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 core/vm.cpp -o core/vm.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 third_party/md5/md5.cpp -o third_party/md5/md5.o
building '_jsonnet' extension
creating build
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
creating build\temp.win32-2.7\Release\python
C:\Users\scerbos\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Iinclude -Ithird_party/md5 -Ic:\python27\include -Ic:\python27\PC /Tcpython/_jsonnet.c /Fobuild\temp.win32-2.7\Release\python/_jsonnet.obj
_jsonnet.c
python/_jsonnet.c(35) : error C2275: 'PyObject' : illegal use of this type as an expression
c:\python27\include\object.h(108) : see declaration of 'PyObject'
python/_jsonnet.c(35) : error C2065: 'exc_str' : undeclared identifier
python/_jsonnet.c(39) : error C2065: 'exc_str' : undeclared identifier
python/_jsonnet.c(39) : warning C4047: 'function' : 'PyObject *' differs in levels of indirection from 'int'
python/_jsonnet.c(39) : warning C4024: 'PyString_AsString' : different types for formal and actual parameter 1
python/_jsonnet.c(147) : warning C4018: '<' : signed/unsigned mismatch
python/_jsonnet.c(188) : error C2143: syntax error : missing ';' before 'const'
python/_jsonnet.c(189) : error C2143: syntax error : missing ';' before 'type'
python/_jsonnet.c(190) : error C2065: 'r' : undeclared identifier
python/_jsonnet.c(190) : warning C4047: '!=' : 'int' differs in levels of indirection from 'void *'
python/_jsonnet.c(194) : error C2065: 'r' : undeclared identifier
python/_jsonnet.c(194) : error C2065: 'err_msg' : undeclared identifier
python/_jsonnet.c(194) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'
python/_jsonnet.c(194) : warning C4024: 'jsonnet_json_make_string' : different types for formal and actual parameter 2
python/_jsonnet.c(194) : warning C4047: '=' : 'int' differs in levels of indirection from 'JsonnetJsonValue *'
python/_jsonnet.c(196) : error C2065: 'r' : undeclared identifier
python/_jsonnet.c(196) : warning C4047: 'return' : 'JsonnetJsonValue *' differs in levels of indirection from 'int'
python/_jsonnet.c(282) : error C2275: 'PyObject' : illegal use of this type as an expression
c:\python27\include\object.h(108) : see declaration of 'PyObject'
python/_jsonnet.c(282) : error C2065: 'key' : undeclared identifier
python/_jsonnet.c(282) : error C2065: 'val' : undeclared identifier
python/_jsonnet.c(282) : error C2100: illegal indirection
python/_jsonnet.c(283) : error C2275: 'Py_ssize_t' : illegal use of this type as an expression
c:\python27\include\pyport.h(183) : see declaration of 'Py_ssize_t'
python/_jsonnet.c(283) : error C2146: syntax error : missing ';' before identifier 'pos'
python/_jsonnet.c(283) : error C2065: 'pos' : undeclared identifier
python/_jsonnet.c(285) : error C2065: 'pos' : undeclared identifier
python/_jsonnet.c(285) : error C2065: 'key' : undeclared identifier
python/_jsonnet.c(285) : warning C4047: 'function' : 'PyObject **' differs in levels of indirection from 'int *'
python/_jsonnet.c(285) : warning C4024: 'PyDict_Next' : different types for formal and actual parameter 3
python/_jsonnet.c(285) : error C2065: 'val' : undeclared identifier
python/_jsonnet.c(285) : warning C4047: 'function' : 'PyObject **' differs in levels of indirection from 'int *'
python/_jsonnet.c(285) : warning C4024: 'PyDict_Next' : different types for formal and actual parameter 4
python/_jsonnet.c(289) : error C2065: 'key' : undeclared identifier
python/_jsonnet.c(289) : warning C4047: 'function' : 'PyObject *' differs in levels of indirection from 'int'
python/_jsonnet.c(289) : warning C4024: 'PyString_AsString' : different types for formal and actual parameter 1
python/_jsonnet.c(298) : error C2143: syntax error : missing ';' before 'const'
python/_jsonnet.c(300) : error C2065: 'val_' : undeclared identifier
python/_jsonnet.c(300) : warning C4047: '==' : 'int' differs in levels of indirection from 'void *'
python/_jsonnet.c(305) : error C2065: 'val_' : undeclared identifier
python/_jsonnet.c(305) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'
python/_jsonnet.c(305) : warning C4024: 'jsonnet_ext_var' : different types for formal and actual parameter 3
python/_jsonnet.c(307) : error C2065: 'val_' : undeclared identifier
python/_jsonnet.c(307) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'
python/_jsonnet.c(307) : warning C4024: 'jsonnet_ext_code' : different types for formal and actual parameter 3
python/_jsonnet.c(309) : error C2065: 'val_' : undeclared identifier
python/_jsonnet.c(309) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'
python/_jsonnet.c(309) : warning C4024: 'jsonnet_tla_var' : different types for formal and actual parameter 3
python/_jsonnet.c(311) : error C2065: 'val_' : undeclared identifier
python/_jsonnet.c(311) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'
python/_jsonnet.c(311) : warning C4024: 'jsonnet_tla_code' : different types for formal and actual parameter 3
python/_jsonnet.c(426) : error C2143: syntax error : missing ';' before 'const'
python/_jsonnet.c(431) : error C2065: 'params_c' : undeclared identifier
python/_jsonnet.c(431) : error C2109: subscript requires array or pointer type
python/_jsonnet.c(434) : error C2065: 'params_c' : undeclared identifier
python/_jsonnet.c(434) : error C2109: subscript requires array or pointer type
python/_jsonnet.c(439) : error C2065: 'params_c' : undeclared identifier
python/_jsonnet.c(439) : warning C4047: 'function' : 'const char *const *' differs in levels of indirection from 'int'
python/_jsonnet.c(439) : warning C4024: 'jsonnet_native_callback' : different types for formal and actual parameter 5
python/_jsonnet.c(440) : error C2065: 'params_c' : undeclared identifier
python/_jsonnet.c(440) : warning C4022: 'free' : pointer mismatch for actual parameter 1
python/_jsonnet.c(448) : error C2143: syntax error : missing '{' before '*'
python/_jsonnet.c(488) : error C2143: syntax error : missing ';' before 'type'
python/_jsonnet.c(489) : error C2065: 'ctx' : undeclared identifier
python/_jsonnet.c(489) : warning C4133: 'function' : incompatible types - from 'int *' to 'ImportCtx *'
python/_jsonnet.c(492) : error C2143: syntax error : missing ';' before 'type'
python/_jsonnet.c(493) : error C2065: 'ctxs' : undeclared identifier
python/_jsonnet.c(493) : warning C4047: 'function' : 'NativeCtx **' differs in levels of indirection from 'int *'
python/_jsonnet.c(493) : warning C4024: 'handle_native_callbacks' : different types for formal and actual parameter 3
python/_jsonnet.c(494) : error C2065: 'ctxs' : undeclared identifier
python/_jsonnet.c(494) : warning C4022: 'free' : pointer mismatch for actual parameter 1
python/_jsonnet.c(498) : error C2065: 'ctxs' : undeclared identifier
python/_jsonnet.c(498) : warning C4022: 'free' : pointer mismatch for actual parameter 1
python/_jsonnet.c(499) : warning C4133: 'return' : incompatible types - from 'PyObject *' to 'int *'
python/_jsonnet.c(502) : error C2143: syntax error : missing '{' before '*'
python/_jsonnet.c(542) : error C2143: syntax error : missing ';' before 'type'
python/_jsonnet.c(543) : error C2065: 'ctx' : undeclared identifier
python/_jsonnet.c(543) : warning C4133: 'function' : incompatible types - from 'int *' to 'ImportCtx *'
python/_jsonnet.c(546) : error C2143: syntax error : missing ';' before 'type'
python/_jsonnet.c(547) : error C2065: 'ctxs' : undeclared identifier
python/_jsonnet.c(547) : warning C4047: 'function' : 'NativeCtx **' differs in levels of indirection from 'int *'
python/_jsonnet.c(547) : warning C4024: 'handle_native_callbacks' : different types for formal and actual parameter 3
python/_jsonnet.c(548) : error C2065: 'ctxs' : undeclared identifier
python/_jsonnet.c(548) : warning C4022: 'free' : pointer mismatch for actual parameter 1
python/_jsonnet.c(552) : error C2065: 'ctxs' : undeclared identifier
python/_jsonnet.c(552) : warning C4022: 'free' : pointer mismatch for actual parameter 1
python/_jsonnet.c(553) : warning C4133: 'return' : incompatible types - from 'PyObject *' to 'int *'
python/_jsonnet.c(556) : error C2061: syntax error : identifier 'module_methods'
python/_jsonnet.c(556) : error C2059: syntax error : ';'
python/_jsonnet.c(556) : error C3409: empty attribute block is not allowed
python/_jsonnet.c(556) : error C2513: '/*global*/ ' : no variable declared before '='
python/_jsonnet.c(581) : error C2065: 'module_methods' : undeclared identifier
python/_jsonnet.c(581) : warning C4047: 'function' : 'PyMethodDef *' differs in levels of indirection from 'int'
python/_jsonnet.c(581) : warning C4024: 'Py_InitModule4' : different types for formal and actual parameter 2
error: command 'C:\\Users\\scerbos\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\scerbos\\appdata\\local\\temp\\pip-build-bzkhqc\\jsonnet\\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\scerbos\appdata\local\temp\pip-szciat-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\scerbos\appdata\local\temp\pip-build-bzkhqc\jsonnet\
@sbarzowski I may have celebrated too early...
When I try to import jsonnet I am getting a DLL load failed error.
C:\Users\Disney>C:\Python27\python.exe
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import _jsonnet
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified procedure could not be found.
>>> quit()
Thoughts?
It's a shame it doesn't say which procedure it is. One idea is that maybe hardcoded .so
extension for libraries breaks it on Win.
Do you want me to write another issue for it? Or is this something that probably wont be supported in the near future?
We can follow up on it in this issue, I think.
We would like it to work flawlessly on Windows machines. However, it can be quite tricky to fix issues on Windows, because contributors, from what I observed, tend to use Linux or Mac. So, to be honest, it can take a while before someone gets a Windows machine to debug this. Any help would be greatly appreciated.
I've started work on AppVeyor builds #469. They currently only build the core product, but it shouldn't take much to build and test Python modules against multiple version of Python. The standard AppVeyor images come with many versions preinstalled https://www.appveyor.com/docs/build-environment/#python.
Have you tried using the contents of the vs2017 dir to build Jsonnet itself? It may be possible to extend that to build the _jsonnet.dll. However I don't think what you're doing (running the Python bindings in Windows) has ever been done before. In principle it should work though.
Are there any alternatives for getting it to work on Windows?
I also need a workaround for jsonnet on Windows 10
i also need
Hi @sbarzowski and @marcelocantos , Perhaps you can advise how to proceed:
I also needed jsonnet to build and run on my Windows machine. After starting with the same error that started this thread I managed to have some progress:
This got me to the point where pip install jsonnet
builds jsonnet but fails during the link phase.
I am getting the following error:
fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'
I suspect there should be a way to set the platform to be x64, but it was beyond my C++ knowledge.
And here is the full error stacktrace, if it helps:
PS C:\Git\agogosml\agogosml_cli> pip install jsonnet
Collecting jsonnet
Using cached https://files.pythonhosted.org/packages/60/dc/3abd3971869a741d7acdba166d71d4f9366b6b53028dfd56f95de356af0f/jsonnet-0.12.1.tar.gz
Installing collected packages: jsonnet
Running setup.py install for jsonnet ... error
Complete output from command c:\users\ityer\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ityer\\AppData\\Local\\Temp\\pip-install-vmghb_uf\\jsonnet\\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\ityer\AppData\Local\Temp\pip-record-o079eo1u\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/desugarer.cpp -o core/desugarer.o
core/desugarer.cpp: In member function 'AST* Desugarer::makeArrayComprehension(ArrayComprehension*, unsigned int)':
core/desugarer.cpp:406:67: warning: unused parameter 'obj_level' [-Wunused-parameter]
AST* makeArrayComprehension(ArrayComprehension *ast, unsigned obj_level) {
~~~~~~~~~^~~~~~~~~
core/desugarer.cpp: In member function 'void Desugarer::desugar(AST*&, unsigned int)':
core/desugarer.cpp:729:51: warning: this statement may fall through [-Wimplicit-fallthrough=]
case BOP_MANIFEST_UNEQUAL: invert = true;
~~~~~~~^~~~~~
core/desugarer.cpp:730:17: note: here
case BOP_MANIFEST_EQUAL: {
^~~~
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/formatter.cpp -o core/formatter.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/libjsonnet.cpp -o core/libjsonnet.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/lexer.cpp -o core/lexer.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/parser.cpp -o core/parser.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/pass.cpp -o core/pass.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/static_analysis.cpp -o core/static_analysis.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/string_utils.cpp -o core/string_utils.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/vm.cpp -o core/vm.o
core/vm.cpp: In member function 'const AST* {anonymous}::Interpreter::builtinSplitLimit(const LocationRange&, const std::vector<{anonymous}::Value>&)':
core/vm.cpp:1337:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char32_t>::size_type' {aka 'unsigned int'} [-Wsign-compare]
while (test < str->value.size() && (maxsplits == -1 ||
~~~~~^~~~~~~~~~~~~~~~~~~
core/vm.cpp:1338:55: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<{anonymous}::HeapThunk*>::size_type' {aka 'unsigned int'} [-Wsign-compare]
maxsplits > elements.size())) {
~~~~~~~~~~^~~~~~~~~~~~~~~~~
core/vm.cpp: In member function 'const AST* {anonymous}::Interpreter::builtinSubstr(const LocationRange&, const std::vector<{anonymous}::Value>&)':
core/vm.cpp:1362:24: warning: comparison of integer expressions of different signedness: 'long int' and 'std::__cxx11::basic_string<char32_t>::size_type' {aka 'unsigned int'} [-Wsign-compare]
if (len + from > str->value.size()) {
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
core/vm.cpp: In member function 'const AST* {anonymous}::Interpreter::builtinAsciiLower(const LocationRange&, const std::vector<{anonymous}::Value>&)':
core/vm.cpp:1419:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char32_t>::size_type' {aka 'unsigned int'} [-Wsign-compare]
for (int i = 0; i < new_str.size(); ++i) {
~~^~~~~~~~~~~~~~~~
core/vm.cpp: In member function 'const AST* {anonymous}::Interpreter::builtinAsciiUpper(const LocationRange&, const std::vector<{anonymous}::Value>&)':
core/vm.cpp:1433:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char32_t>::size_type' {aka 'unsigned int'} [-Wsign-compare]
for (int i = 0; i < new_str.size(); ++i) {
~~^~~~~~~~~~~~~~~~
core/vm.cpp: In member function 'const AST* {anonymous}::Interpreter::joinStrings(const {anonymous}::Value&, const {anonymous}::Value&, unsigned int, UString)':
core/vm.cpp:1533:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<{anonymous}::HeapThunk*>::size_type' {aka 'unsigned int'} [-Wsign-compare]
for (int i = idx; i < elements.size(); ++i) {
~~^~~~~~~~~~~~~~~~~
core/vm.cpp: In member function 'const AST* {anonymous}::Interpreter::joinArrays(const {anonymous}::Value&, const {anonymous}::Value&, unsigned int, std::vector<{anonymous}::HeapThunk*>&)':
core/vm.cpp:1577:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<{anonymous}::HeapThunk*>::size_type' {aka 'unsigned int'} [-Wsign-compare]
for (int i = idx; i < elements.size(); ++i) {
~~^~~~~~~~~~~~~~~~~
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json third_party/md5/md5.cpp -o third_party/md5/md5.o
building '_jsonnet' extension
creating build
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\python
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Iinclude -Ithird_party/md5 -Ithird_party/json -Ic:\users\ityer\appdata\local\programs\python\python37\include -Ic:\users\ityer\appdata\local\programs\python\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcpython/_jsonnet.c /Fobuild\temp.win-amd64-3.7\Release\python/_jsonnet.obj
_jsonnet.c
python/_jsonnet.c(440): warning C4090: 'function': different 'const' qualifiers
creating C:\Users\ityer\AppData\Local\Temp\pip-install-vmghb_uf\jsonnet\build\lib.win-amd64-3.7
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c:\users\ityer\appdata\local\programs\python\python37\libs /LIBPATH:c:\users\ityer\appdata\local\programs\python\python37\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64" /EXPORT:PyInit__jsonnet build\temp.win-amd64-3.7\Release\python/_jsonnet.obj core/desugarer.o core/formatter.o core/libjsonnet.o core/lexer.o core/parser.o core/pass.o core/static_analysis.o core/string_utils.o core/vm.o third_party/md5/md5.o /OUT:build\lib.win-amd64-3.7\_jsonnet.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\python\_jsonnet.cp37-win_amd64.lib
core\desugarer.o : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\link.exe' failed with exit status 1112
----------------------------------------
Command "c:\users\ityer\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ityer\\AppData\\Local\\Temp\\pip-install-vmghb_uf\\jsonnet\\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\ityer\AppData\Local\Temp\pip-record-o079eo1u\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ityer\AppData\Local\Temp\pip-install-vmghb_uf\jsonnet\
Pip is an additional complication here, let's get the basic build working from source first.
I suspect the only way to a smooth experience here is to build more natively with windows instead of using Make. There's vs2017 files in the repo that might help. Also there is cmake, which can generate them (I don't think anyone's tried this).
You would probably have to add the python module to these things, which would mean figuring out how to link against the Python SDK in the IDE.
Thanks @sparkprime , Can you explain how to add the python modules? or perhaps point me to the correct place to read?
It should just be a case of adding python/_jsonnet.c into the mix and building a DLL but I've never done it on windows. You'd have to point it to the python headers and libraries too, but I imagine they come with any Python installation.
@sbarzowski I may have celebrated too early...
When I try to import jsonnet I am getting a DLL load failed error.
C:\Users\Disney>C:\Python27\python.exe Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import _jsonnet Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: DLL load failed: The specified procedure could not be found. >>> quit()
Thoughts?
Python is compiled with MSVC and your library with g++ so maybe there is a problem with ABI.
I managed to run pip install jsonnet
on Windows 10 after a bit of digging, so here's a step-by-step guide for anyone else who needs it.
This is assuming x64 Windows and Python.
Install MinGW-w64, for instance to C:\MinGW-w64
.
Only this MinGW variation worked for me in the end. Don't use MSYS2. Don't use Win-Builds.
Make sure to choose the right architecture of MinGW on install:
Add C:\MinGW-w64\mingw64\bin
to your PATH. Make sure that it's early enough and resolves first:
> where.exe g++
C:\mingw-w64\mingw64\bin\g++.exe
If your MinGW installation has make.exe
in the PATH, you're good. Mine for some reason has it named mingw32-make.exe
, so I had to make a symlink. This is really easy, just run in PowerShell:
New-Item -Type SymbolicLink -Path C:\MinGW-w64\mingw64\bin -Name make.exe -Value C:\MinGW-w64\mingw64\bin\mingw32-make.exe
Tell pip to use MinGW for native package compilation instead of MSVC. Create a file ${YOUR_PYTHON_INSTALL_PATH}\Lib\distutils\distutils.cfg
with the following content:
[build]
compiler=mingw32
[build_ext]
compiler=mingw32
This is temporary, you can remove this config afterwards.
IMPORTANT: at this point, pip install jsonnet
should no longer fail with the error message running build_ext error: [WinError 2] The system cannot find the file specified
. It might fail at a later stage – please read further to fix the subsequent errors.
If you still see The system cannot find the file specified
, stop and ensure that make.exe
is in your PATH:
> where.exe make
C:\MinGW-w64\mingw64\bin\make.exe
Download and install the Build Tools for Visual Studio. I have VS2017, but 2019 or 2015 should work fine as well.
Now we need to patch distutils, which hasn't been built to use the newest build/link tools of MSVC together with MinGW properly. This is a long story, you can read it in the associated issue thread, if you want. To summarize, there's a proposed patch that makes the MinGW linker find the right runtime DLL, but it doesn't work 100% of the time and in all circumstances, so the patch hasn't been merged yet. Nevertheless, it will work just fine in our case.
Download patch.diff and put it somewhere. Then do the following:
cd ${YOUR_PYTHON_INSTALL_PATH}\lib\distutils
# Back up the original version of the file
cp cygwinccompiler.py '~cygwinccompiler.py'
# Patch cygwinccompiler.py using the saved patch.diff
pip install patch
python -m patch patch.diff
Copy vcruntime140.dll
to ${YOUR_PYTHON_INSTALL_PATH}\libs
:
cd ${YOUR_PYTHON_INSTALL_PATH}
cp vcruntime140.dll .\libs
Generate library definitions for vcruntime140.dll
:
cd ${YOUR_PYTHON_INSTALL_PATH}\libs
gendef vcruntime140.dll
This should generate ${YOUR_PYTHON_INSTALL_PATH}\libs\vcruntime140.def
of approximately 1.51 KB.
Note: gendef
is a MinGW version of the pexports
tool. Various guides on the Internet tell to use pexports
for generating def-files, but my MinGW installation included only gendef
, which has slightly different commandline flags and behavior, but ultimately does the same thing.
Now we should be able to run pip install jsonnet
, compilation and linking should proceed without problems. Here's a small test:
>>> import _jsonnet
>>> jn_str = "{ test: 'foo', other: 'bar' + self.test, /* comment */ }"
>>> json_str = _jsonnet.evaluate_snippet("", jn_str)
>>> print(json_str)
{
"other": "barfoo",
"test": "foo"
}
Thanks for writing this up!
@alexpolozov Thanks for the writeup but sadly did not fix it for me. I feel utterly useless but I just switched from macOS to Windows so I have no idea where to begin to fix this.
Installing collected packages: jsonnet
Running setup.py install for jsonnet ... error
Complete output from command c:\users\rik\scoop\apps\python\3.7.3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\rik\\AppData\\Local\\Temp\\pip-install-sxlb1b5o\\jsonnet\\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\rik\AppData\Local\Temp\pip-record-vg8ppfsr\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
error: [WinError 2] The system cannot find the file specified
----------------------------------------
Command "c:\users\rik\scoop\apps\python\3.7.3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\rik\\AppData\\Local\\Temp\\pip-install-sxlb1b5o\\jsonnet\\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\rik\AppData\Local\Temp\pip-record-vg8ppfsr\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\rik\AppData\Local\Temp\pip-install-sxlb1b5o\jsonnet\
@RXminuS The message The system cannot find the file specified
indicates that make
is not in your PATH. Make sure that you've followed steps 2-3 correctly.
@alexpolozov Thank you so much for the instructions. I think that patch is not working correctly. I get the following error in the final step:
C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmsvcr140
collect2.exe: error: ld returned 1 exit status
error: command 'C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe' failed with exit status 1
Any ideas?
@zeeshansayyed This error is not about the patch. Your error is at the linking stage (ld.exe
), not at the compiling stage (g++
).
Make sure that your ${PYTHON}/libs
subdirectory contains both vcruntime140.dll
and vcruntime140.def
. The linker looks specifically in this directory (among others) for the linked DLLs (you can check this in the full command line for g++
and/or ld
when it's printed in the pip install
log).
@alexpolozov I confirmed. It does have both the vcruntime140.dll
and vcruntime140.dev
. The output of my dir command is as follows:
(dl) C:\Users*\AppData\Local\Continuum\anaconda3\envs\dl\libs>dir Volume in drive C is OS Volume Serial Number is
Directory of C:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\libs
<DIR> .
<DIR> ..
170,564 python3.lib
342,616 python37.lib
1,545 vcruntime140.def
87,200 vcruntime140.dll
1,750 _tkinter.lib
Note: where.exe python
gives me the following path:
C:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\python.exe
Also, the complete log of pip install
is as follows:
Collecting jsonnet
Using cached https://files.pythonhosted.org/packages/60/dc/3abd3971869a741d7acdba166d71d4f9366b6b53028dfd56f95de356af0f/jsonnet-0.12.1.tar.gz
Building wheels for collected packages: jsonnet
Building wheel for jsonnet (setup.py) ... error
ERROR: Complete output from command 'C:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\****\\AppData\\Local\\Temp\\pip-install-6m_g55h8\\jsonnet\\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\****\AppData\Local\Temp\pip-wheel-9lds9zhf' --python-tag cp37:
ERROR: running bdist_wheel
running build
running build_ext
error: [WinError 2] The system cannot find the file specified
----------------------------------------
ERROR: Failed building wheel for jsonnet
Running setup.py clean for jsonnet
Failed to build jsonnet
Installing collected packages: jsonnet
Running setup.py install for jsonnet ... error
ERROR: Complete output from command 'C:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\****\\AppData\\Local\\Temp\\pip-install-6m_g55h8\\jsonnet\\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\****\AppData\Local\Temp\pip-record-uh1q3b7l\install-record.txt' --single-version-externally-managed --compile:
ERROR: running install
running build
running build_ext
error: [WinError 2] The system cannot find the file specified
----------------------------------------
ERROR: Command "'C:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\****\\AppData\\Local\\Temp\\pip-install-6m_g55h8\\jsonnet\\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\****\AppData\Local\Temp\pip-record-uh1q3b7l\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\****\AppData\Local\Temp\pip-install-6m_g55h8\jsonnet\
@zeeshansayyed Please read the questions above yours. The message The system cannot find the file specified
occurs way before linking and indicates that make
is not in your PATH. Make sure that you've followed steps 2-4 correctly.
Generally speaking, there are about 3-4 things that can go wrong during this installation, they are indicated with different errors at different steps of the installation, and my walkthrough addresses them in order.
@alexpolozov My apologies. The previous log I posted was from the wrong terminal which didn't have the environment variable updated. The lines from the first log (my first comment) are posted below. Please ignore the log containing The system cannot find the file specified
:
pip install jsonnet
Collecting jsonnet
Using cached https://files.pythonhosted.org/packages/60/dc/3abd3971869a741d7acdba166d71d4f9366b6b53028dfd56f95de356af0f/jsonnet-0.12.1.tar.gz
Building wheels for collected packages: jsonnet
Building wheel for jsonnet (setup.py) ... error
ERROR: Complete output from command 'C:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\****\\AppData\\Local\\Temp\\pip-install-tmcor2tp\\jsonnet\\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\****\AppData\Local\Temp\pip-wheel-_lma5c4w' --python-tag cp37:
ERROR: running bdist_wheel
running build
running build_ext
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/desugarer.cpp -o core/desugarer.o
core/desugarer.cpp: In member function 'AST* Desugarer::makeArrayComprehension(ArrayComprehension*, unsigned int)':
core/desugarer.cpp:406:67: warning: unused parameter 'obj_level' [-Wunused-parameter]
AST* makeArrayComprehension(ArrayComprehension *ast, unsigned obj_level) {
~~~~~~~~~^~~~~~~~~
core/desugarer.cpp: In member function 'void Desugarer::desugar(AST*&, unsigned int)':
core/desugarer.cpp:729:51: warning: this statement may fall through [-Wimplicit-fallthrough=]
case BOP_MANIFEST_UNEQUAL: invert = true;
~~~~~~~^~~~~~
core/desugarer.cpp:730:17: note: here
case BOP_MANIFEST_EQUAL: {
^~~~
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/formatter.cpp -o core/formatter.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/libjsonnet.cpp -o core/libjsonnet.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/lexer.cpp -o core/lexer.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/parser.cpp -o core/parser.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/pass.cpp -o core/pass.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/static_analysis.cpp -o core/static_analysis.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/string_utils.cpp -o core/string_utils.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/vm.cpp -o core/vm.o
core/vm.cpp: In member function 'const AST* {anonymous}::Interpreter::builtinSplitLimit(const LocationRange&, const std::vector<{anonymous}::Value>&)':
core/vm.cpp:1337:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char32_t>::size_type' {aka 'long long unsigned int'} [-Wsign-compare]
while (test < str->value.size() && (maxsplits == -1 ||
~~~~~^~~~~~~~~~~~~~~~~~~
core/vm.cpp:1338:55: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<{anonymous}::HeapThunk*>::size_type' {aka 'long long unsigned int'} [-Wsign-compare]
maxsplits > elements.size())) {
~~~~~~~~~~^~~~~~~~~~~~~~~~~
core/vm.cpp: In member function 'const AST* {anonymous}::Interpreter::builtinSubstr(const LocationRange&, const std::vector<{anonymous}::Value>&)':
core/vm.cpp:1362:24: warning: comparison of integer expressions of different signedness: 'long int' and 'std::__cxx11::basic_string<char32_t>::size_type' {aka 'long long unsigned int'} [-Wsign-compare]
if (len + from > str->value.size()) {
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
core/vm.cpp: In member function 'const AST* {anonymous}::Interpreter::builtinAsciiLower(const LocationRange&, const std::vector<{anonymous}::Value>&)':
core/vm.cpp:1419:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char32_t>::size_type' {aka 'long long unsigned int'} [-Wsign-compare]
for (int i = 0; i < new_str.size(); ++i) {
~~^~~~~~~~~~~~~~~~
core/vm.cpp: In member function 'const AST* {anonymous}::Interpreter::builtinAsciiUpper(const LocationRange&, const std::vector<{anonymous}::Value>&)':
core/vm.cpp:1433:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char32_t>::size_type' {aka 'long long unsigned int'} [-Wsign-compare]
for (int i = 0; i < new_str.size(); ++i) {
~~^~~~~~~~~~~~~~~~
core/vm.cpp: In member function 'const AST* {anonymous}::Interpreter::joinStrings(const {anonymous}::Value&, const {anonymous}::Value&, unsigned int, UString)':
core/vm.cpp:1533:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<{anonymous}::HeapThunk*>::size_type' {aka 'long long unsigned int'} [-Wsign-compare]
for (int i = idx; i < elements.size(); ++i) {
~~^~~~~~~~~~~~~~~~~
core/vm.cpp: In member function 'const AST* {anonymous}::Interpreter::joinArrays(const {anonymous}::Value&, const {anonymous}::Value&, unsigned int, std::vector<{anonymous}::HeapThunk*>&)':
core/vm.cpp:1577:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<{anonymous}::HeapThunk*>::size_type' {aka 'long long unsigned int'} [-Wsign-compare]
for (int i = idx; i < elements.size(); ++i) {
~~^~~~~~~~~~~~~~~~~
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json third_party/md5/md5.cpp -o third_party/md5/md5.o
building '_jsonnet' extension
creating build
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\python
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -Iinclude -Ithird_party/md5 -Ithird_party/json -IC:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\include -IC:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\include -c python/_jsonnet.c -o build\temp.win-amd64-3.7\Release\python\_jsonnet.o
writing build\temp.win-amd64-3.7\Release\python\_jsonnet.cp37-win_amd64.def
creating build\lib.win-amd64-3.7
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\g++.exe -shared -s build\temp.win-amd64-3.7\Release\python\_jsonnet.o core/desugarer.o core/formatter.o core/libjsonnet.o core/lexer.o core/parser.o core/pass.o core/static_analysis.o core/string_utils.o core/vm.o third_party/md5/md5.o build\temp.win-amd64-3.7\Release\python\_jsonnet.cp37-win_amd64.def -LC:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\libs -LC:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\PCbuild\amd64 -lpython37 -lmsvcr140 -o build\lib.win-amd64-3.7\_jsonnet.cp37-win_amd64.pyd
C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmsvcr140
collect2.exe: error: ld returned 1 exit status
error: command 'C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for jsonnet
Running setup.py clean for jsonnet
Failed to build jsonnet
Installing collected packages: jsonnet
Running setup.py install for jsonnet ... error
ERROR: Complete output from command 'C:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\****\\AppData\\Local\\Temp\\pip-install-tmcor2tp\\jsonnet\\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\****\AppData\Local\Temp\pip-record-_pluxysd\install-record.txt' --single-version-externally-managed --compile:
ERROR: running install
running build
running build_ext
make: 'core/desugarer.o' is up to date.
make: 'core/formatter.o' is up to date.
make: 'core/libjsonnet.o' is up to date.
make: 'core/lexer.o' is up to date.
make: 'core/parser.o' is up to date.
make: 'core/pass.o' is up to date.
make: 'core/static_analysis.o' is up to date.
make: 'core/string_utils.o' is up to date.
make: 'core/vm.o' is up to date.
make: 'third_party/md5/md5.o' is up to date.
building '_jsonnet' extension
creating build
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\python
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -Iinclude -Ithird_party/md5 -Ithird_party/json -IC:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\include -IC:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\include -c python/_jsonnet.c -o build\temp.win-amd64-3.7\Release\python\_jsonnet.o
writing build\temp.win-amd64-3.7\Release\python\_jsonnet.cp37-win_amd64.def
creating build\lib.win-amd64-3.7
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\g++.exe -shared -s build\temp.win-amd64-3.7\Release\python\_jsonnet.o core/desugarer.o core/formatter.o core/libjsonnet.o core/lexer.o core/parser.o core/pass.o core/static_analysis.o core/string_utils.o core/vm.o third_party/md5/md5.o build\temp.win-amd64-3.7\Release\python\_jsonnet.cp37-win_amd64.def -LC:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\libs -LC:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\PCbuild\amd64 -lpython37 -lmsvcr140 -o build\lib.win-amd64-3.7\_jsonnet.cp37-win_amd64.pyd
C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmsvcr140
collect2.exe: error: ld returned 1 exit status
error: command 'C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe' failed with exit status 1
----------------------------------------
ERROR: Command "'C:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\****\\AppData\\Local\\Temp\\pip-install-tmcor2tp\\jsonnet\\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\****\AppData\Local\Temp\pip-record-_pluxysd\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\****\AppData\Local\Temp\pip-install-tmcor2tp\jsonnet\
@alexpolozov It looks like the linker is not able to find -lmsvcr140
. If you look at the exact line in pip install
log:
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\g++.exe -shared -s build\temp.win-amd64-3.7\Release\python\_jsonnet.o core/desugarer.o core/formatter.o core/libjsonnet.o core/lexer.o core/parser.o core/pass.o core/static_analysis.o core/string_utils.o core/vm.o third_party/md5/md5.o build\temp.win-amd64-3.7\Release\python\_jsonnet.cp37-win_amd64.def -LC:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\libs -LC:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\PCbuild\amd64 -lpython37 -lmsvcr140 -o build\lib.win-amd64-3.7\_jsonnet.cp37-win_amd64.pyd
It is actually looking in C:\Users\****\AppData\Local\Continuum\anaconda3\envs\dl\libs
which seems to contain both vcruntime140.def
and vcruntime140.dll
So this has really confused me. Can you suggest anything that can solve this problem?
Thanks a lot
Hey, my cmd to patch is: `cd C:\Users***\AppData\Local\Programs\Python\Python37\Lib\distutils
copy cygwinccompiler.py '~cygwinccompiler.py'
pip install patch python -m patch C:\Users***\Desktop\patch.diff
pause
cd C:\Users***\AppData\Local\Programs\Python\Python37 copy vcruntime140.dll .\libs
cd C:\Users***\AppData\Local\Programs\Python\Python37\libs gendef vcruntime140.dll
pause
pause`
ERROR: Command errored out with exit status 1: 'c:\users*\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\*\AppData\Local\Temp\pip-install-yo9rxzbl\jsonnet\setup.py'"'"'; file='"'"'C:\Users\\AppData\Local\Temp\pip-install-yo9rxzbl\jsonnet\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\\AppData\Local\Temp\pip-record-oomvap1t\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.`
while the patch cmd errors:
Traceback (most recent call last): File "C:\Users\***\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "C:\Users\**\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\***\AppData\Local\Programs\Python\Python37\lib\site-packages\patch.py", line 1193, in <module> main() File "C:\Users\**\AppData\Local\Programs\Python\Python37\lib\site-packages\patch.py", line 1186, in main patch.apply(options.strip, root=options.directory) or sys.exit(-1) AttributeError: 'bool' object has no attribute 'apply'
@alexpolozov Hi!Thansk for your idea! I followed your step on my windows machine,but I got an error.Could you help me to solve it?
Collecting jsonnet
Using cached https://files.pythonhosted.org/packages/fe/a6/e69e38f1f259fcf8532d8bd2c4bc88764f42d7b35a41423a7f4b035cc5ce/jsonnet-0.14.0.tar.gz
Building wheels for collected packages: jsonnet
Building wheel for jsonnet (setup.py): started
Building wheel for jsonnet (setup.py): still running...
Building wheel for jsonnet (setup.py): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: 'G:\Anaconda\envs\dygiepp\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-uz08qy02\\jsonnet\\setup.py'"'"'; __file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-uz08qy02\\jsonnet\\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\ADMINI~1\AppData\Local\Temp\pip-wheel-w4mhsld1' --python-tag cp37
cwd: C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-uz08qy02\jsonnet\
Complete output (25 lines):
running bdist_wheel
running build
running build_ext
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/desugarer.cpp -o core/desugarer.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/formatter.cpp -o core/formatter.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/libjsonnet.cpp -o core/libjsonnet.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/lexer.cpp -o core/lexer.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/parser.cpp -o core/parser.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/pass.cpp -o core/pass.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/static_analysis.cpp -o core/static_analysis.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/string_utils.cpp -o core/string_utils.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/vm.cpp -o core/vm.o
g++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json third_party/md5/md5.cpp -o third_party/md5/md5.o
building '_jsonnet' extension
creating build
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\python
F:\Tools\MinGW\mingw64\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -Iinclude -Ithird_party/md5 -Ithird_party/json -IG:\Anaconda\envs\dygiepp\include -IG:\Anaconda\envs\dygiepp\include -c python/_jsonnet.c -o build\temp.win-amd64-3.7\Release\python\_jsonnet.o
writing build\temp.win-amd64-3.7\Release\python\_jsonnet.cp37-win_amd64.def
creating build\lib.win-amd64-3.7
F:\Tools\MinGW\mingw64\bin\g++.exe -shared -s build\temp.win-amd64-3.7\Release\python\_jsonnet.o core/desugarer.o core/formatter.o core/libjsonnet.o core/lexer.o core/parser.o core/pass.o core/static_analysis.o core/string_utils.o core/vm.o third_party/md5/md5.o build\temp.win-amd64-3.7\Release\python\_jsonnet.cp37-win_amd64.def -LG:\Anaconda\envs\dygiepp\libs -LG:\Anaconda\envs\dygiepp\PCbuild\amd64 -lpython37 -lmsvcr140 -o build\lib.win-amd64-3.7\_jsonnet.cp37-win_amd64.pyd
F:/Tools/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmsvcr140
collect2.exe: error: ld returned 1 exit status
error: command 'F:\\Tools\\MinGW\\mingw64\\bin\\g++.exe' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for jsonnet
Running setup.py clean for jsonnet
Failed to build jsonnet
Installing collected packages: jsonnet
Running setup.py install for jsonnet: started
Running setup.py install for jsonnet: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: 'G:\Anaconda\envs\dygiepp\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-uz08qy02\\jsonnet\\setup.py'"'"'; __file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-uz08qy02\\jsonnet\\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\ADMINI~1\AppData\Local\Temp\pip-record-h69wq_dd\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-uz08qy02\jsonnet\
Complete output (25 lines):
running install
running build
running build_ext
make: 'core/desugarer.o' is up to date.
make: 'core/formatter.o' is up to date.
make: 'core/libjsonnet.o' is up to date.
make: 'core/lexer.o' is up to date.
make: 'core/parser.o' is up to date.
make: 'core/pass.o' is up to date.
make: 'core/static_analysis.o' is up to date.
make: 'core/string_utils.o' is up to date.
make: 'core/vm.o' is up to date.
make: 'third_party/md5/md5.o' is up to date.
building '_jsonnet' extension
creating build
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\python
F:\Tools\MinGW\mingw64\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -Iinclude -Ithird_party/md5 -Ithird_party/json -IG:\Anaconda\envs\dygiepp\include -IG:\Anaconda\envs\dygiepp\include -c python/_jsonnet.c -o build\temp.win-amd64-3.7\Release\python\_jsonnet.o
writing build\temp.win-amd64-3.7\Release\python\_jsonnet.cp37-win_amd64.def
creating build\lib.win-amd64-3.7
F:\Tools\MinGW\mingw64\bin\g++.exe -shared -s build\temp.win-amd64-3.7\Release\python\_jsonnet.o core/desugarer.o core/formatter.o core/libjsonnet.o core/lexer.o core/parser.o core/pass.o core/static_analysis.o core/string_utils.o core/vm.o third_party/md5/md5.o build\temp.win-amd64-3.7\Release\python\_jsonnet.cp37-win_amd64.def -LG:\Anaconda\envs\dygiepp\libs -LG:\Anaconda\envs\dygiepp\PCbuild\amd64 -lpython37 -lmsvcr140 -o build\lib.win-amd64-3.7\_jsonnet.cp37-win_amd64.pyd
F:/Tools/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmsvcr140
collect2.exe: error: ld returned 1 exit status
error: command 'F:\\Tools\\MinGW\\mingw64\\bin\\g++.exe' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: 'G:\Anaconda\envs\dygiepp\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-uz08qy02\\jsonnet\\setup.py'"'"'; __file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-uz08qy02\\jsonnet\\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\ADMINI~1\AppData\Local\Temp\pip-record-h69wq_dd\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
Please give a try to this command
pip install -e git+https://github.com/Toilal/jsonnet.git#egg=jsonnet
This is fork #781 in action, it only requires Visual C++ Build Tools available.
I managed to run
pip install jsonnet
on Windows 10 after a bit of digging, so here's a step-by-step guide for anyone else who needs it. This is assuming x64 Windows and Python.
- Install MinGW-w64, for instance to
C:\MinGW-w64
. Only this MinGW variation worked for me in the end. Don't use MSYS2. Don't use Win-Builds. Make sure to choose the right architecture of MinGW on install:- Add
C:\MinGW-w64\mingw64\bin
to your PATH. Make sure that it's early enough and resolves first:> where.exe g++ C:\mingw-w64\mingw64\bin\g++.exe
- If your MinGW installation has
make.exe
in the PATH, you're good. Mine for some reason has it namedmingw32-make.exe
, so I had to make a symlink. This is really easy, just run in PowerShell:New-Item -Type SymbolicLink -Path C:\MinGW-w64\mingw64\bin -Name make.exe -Value C:\MinGW-w64\mingw64\bin\mingw32-make.exe
Tell pip to use MinGW for native package compilation instead of MSVC. Create a file
${YOUR_PYTHON_INSTALL_PATH}\Lib\distutils\distutils.cfg
with the following content:[build] compiler=mingw32 [build_ext] compiler=mingw32
This is temporary, you can remove this config afterwards. IMPORTANT: at this point,
pip install jsonnet
should no longer fail with the error messagerunning build_ext error: [WinError 2] The system cannot find the file specified
. It might fail at a later stage – please read further to fix the subsequent errors. If you still seeThe system cannot find the file specified
, stop and ensure thatmake.exe
is in your PATH:> where.exe make C:\MinGW-w64\mingw64\bin\make.exe
- Download and install the Build Tools for Visual Studio. I have VS2017, but 2019 or 2015 should work fine as well.
- Now we need to patch distutils, which hasn't been built to use the newest build/link tools of MSVC together with MinGW properly. This is a long story, you can read it in the associated issue thread, if you want. To summarize, there's a proposed patch that makes the MinGW linker find the right runtime DLL, but it doesn't work 100% of the time and in all circumstances, so the patch hasn't been merged yet. Nevertheless, it will work just fine in our case. Download patch.diff and put it somewhere. Then do the following:
cd ${YOUR_PYTHON_INSTALL_PATH}\lib\distutils # Back up the original version of the file cp cygwinccompiler.py '~cygwinccompiler.py' # Patch cygwinccompiler.py using the saved patch.diff pip install patch python -m patch patch.diff
- Copy
vcruntime140.dll
to${YOUR_PYTHON_INSTALL_PATH}\libs
:cd ${YOUR_PYTHON_INSTALL_PATH} cp vcruntime140.dll .\libs
Generate library definitions for
vcruntime140.dll
:cd ${YOUR_PYTHON_INSTALL_PATH}\libs gendef vcruntime140.dll
This should generate
${YOUR_PYTHON_INSTALL_PATH}\libs\vcruntime140.def
of approximately 1.51 KB. Note:gendef
is a MinGW version of thepexports
tool. Various guides on the Internet tell to usepexports
for generating def-files, but my MinGW installation included onlygendef
, which has slightly different commandline flags and behavior, but ultimately does the same thing.- Now we should be able to run
pip install jsonnet
, compilation and linking should proceed without problems. Here's a small test:>>> import _jsonnet >>> jn_str = "{ test: 'foo', other: 'bar' + self.test, /* comment */ }" >>> json_str = _jsonnet.evaluate_snippet("", jn_str) >>> print(json_str) { "other": "barfoo", "test": "foo" }
I followed the above insturctions and i got : "error: command 'C:\MinGW\bin\g++.exe' failed with exit status 1"
Please give a try to this command
pip install -e git+https://github.com/Toilal/jsonnet.git#egg=jsonnet
This is fork #781 in action, it only requires Visual C++ Build Tools available.
Tried it with Python 3.8.2 and latest VC++ 14.27 still gets some issues:
File "c:\users\bnoru\appdata\local\programs\python\python38\lib\site-packages\setuptools\msvc.py", line 492, in _find_latest_available_vc_ver
raise distutils.errors.DistutilsPlatformError(err)
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
@Bnorus There's something wrong with your Visual C++ install. Are you able to build other libs ? like netifaces ?
@Bnorus you should maybe run pip install inside "Developer Console Prompt for VS 2019", or invoke C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat
manually before calling pip install.
Or upgrade setuptools
I managed to run
pip install jsonnet
on Windows 10 after a bit of digging, so here's a step-by-step guide for anyone else who needs it. This is assuming x64 Windows and Python.
- Install MinGW-w64, for instance to
C:\MinGW-w64
. Only this MinGW variation worked for me in the end. Don't use MSYS2. Don't use Win-Builds. Make sure to choose the right architecture of MinGW on install:- Add
C:\MinGW-w64\mingw64\bin
to your PATH. Make sure that it's early enough and resolves first:> where.exe g++ C:\mingw-w64\mingw64\bin\g++.exe
- If your MinGW installation has
make.exe
in the PATH, you're good. Mine for some reason has it namedmingw32-make.exe
, so I had to make a symlink. This is really easy, just run in PowerShell:New-Item -Type SymbolicLink -Path C:\MinGW-w64\mingw64\bin -Name make.exe -Value C:\MinGW-w64\mingw64\bin\mingw32-make.exe
Tell pip to use MinGW for native package compilation instead of MSVC. Create a file
${YOUR_PYTHON_INSTALL_PATH}\Lib\distutils\distutils.cfg
with the following content:[build] compiler=mingw32 [build_ext] compiler=mingw32
This is temporary, you can remove this config afterwards. IMPORTANT: at this point,
pip install jsonnet
should no longer fail with the error messagerunning build_ext error: [WinError 2] The system cannot find the file specified
. It might fail at a later stage – please read further to fix the subsequent errors. If you still seeThe system cannot find the file specified
, stop and ensure thatmake.exe
is in your PATH:> where.exe make C:\MinGW-w64\mingw64\bin\make.exe
- Download and install the Build Tools for Visual Studio. I have VS2017, but 2019 or 2015 should work fine as well.
- Now we need to patch distutils, which hasn't been built to use the newest build/link tools of MSVC together with MinGW properly. This is a long story, you can read it in the associated issue thread, if you want. To summarize, there's a proposed patch that makes the MinGW linker find the right runtime DLL, but it doesn't work 100% of the time and in all circumstances, so the patch hasn't been merged yet. Nevertheless, it will work just fine in our case. Download patch.diff and put it somewhere. Then do the following:
cd ${YOUR_PYTHON_INSTALL_PATH}\lib\distutils # Back up the original version of the file cp cygwinccompiler.py '~cygwinccompiler.py' # Patch cygwinccompiler.py using the saved patch.diff pip install patch python -m patch patch.diff
- Copy
vcruntime140.dll
to${YOUR_PYTHON_INSTALL_PATH}\libs
:cd ${YOUR_PYTHON_INSTALL_PATH} cp vcruntime140.dll .\libs
Generate library definitions for
vcruntime140.dll
:cd ${YOUR_PYTHON_INSTALL_PATH}\libs gendef vcruntime140.dll
This should generate
${YOUR_PYTHON_INSTALL_PATH}\libs\vcruntime140.def
of approximately 1.51 KB. Note:gendef
is a MinGW version of thepexports
tool. Various guides on the Internet tell to usepexports
for generating def-files, but my MinGW installation included onlygendef
, which has slightly different commandline flags and behavior, but ultimately does the same thing.- Now we should be able to run
pip install jsonnet
, compilation and linking should proceed without problems. Here's a small test:>>> import _jsonnet >>> jn_str = "{ test: 'foo', other: 'bar' + self.test, /* comment */ }" >>> json_str = _jsonnet.evaluate_snippet("", jn_str) >>> print(json_str) { "other": "barfoo", "test": "foo" }
@alexpolozov
I followed your steps to the T, and when I ran the pip install jsonnet command, it fails with this error: 'head' is not recognized as an internal or external command,
Any advice? Am I missing anything?
Everyone: my instructions were written 10 months ago. They worked for the jsonnet build at that time, but the build process has changed since. It now depends on more Unix tools being present in the PATH, which are not available on Windows by default. They would need to be brought into PATH from MinGW, just like I did with the make
tool in my original instructions. Given that there's a work-in-progress PR #781 for enabling Windows builds natively, I'm not sure it makes sense for me to debug and fix the instructions right now, does it?
I am having trouble installing the jsonnet python package. In particular the build step is failing. Here is my output from pip
I have run the pip install command in the Visual Studio 2017 and Visual Studio 2015 command prompt with python tools installed and received the same error. I also tried installing MinGW, added its bin folder to my path, and specified in the distutils.cfg to use the mingw32 compiler (as seen below) with no success.
Distutils.cfg
I also tried downloading the tar directly from here and running the build command below and received the same error.
I'm not sure what else to try. Are there wheels available for windows?
Thanks,
Bert