Cuando el sistema mac usa pip para instalar el paquete allennlp, ingrese el siguiente código
pip install allennlp --user
Luego ocurrió un error al ejecutar para instalar el paquete jsonnet
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/
Consulte preguntas similares en github:
https://github.com/allenai/allennlp/issues/2779
La razón es que usaremos g ++ para compilar bajo el sistema linux, pero aquí usamos clang. Entonces, el número de versión de la nueva versión de mac OS Mojave no se actualiza en allennlp. Entonces necesitamos actualizar las variables de entorno:
Abra el archivo de configuración de la variable de entorno:
vim ~/.bash_profile
Agrega el siguiente código
export MACOSX_DEPLOYMENT_TARGET=10.14
Después de guardar y salir, se le pedirá que instale la aplicación macOS_SDK_headers_for_macOS_10.14.pkg. Siga las instrucciones para instalar.
Entonces, se resolvió ~
Inténtalo de nuevo ~~~
pip install jsonnet
pip install allennlp --user
¡Éxito! !