Can't install gcld3 on MacOS Ventura 13.2.1
Opened this issue · 4 comments
This looks to be extremely common, but after trying dozens of solutions, I'm still getting an error when installing gcld3.
First, here's the complete error output. I'm using the same recommended format that solved Issue #49 in this example:
coreynorthcutt@Coreys-MacBook-Pro mixedlang % CPATH=/opt/homebrew/include pip3 install gcld3
WARNING: Skipping /usr/local/lib/python3.11/site-packages/six-1.16.0-py3.11.egg-info due to invalid metadata entry 'name'
Collecting gcld3
Using cached gcld3-3.0.13.tar.gz (647 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: gcld3
Building wheel for gcld3 (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [27 lines of output]
/usr/local/lib/python3.11/site-packages/setuptools/__init__.py:85: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated. Requirements should be satisfied by a PEP 517 installer. If you are using pip, you can try `pip install --use-pep517`.
dist.fetch_build_eggs(dist.setup_requires)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-13-x86_64-cpython-311
creating build/lib.macosx-13-x86_64-cpython-311/gcld3
copying gcld3/__init__.py -> build/lib.macosx-13-x86_64-cpython-311/gcld3
running build_ext
building 'gcld3.pybind_ext' extension
creating build/temp.macosx-13-x86_64-cpython-311
creating build/temp.macosx-13-x86_64-cpython-311/gcld3
creating build/temp.macosx-13-x86_64-cpython-311/src
creating build/temp.macosx-13-x86_64-cpython-311/src/cld_3
creating build/temp.macosx-13-x86_64-cpython-311/src/cld_3/protos
creating build/temp.macosx-13-x86_64-cpython-311/src/script_span
clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -stdlib=libc++ -I/private/var/folders/0r/1w5d1pkx3ql47d5jx_jqdnd40000gn/T/pip-install-vuwi41an/gcld3_476945d9d6e345219101ad8b4486ddb6/.eggs/pybind11-2.10.3-py3.11.egg/pybind11/include -I/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c gcld3/pybind_ext.cc -o build/temp.macosx-13-x86_64-cpython-311/gcld3/pybind_ext.o -std=c++11 -stdlib=libc++
In file included from gcld3/pybind_ext.cc:5:
In file included from gcld3/../src/nnet_language_identifier.h:22:
In file included from gcld3/../src/embedding_feature_extractor.h:23:
In file included from gcld3/../src/feature_extractor.h:45:
gcld3/../src/cld_3/protos/feature_extractor.pb.h:10:10: fatal error: 'google/protobuf/port_def.inc' file not found
#include <google/protobuf/port_def.inc>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for gcld3
Running setup.py clean for gcld3
Failed to build gcld3
The error with clang stands out: error: command '/usr/bin/clang' failed with exit code 1
This particular error appears no matter how I try to install cld. I get varying preceding error output, ie. if I try to pip install pycld3 instead... but the clang error is always there.
I've so far...
- done a brew update and brew upgrade.
- verified that Pip, Python, Protoc, Wheel, and Setuptools all have the latest versions.
- tried testing in a virtual environment (as some recommended in other threads).
- tried appending the --use-pep517 flag as the warning above suggests.
- tried setting a million different ENV variables in my local session (every thread seems to suggest something different)
credits for the solution go to @koromkorom
pip install --global-option=build_ext --global-option="-I/opt/homebrew/Cellar/protobuf/21.12/include" --global-option="-L/opt/homebrew/Cellar/protobuf/21.12/lib" gcld3
also if you create conda environment it should work
credits for the solution go to @koromkorom
pip install --global-option=build_ext --global-option="-I/opt/homebrew/Cellar/protobuf/21.12/include" --global-option="-L/opt/homebrew/Cellar/protobuf/21.12/lib" gcld3
also if you create conda environment it should work
Hey thank you for your solution -> I've mentioned the other solution but will copy it here for some lazy-guys like me. If that provided solution doesn't work for you try to install the gcld3/pycld3
package with these flags.(original author mentioned in the linked issue)
export LDFLAGS=-L/opt/homebrew/lib
export CPPFLAGS=-I/opt/homebrew/include
python -m pip install gcld3
Also, try using protobuf@21
as it's compatible with gcld3 because of the protoc being at 3.21
brew install protobuf@21
Then set these flags (preferably in your shell config):
export PATH="/opt/homebrew/opt/protobuf@21/bin:$PATH"
export CFLAGS='-I/opt/homebrew/opt/protobuf@21/include'
export LDFLAGS=-L/opt/homebrew/opt/protobuf@21/lib
Finally, try reinstalling the lib and see if that compiles now
I've placed 21.7 version of protoc in my path and still receiving this error in windows