Install allennlp failed with jsonnet build error
whxf opened this issue · 9 comments
I meet some question when I install allenlp with pip
pip install allennlp --user
and I get an error when it build dependency, I didn't kown why it is failed?
Building wheels for collected packages: jsonnet
Building wheel for jsonnet (setup.py) ... error
ERROR: Complete output from command /usr/local/anaconda3/envs/allennlp/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/5z/pnhclkxj3fbd1gsyrr656m2w0000gn/T/pip-install-5igclfl8/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 /private/var/folders/5z/pnhclkxj3fbd1gsyrr656m2w0000gn/T/pip-wheel-h870sk60 --python-tag cp36:
ERROR: running bdist_wheel
running build
running build_ext
c++ -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:406:67: warning: unused parameter 'obj_level' [-Wunused-parameter]
AST* makeArrayComprehension(ArrayComprehension *ast, unsigned obj_level) {
^
1 warning generated.
c++ -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
c++ -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
c++ -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
c++ -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
c++ -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
c++ -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
c++ -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
c++ -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:1337:21: warning: comparison of integers of different signs: 'int' and 'std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::size_type' (aka 'unsigned long') [-Wsign-compare]
while (test < str->value.size() && (maxsplits == -1 ||
~~~~ ^ ~~~~~~~~~~~~~~~~~
core/vm.cpp:1338:55: warning: comparison of integers of different signs: 'long' and 'std::__1::vector<(anonymous namespace)::HeapThunk *, std::__1::allocator<(anonymous namespace)::HeapThunk *> >::size_type' (aka 'unsigned long') [-Wsign-compare]
maxsplits > elements.size())) {
~~~~~~~~~ ^ ~~~~~~~~~~~~~~~
core/vm.cpp:1362:24: warning: comparison of integers of different signs: 'long' and 'std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::size_type' (aka 'unsigned long') [-Wsign-compare]
if (len + from > str->value.size()) {
~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
core/vm.cpp:1419:27: warning: comparison of integers of different signs: 'int' and 'std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::size_type' (aka 'unsigned long') [-Wsign-compare]
for (int i = 0; i < new_str.size(); ++i) {
~ ^ ~~~~~~~~~~~~~~
core/vm.cpp:1433:27: warning: comparison of integers of different signs: 'int' and 'std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::size_type' (aka 'unsigned long') [-Wsign-compare]
for (int i = 0; i < new_str.size(); ++i) {
~ ^ ~~~~~~~~~~~~~~
core/vm.cpp:1533:33: warning: comparison of integers of different signs: 'int' and 'std::__1::vector<(anonymous namespace)::HeapThunk *, std::__1::allocator<(anonymous namespace)::HeapThunk *> >::size_type' (aka 'unsigned long') [-Wsign-compare]
for (int i = idx; i < elements.size(); ++i) {
~ ^ ~~~~~~~~~~~~~~~
core/vm.cpp:1577:33: warning: comparison of integers of different signs: 'int' and 'std::__1::vector<(anonymous namespace)::HeapThunk *, std::__1::allocator<(anonymous namespace)::HeapThunk *> >::size_type' (aka 'unsigned long') [-Wsign-compare]
for (int i = idx; i < elements.size(); ++i) {
~ ^ ~~~~~~~~~~~~~~~
7 warnings generated.
c++ -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.macosx-10.7-x86_64-3.6
creating build/temp.macosx-10.7-x86_64-3.6/python
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/anaconda3/envs/allennlp/include -arch x86_64 -I/usr/local/anaconda3/envs/allennlp/include -arch x86_64 -Iinclude -Ithird_party/md5 -Ithird_party/json -I/usr/local/anaconda3/envs/allennlp/include/python3.6m -c python/_jsonnet.c -o build/temp.macosx-10.7-x86_64-3.6/python/_jsonnet.o
python/_jsonnet.c:147:19: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare]
for (i = 0; i < ctx->argc; ++i) {
~ ^ ~~~~~~~~~
1 warning generated.
creating build/lib.macosx-10.7-x86_64-3.6
g++ -bundle -undefined dynamic_lookup -L/usr/local/anaconda3/envs/allennlp/lib -L/usr/local/anaconda3/envs/allennlp/lib -arch x86_64 build/temp.macosx-10.7-x86_64-3.6/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 -L/usr/local/anaconda3/envs/allennlp/lib -o build/lib.macosx-10.7-x86_64-3.6/_jsonnet.cpython-36m-darwin.so
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' 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, allennlp
Running setup.py install for jsonnet ... error
ERROR: Complete output from command /usr/local/anaconda3/envs/allennlp/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/5z/pnhclkxj3fbd1gsyrr656m2w0000gn/T/pip-install-5igclfl8/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 /private/var/folders/5z/pnhclkxj3fbd1gsyrr656m2w0000gn/T/pip-record-o4j69o6d/install-record.txt --single-version-externally-managed --compile --user --prefix=:
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.macosx-10.7-x86_64-3.6
creating build/temp.macosx-10.7-x86_64-3.6/python
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/anaconda3/envs/allennlp/include -arch x86_64 -I/usr/local/anaconda3/envs/allennlp/include -arch x86_64 -Iinclude -Ithird_party/md5 -Ithird_party/json -I/usr/local/anaconda3/envs/allennlp/include/python3.6m -c python/_jsonnet.c -o build/temp.macosx-10.7-x86_64-3.6/python/_jsonnet.o
python/_jsonnet.c:147:19: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare]
for (i = 0; i < ctx->argc; ++i) {
~ ^ ~~~~~~~~~
1 warning generated.
creating build/lib.macosx-10.7-x86_64-3.6
g++ -bundle -undefined dynamic_lookup -L/usr/local/anaconda3/envs/allennlp/lib -L/usr/local/anaconda3/envs/allennlp/lib -arch x86_64 build/temp.macosx-10.7-x86_64-3.6/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 -L/usr/local/anaconda3/envs/allennlp/lib -o build/lib.macosx-10.7-x86_64-3.6/_jsonnet.cpython-36m-darwin.so
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' failed with exit status 1
----------------------------------------
ERROR: Command "/usr/local/anaconda3/envs/allennlp/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/5z/pnhclkxj3fbd1gsyrr656m2w0000gn/T/pip-install-5igclfl8/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 /private/var/folders/5z/pnhclkxj3fbd1gsyrr656m2w0000gn/T/pip-record-o4j69o6d/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /private/var/folders/5z/pnhclkxj3fbd1gsyrr656m2w0000gn/T/pip-install-5igclfl8/jsonnet/
different solutions work for different people, hopefully one of these works for you:
@rahular I finally install it in system python env, not in anaconda env. But I didn't understand why it can work out of anaconda? What's the difference between them QAQ
@whxf to install in anaconda env, the best solution I found was to rename Anaconda's ld linker in
anaconda/envs/env_name/compiler_compat/ld
to ld.old or whatever. It seems to be causing more problems than it solves, so I usually leave it renamed to make sure that anaconda uses system global ld.
Cheers
@yaceben Thanks for answering, but the problem seems caused by clang
. Now I've installed allennlp in anaconda. I solved the problem following stack overflow
For anyone with this problem in MacOS 11.1 Big Sur, one solution that worked for me with Mojave and stills works (I re-encountered this same problem) is the following:
- Install Command Line Tools
export MACOSX_DEPLOYMENT_TARGET=11.1
as @pedrocolon93 pointed out (or whichever version of the CLT is out).conda install jsonnet -c conda-forge
as @dcfidalgo pointed out here.
Then I could pass that point in the installation.
I get the following error when running conda install on a Windows virtual machine:
conda install jsonnet -c conda-forge
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- jsonnet
Current channels:
- https://conda.anaconda.org/conda-forge/win-64
- https://conda.anaconda.org/conda-forge/noarch
- https://repo.anaconda.com/pkgs/main/win-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/win-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/msys2/win-64
- https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
I get the following error when running conda install on a Windows virtual machine:
conda install jsonnet -c conda-forge Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Collecting package metadata (repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. PackagesNotFoundError: The following packages are not available from current channels: - jsonnet Current channels: - https://conda.anaconda.org/conda-forge/win-64 - https://conda.anaconda.org/conda-forge/noarch - https://repo.anaconda.com/pkgs/main/win-64 - https://repo.anaconda.com/pkgs/main/noarch - https://repo.anaconda.com/pkgs/r/win-64 - https://repo.anaconda.com/pkgs/r/noarch - https://repo.anaconda.com/pkgs/msys2/win-64 - https://repo.anaconda.com/pkgs/msys2/noarch To search for alternate channels that may provide the conda package you're looking for, navigate to https://anaconda.org and use the search bar at the top of the page.
This thread refers to an error of the C++ compiler of MacOS. Maybe you should create a separate thread for that error to address it in an isolated way.