pmneila/PyMaxflow

Unable to install on MacOS Big Sur (M1)

Closed this issue · 2 comments

Hi,
I get the following error message when trying to install the pymaxflow package on MacOS Big Sur. It worked fine on OS Catalina though. I also can't find the package via anaconda.

Best,
Christoph


`Collecting PyMaxflow
  Using cached PyMaxflow-1.2.13.tar.gz (123 kB)
Building wheels for collected packages: PyMaxflow
  Building wheel for PyMaxflow (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/christoph/opt/anaconda3/envs/bmrrpython_nocuda/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/s0/_13ll7450sg57qfgw3hvfngm0000gn/T/pip-install-hlhna1ol/pymaxflow_7913de003c6a4eb18638d7d4c269c70d/setup.py'"'"'; __file__='"'"'/private/var/folders/s0/_13ll7450sg57qfgw3hvfngm0000gn/T/pip-install-hlhna1ol/pymaxflow_7913de003c6a4eb18638d7d4c269c70d/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/s0/_13ll7450sg57qfgw3hvfngm0000gn/T/pip-wheel-iuk013xw
       cwd: /private/var/folders/s0/_13ll7450sg57qfgw3hvfngm0000gn/T/pip-install-hlhna1ol/pymaxflow_7913de003c6a4eb18638d7d4c269c70d/
  Complete output (26 lines):

```  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-3.8
  creating build/lib.macosx-10.9-x86_64-3.8/maxflow
  copying maxflow/version.py -> build/lib.macosx-10.9-x86_64-3.8/maxflow
  copying maxflow/fastmin.py -> build/lib.macosx-10.9-x86_64-3.8/maxflow
  copying maxflow/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/maxflow
  running build_ext
  building 'maxflow._maxflow' extension
  creating build/temp.macosx-10.9-x86_64-3.8
  creating build/temp.macosx-10.9-x86_64-3.8/maxflow
  creating build/temp.macosx-10.9-x86_64-3.8/maxflow/src
  creating build/temp.macosx-10.9-x86_64-3.8/maxflow/src/core
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/christoph/opt/anaconda3/envs/bmrrpython_nocuda/include -arch x86_64 -I/Users/christoph/opt/anaconda3/envs/bmrrpython_nocuda/include -arch x86_64 -Imaxflow/src -I/Users/christoph/opt/anaconda3/envs/bmrrpython_nocuda/lib/python3.8/site-packages/numpy/core/include -I/Users/christoph/opt/anaconda3/envs/bmrrpython_nocuda/include/python3.8 -c maxflow/src/_maxflow.cpp -o build/temp.macosx-10.9-x86_64-3.8/maxflow/src/_maxflow.o
  cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
  In file included from /usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include-fixed/syslimits.h:7,
                   from /usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include-fixed/limits.h:34,
                   from /Users/christoph/opt/anaconda3/envs/bmrrpython_nocuda/include/python3.8/Python.h:11,
                   from maxflow/src/_maxflow.cpp:35:
  /usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include-fixed/limits.h:194:15: fatal error: limits.h: No such file or directory
   #include_next <limits.h>  /* recurse down to the real one */
                 ^~~~~~~~~~
  compilation terminated.
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for PyMaxflow
  Running setup.py clean for PyMaxflow
Failed to build PyMaxflow
Installing collected packages: PyMaxflow
    Running setup.py install for PyMaxflow ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/christoph/opt/anaconda3/envs/bmrrpython_nocuda/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/s0/_13ll7450sg57qfgw3hvfngm0000gn/T/pip-install-hlhna1ol/pymaxflow_7913de003c6a4eb18638d7d4c269c70d/setup.py'"'"'; __file__='"'"'/private/var/folders/s0/_13ll7450sg57qfgw3hvfngm0000gn/T/pip-install-hlhna1ol/pymaxflow_7913de003c6a4eb18638d7d4c269c70d/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/s0/_13ll7450sg57qfgw3hvfngm0000gn/T/pip-record-qqh0ne6p/install-record.txt --single-version-externally-managed --compile --install-headers /Users/christoph/opt/anaconda3/envs/bmrrpython_nocuda/include/python3.8/PyMaxflow
         cwd: /private/var/folders/s0/_13ll7450sg57qfgw3hvfngm0000gn/T/pip-install-hlhna1ol/pymaxflow_7913de003c6a4eb18638d7d4c269c70d/
    Complete output (26 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.8
    creating build/lib.macosx-10.9-x86_64-3.8/maxflow
    copying maxflow/version.py -> build/lib.macosx-10.9-x86_64-3.8/maxflow
    copying maxflow/fastmin.py -> build/lib.macosx-10.9-x86_64-3.8/maxflow
    copying maxflow/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/maxflow
    running build_ext
    building 'maxflow._maxflow' extension
    creating build/temp.macosx-10.9-x86_64-3.8
    creating build/temp.macosx-10.9-x86_64-3.8/maxflow
    creating build/temp.macosx-10.9-x86_64-3.8/maxflow/src
    creating build/temp.macosx-10.9-x86_64-3.8/maxflow/src/core
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/christoph/opt/anaconda3/envs/bmrrpython_nocuda/include -arch x86_64 -I/Users/christoph/opt/anaconda3/envs/bmrrpython_nocuda/include -arch x86_64 -Imaxflow/src -I/Users/christoph/opt/anaconda3/envs/bmrrpython_nocuda/lib/python3.8/site-packages/numpy/core/include -I/Users/christoph/opt/anaconda3/envs/bmrrpython_nocuda/include/python3.8 -c maxflow/src/_maxflow.cpp -o build/temp.macosx-10.9-x86_64-3.8/maxflow/src/_maxflow.o
    cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
    In file included from /usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include-fixed/syslimits.h:7,
                     from /usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include-fixed/limits.h:34,
                     from /Users/christoph/opt/anaconda3/envs/bmrrpython_nocuda/include/python3.8/Python.h:11,
                     from maxflow/src/_maxflow.cpp:35:
    /usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/include-fixed/limits.h:194:15: fatal error: limits.h: No such file or directory
     #include_next <limits.h>  /* recurse down to the real one */
                   ^~~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/christoph/opt/anaconda3/envs/bmrrpython_nocuda/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/s0/_13ll7450sg57qfgw3hvfngm0000gn/T/pip-install-hlhna1ol/pymaxflow_7913de003c6a4eb18638d7d4c269c70d/setup.py'"'"'; __file__='"'"'/private/var/folders/s0/_13ll7450sg57qfgw3hvfngm0000gn/T/pip-install-hlhna1ol/pymaxflow_7913de003c6a4eb18638d7d4c269c70d/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/s0/_13ll7450sg57qfgw3hvfngm0000gn/T/pip-record-qqh0ne6p/install-record.txt --single-version-externally-managed --compile --install-headers /Users/christoph/opt/anaconda3/envs/bmrrpython_nocuda/include/python3.8/PyMaxflow Check the logs for full command output.`

Hi,

This seems to be a common issue for recent versions of MacOS and Xcode. Take a look at a similar problem in qutip and at these two questions in StackOverflow. Hopefully you'll find a solution there. Let me know if it worked (it might be useful for other users of BigSur).

Unfortunately, I do not have a Mac with BigSur available at the moment to debug this problem, but I'll pick it up as soon as I can.

Hi,

thank you, it was indeed a conflict between gcc versions which come with the xcode command line tools.
I could solve it by updating gcc with "brew upgrade gcc".

Thank you for your help!