fabanc / pyvoronoi

Python wrapper for Boost voronoi diagram implementation.
27 stars 7 forks source link

Fails to install on macOS 10.15.4 #16

Open poke1024 opened 4 years ago

poke1024 commented 4 years ago

pip install pyvoronoi gives the following error:

Collecting pyvoronoi
  Using cached pyvoronoi-1.0.5.tar.gz (133 kB)
Building wheels for collected packages: pyvoronoi
  Building wheel for pyvoronoi (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /opt/miniconda3/envs/calamari-tf1/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/m6/3kr1nz2x29qdczpm2q_8n5m40000gr/T/pip-install-9onxfsxm/pyvoronoi/setup.py'"'"'; __file__='"'"'/private/var/folders/m6/3kr1nz2x29qdczpm2q_8n5m40000gr/T/pip-install-9onxfsxm/pyvoronoi/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/m6/3kr1nz2x29qdczpm2q_8n5m40000gr/T/pip-wheel-__apdo5b
       cwd: /private/var/folders/m6/3kr1nz2x29qdczpm2q_8n5m40000gr/T/pip-install-9onxfsxm/pyvoronoi/
  Complete output (15 lines):
  Distribution mode: Compiling Cython generated .cpp sources.
  running bdist_wheel
  running build
  running build_ext
  building 'pyvoronoi' extension
  creating build
  creating build/temp.macosx-10.7-x86_64-3.6
  creating build/temp.macosx-10.7-x86_64-3.6/pyvoronoi
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/miniconda3/envs/calamari-tf1/include -arch x86_64 -I/opt/miniconda3/envs/calamari-tf1/include -arch x86_64 -Ipyvoronoi -I/opt/miniconda3/envs/calamari-tf1/include/python3.6m -c pyvoronoi/pyvoronoi.cpp -o build/temp.macosx-10.7-x86_64-3.6/pyvoronoi/pyvoronoi.o
  clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
  pyvoronoi/pyvoronoi.cpp:250:10: fatal error: 'vector' file not found
  #include <vector>
           ^~~~~~~~
  1 error generated.
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pyvoronoi
  Running setup.py clean for pyvoronoi
Failed to build pyvoronoi
Installing collected packages: pyvoronoi
    Running setup.py install for pyvoronoi ... error
    ERROR: Command errored out with exit status 1:
     command: /opt/miniconda3/envs/calamari-tf1/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/m6/3kr1nz2x29qdczpm2q_8n5m40000gr/T/pip-install-9onxfsxm/pyvoronoi/setup.py'"'"'; __file__='"'"'/private/var/folders/m6/3kr1nz2x29qdczpm2q_8n5m40000gr/T/pip-install-9onxfsxm/pyvoronoi/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/m6/3kr1nz2x29qdczpm2q_8n5m40000gr/T/pip-record-ef070gan/install-record.txt --single-version-externally-managed --compile --install-headers /opt/miniconda3/envs/calamari-tf1/include/python3.6m/pyvoronoi
         cwd: /private/var/folders/m6/3kr1nz2x29qdczpm2q_8n5m40000gr/T/pip-install-9onxfsxm/pyvoronoi/
    Complete output (15 lines):
    Distribution mode: Compiling Cython generated .cpp sources.
    running install
    running build
    running build_ext
    building 'pyvoronoi' extension
    creating build
    creating build/temp.macosx-10.7-x86_64-3.6
    creating build/temp.macosx-10.7-x86_64-3.6/pyvoronoi
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/miniconda3/envs/calamari-tf1/include -arch x86_64 -I/opt/miniconda3/envs/calamari-tf1/include -arch x86_64 -Ipyvoronoi -I/opt/miniconda3/envs/calamari-tf1/include/python3.6m -c pyvoronoi/pyvoronoi.cpp -o build/temp.macosx-10.7-x86_64-3.6/pyvoronoi/pyvoronoi.o
    clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
    pyvoronoi/pyvoronoi.cpp:250:10: fatal error: 'vector' file not found
    #include <vector>
             ^~~~~~~~
    1 error generated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /opt/miniconda3/envs/calamari-tf1/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/m6/3kr1nz2x29qdczpm2q_8n5m40000gr/T/pip-install-9onxfsxm/pyvoronoi/setup.py'"'"'; __file__='"'"'/private/var/folders/m6/3kr1nz2x29qdczpm2q_8n5m40000gr/T/pip-install-9onxfsxm/pyvoronoi/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/m6/3kr1nz2x29qdczpm2q_8n5m40000gr/T/pip-record-ef070gan/install-record.txt --single-version-externally-managed --compile --install-headers /opt/miniconda3/envs/calamari-tf1/include/python3.6m/pyvoronoi Check the logs for full command output.

The fix is to run CFLAGS="-stdlib=libc++" pip install pyvoronoi.

poke1024 commented 4 years ago

I’m using Python 3.7.6 inside a conda environment (macOS 10.15.4).

I believe the underlying issue here is with macOS deprecating libstdc++, see https://github.com/spotify/annoy/issues/349#issuecomment-456687456 Am 3. Apr. 2020, 20:50 +0200 schrieb Fabien notifications@github.com:

A few questions to help me troubleshoot:

• Which version of Python are you using? • Are you using the default python install or a virtual environment?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

fabanc commented 10 months ago

I have done a few fix on the API. The fix have been tested on Windows on Ubuntu. Does it fix anything for you?

bulatbulat48 commented 4 months ago

@fabanc I have faced the error with MacOS: 14.3.1. Tested on python 3.11, 3.10.

Building wheels for collected packages: pyvoronoi
  Building wheel for pyvoronoi (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pyvoronoi (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [164 lines of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyvoronoi
Failed to build pyvoronoi
ERROR: Could not build wheels for pyvoronoi, which is required to install pyproject.toml-based projects

fixed as mentioned here:

 env CXX=/opt/homebrew/Cellar/gcc/14.1.0_1/bin/g++-14 CC=/opt/homebrew/Cellar/gcc/14.1.0_1/bin/gcc-14 pip install pyvoronoi
fabanc commented 4 months ago

Sounds good. It is something I can add in the setup.py file. I am currently working on building the wheels on most OS using cibuildwheel. I am hopping it will:

I have been on that on and off over the past 2 months. The builds can now be generated from Python 3.9 to 3.12 on Windows, Ubuntu, and MacOS.

I am working on pushing those automatically to pypi. Stay tuned.

fabanc commented 4 months ago

@bulatbulat48 Using cibuildwheel, I can now generate the wheels for Mac OS. I have pushed those wheels as part of the latest release 1.1.4. Care to give it a try using pypi and see if this solves that problem for you?