GrammaticalFramework/gf-core

`pip3 install pgf` doesn't work for macOS Big Sur: "clang: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=11.0'"

inariksit opened this issue · 3 comments

I have already pgf bindings for Python 2.7 installed the old manual way. When I try to install it via PyPI for Python 3, I get the following error.

I am on Mac OS Big Sur, version 11.2.3.

pip3 install pgf
Collecting pgf
  Using cached pgf-1.0.tar.gz (16 kB)
Building wheels for collected packages: pgf
  Building wheel for pgf (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/opt/python@3.9/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/5w/ljv6z1g54cb9698lj7pbxnk80000gp/T/pip-install-8gb978e1/pgf/setup.py'"'"'; __file__='"'"'/private/var/folders/5w/ljv6z1g54cb9698lj7pbxnk80000gp/T/pip-install-8gb978e1/pgf/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/5w/ljv6z1g54cb9698lj7pbxnk80000gp/T/pip-wheel-fot2pmvi
       cwd: /private/var/folders/5w/ljv6z1g54cb9698lj7pbxnk80000gp/T/pip-install-8gb978e1/pgf/
  Complete output (9 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'pgf' extension
  creating build
  creating build/temp.macosx-11.0-x86_64-3.9
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c pypgf.c -o build/temp.macosx-11.0-x86_64-3.9/pypgf.o -std=c99
  clang: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=11.0'
  error: command '/usr/bin/clang' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for pgf
  Running setup.py clean for pgf
Failed to build pgf
Installing collected packages: pgf
    Running setup.py install for pgf ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/local/opt/python@3.9/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/5w/ljv6z1g54cb9698lj7pbxnk80000gp/T/pip-install-8gb978e1/pgf/setup.py'"'"'; __file__='"'"'/private/var/folders/5w/ljv6z1g54cb9698lj7pbxnk80000gp/T/pip-install-8gb978e1/pgf/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/5w/ljv6z1g54cb9698lj7pbxnk80000gp/T/pip-record-0b91xtti/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/pgf
         cwd: /private/var/folders/5w/ljv6z1g54cb9698lj7pbxnk80000gp/T/pip-install-8gb978e1/pgf/
    Complete output (9 lines):
    running install
    running build
    running build_ext
    building 'pgf' extension
    creating build
    creating build/temp.macosx-11.0-x86_64-3.9
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c pypgf.c -o build/temp.macosx-11.0-x86_64-3.9/pypgf.o -std=c99
    clang: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=11.0'
    error: command '/usr/bin/clang' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/opt/python@3.9/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/5w/ljv6z1g54cb9698lj7pbxnk80000gp/T/pip-install-8gb978e1/pgf/setup.py'"'"'; __file__='"'"'/private/var/folders/5w/ljv6z1g54cb9698lj7pbxnk80000gp/T/pip-install-8gb978e1/pgf/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/5w/ljv6z1g54cb9698lj7pbxnk80000gp/T/pip-record-0b91xtti/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/pgf Check the logs for full command output.

Update: This isn't just about pip, I can't even install it on Python 3 the old way:

$ pwd
/Users/inari/work/GF/gf-core/src/runtime/python
$ python3 setup.py build
running build
running build_ext
building 'pgf' extension
creating build/temp.macosx-11.0-x86_64-3.9
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c pypgf.c -o build/temp.macosx-11.0-x86_64-3.9/pypgf.o -std=c99
clang: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=11.0'
error: command '/usr/bin/clang' failed with exit code 1

It seems to be a general problem in Python and the version of clang.

This StackOverflow thread https://stackoverflow.com/questions/63972113/big-sur-clang-invalid-version-error-due-to-macosx-deployment-target contains possible solutions.

The solutions are linked in documentation as of #126 , I think we can close this issue for now.