wmayner / pyemd

Fast EMD for Python: a wrapper for Pele and Werman's C++ implementation of the Earth Mover's Distance metric
MIT License
479 stars 63 forks source link

pyemd not building on MacOS X "Catalina" + Python 3.7 #43

Closed arianpasquali closed 1 year ago

arianpasquali commented 5 years ago

pyemd fails to install on python 3.7 environment on Mac OS X Catalina (version 10.15 beta). similar to issue [#39] (https://github.com/wmayner/pyemd/issues/39)

I am using virtualenv with python 3.7.1.

pip install git+https://github.com/wmayner/pyemd/
Looking in indexes: https://pypi.python.org/simple, https://pypi.apple.com/simple
Collecting git+https://github.com/wmayner/pyemd/
  Cloning https://github.com/wmayner/pyemd/ to /private/var/folders/p7/pynm4r6x1m1f4ww8g5j3lb3m0000gn/T/pip-req-build-e51_1oq9
  Running command git clone -q https://github.com/wmayner/pyemd/ /private/var/folders/p7/pynm4r6x1m1f4ww8g5j3lb3m0000gn/T/pip-req-build-e51_1oq9
Building wheels for collected packages: pyemd
  Building wheel for pyemd (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/arian/Developer/workspace/signal/tilse/dev/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/p7/pynm4r6x1m1f4ww8g5j3lb3m0000gn/T/pip-req-build-e51_1oq9/setup.py'"'"'; __file__='"'"'/private/var/folders/p7/pynm4r6x1m1f4ww8g5j3lb3m0000gn/T/pip-req-build-e51_1oq9/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/p7/pynm4r6x1m1f4ww8g5j3lb3m0000gn/T/pip-wheel-y_qy4mk2 --python-tag cp37
       cwd: /private/var/folders/p7/pynm4r6x1m1f4ww8g5j3lb3m0000gn/T/pip-req-build-e51_1oq9/
  Complete output (16 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.7-x86_64-3.7
  creating build/lib.macosx-10.7-x86_64-3.7/pyemd
  copying pyemd/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/pyemd
  copying pyemd/__about__.py -> build/lib.macosx-10.7-x86_64-3.7/pyemd
  running build_ext
  building 'pyemd.emd' extension
  creating build/temp.macosx-10.7-x86_64-3.7
  creating build/temp.macosx-10.7-x86_64-3.7/pyemd
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/arian/miniconda3/include -arch x86_64 -I/Users/arian/miniconda3/include -arch x86_64 -I/Users/arian/miniconda3/include/python3.7m -I/Users/arian/Developer/workspace/signal/tilse/dev/lib/python3.7/site-packages/numpy/core/include -c pyemd/emd.cpp -o build/temp.macosx-10.7-x86_64-3.7/pyemd/emd.o
  clang: error: no such file or directory: 'pyemd/emd.cpp'
  clang: error: no input files
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pyemd
  Running setup.py clean for pyemd
Failed to build pyemd
Installing collected packages: pyemd
  Running setup.py install for pyemd ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/arian/Developer/workspace/signal/tilse/dev/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/p7/pynm4r6x1m1f4ww8g5j3lb3m0000gn/T/pip-req-build-e51_1oq9/setup.py'"'"'; __file__='"'"'/private/var/folders/p7/pynm4r6x1m1f4ww8g5j3lb3m0000gn/T/pip-req-build-e51_1oq9/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/p7/pynm4r6x1m1f4ww8g5j3lb3m0000gn/T/pip-record-a05qi2c7/install-record.txt --single-version-externally-managed --compile --install-headers /Users/arian/Developer/workspace/signal/tilse/dev/include/site/python3.7/pyemd
         cwd: /private/var/folders/p7/pynm4r6x1m1f4ww8g5j3lb3m0000gn/T/pip-req-build-e51_1oq9/
    Complete output (16 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.7
    creating build/lib.macosx-10.7-x86_64-3.7/pyemd
    copying pyemd/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/pyemd
    copying pyemd/__about__.py -> build/lib.macosx-10.7-x86_64-3.7/pyemd
    running build_ext
    building 'pyemd.emd' extension
    creating build/temp.macosx-10.7-x86_64-3.7
    creating build/temp.macosx-10.7-x86_64-3.7/pyemd
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/arian/miniconda3/include -arch x86_64 -I/Users/arian/miniconda3/include -arch x86_64 -I/Users/arian/miniconda3/include/python3.7m -I/Users/arian/Developer/workspace/signal/tilse/dev/lib/python3.7/site-packages/numpy/core/include -c pyemd/emd.cpp -o build/temp.macosx-10.7-x86_64-3.7/pyemd/emd.o
    clang: error: no such file or directory: 'pyemd/emd.cpp'
    clang: error: no input files
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/arian/Developer/workspace/signal/tilse/dev/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/p7/pynm4r6x1m1f4ww8g5j3lb3m0000gn/T/pip-req-build-e51_1oq9/setup.py'"'"'; __file__='"'"'/private/var/folders/p7/pynm4r6x1m1f4ww8g5j3lb3m0000gn/T/pip-req-build-e51_1oq9/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/p7/pynm4r6x1m1f4ww8g5j3lb3m0000gn/T/pip-record-a05qi2c7/install-record.txt --single-version-externally-managed --compile --install-headers /Users/arian/Developer/workspace/signal/tilse/dev/include/site/python3.7/pyemd Check the logs for full command output.
aptlin commented 4 years ago

Any updates? Textacy fails to install because of this.

cc: @bdewilde

Linwei-Chen commented 4 years ago

I met the same problem on MacOS Catalina 10.15.1 Collecting pyemd Downloading https://files.pythonhosted.org/packages/c0/c5/7fea8e7a71cd026b30ed3c40e4c5ea13a173e28f8855da17e25271e8f545/pyemd-0.5.1.tar.gz (91kB) |████████████████████████████████| 92kB 7.4kB/s Requirement already satisfied: numpy<2.0.0,>=1.9.0 in /Users/chenlinwei/anaconda3/envs/DL3.7/lib/python3.7/site-packages (from pyemd) (1.18.0) Building wheels for collected packages: pyemd Building wheel for pyemd (setup.py) ... error ERROR: Command errored out with exit status 1: command: /Users/chenlinwei/anaconda3/envs/DL3.7/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/zb/v9k82d0554g7r1nv3vg44zj40000gn/T/pip-install-aqeow6hv/pyemd/setup.py'"'"'; file='"'"'/private/var/folders/zb/v9k82d0554g7r1nv3vg44zj40000gn/T/pip-install-aqeow6hv/pyemd/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/zb/v9k82d0554g7r1nv3vg44zj40000gn/T/pip-wheel-kearan --python-tag cp37 cwd: /private/var/folders/zb/v9k82d0554g7r1nv3vg44zj40000gn/T/pip-install-aqeow6hv/pyemd/ Complete output (19 lines): running bdist_wheel running build running build_py creating build creating build/lib.macosx-10.7-x86_64-3.7 creating build/lib.macosx-10.7-x86_64-3.7/pyemd copying pyemd/init__.py -> build/lib.macosx-10.7-x86_64-3.7/pyemd copying pyemd/about.py -> build/lib.macosx-10.7-x86_64-3.7/pyemd running build_ext building 'pyemd.emd' extension creating build/temp.macosx-10.7-x86_64-3.7 creating build/temp.macosx-10.7-x86_64-3.7/pyemd gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/chenlinwei/anaconda3/envs/DL3.7/include -arch x86_64 -I/Users/chenlinwei/anaconda3/envs/DL3.7/include -arch x86_64 -Ipyemd -I/Users/chenlinwei/anaconda3/envs/DL3.7/include/python3.7m -I/Users/chenlinwei/anaconda3/envs/DL3.7/lib/python3.7/site-packages/numpy/core/include -c pyemd/emd.cpp -o build/temp.macosx-10.7-x86_64-3.7/pyemd/emd.o warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found] pyemd/emd.cpp:644:10: fatal error: 'ios' file not found

include "ios"

       ^~~~~

1 warning and 1 error generated. error: command 'gcc' failed with exit status 1

ERROR: Failed building wheel for pyemd Running setup.py clean for pyemd Failed to build pyemd Installing collected packages: pyemd Running setup.py install for pyemd ... error ERROR: Command errored out with exit status 1: command: /Users/chenlinwei/anaconda3/envs/DL3.7/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/zb/v9k82d0554g7r1nv3vg44zj40000gn/T/pip-install-aqeow6hv/pyemd/setup.py'"'"'; file='"'"'/private/var/folders/zb/v9k82d0554g7r1nv3vg44zj40000gn/T/pip-install-aqeow6hv/pyemd/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/zb/v9k82d0554g7r1nv3vg44zj40000gn/T/pip-record-otpm2wj7/install-record.txt --single-version-externally-managed --compile cwd: /private/var/folders/zb/v9k82d0554g7r1nv3vg44zj40000gn/T/pip-install-aqeow6hv/pyemd/ Complete output (19 lines): running install running build running build_py creating build creating build/lib.macosx-10.7-x86_64-3.7 creating build/lib.macosx-10.7-x86_64-3.7/pyemd copying pyemd/init.py -> build/lib.macosx-10.7-x86_64-3.7/pyemd copying pyemd/about.py -> build/lib.macosx-10.7-x86_64-3.7/pyemd running build_ext building 'pyemd.emd' extension creating build/temp.macosx-10.7-x86_64-3.7 creating build/temp.macosx-10.7-x86_64-3.7/pyemd gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/chenlinwei/anaconda3/envs/DL3.7/include -arch x86_64 -I/Users/chenlinwei/anaconda3/envs/DL3.7/include -arch x86_64 -Ipyemd -I/Users/chenlinwei/anaconda3/envs/DL3.7/include/python3.7m -I/Users/chenlinwei/anaconda3/envs/DL3.7/lib/python3.7/site-packages/numpy/core/include -c pyemd/emd.cpp -o build/temp.macosx-10.7-x86_64-3.7/pyemd/emd.o warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found] pyemd/emd.cpp:644:10: fatal error: 'ios' file not found

include "ios"

         ^~~~~
1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------

ERROR: Command errored out with exit status 1: /Users/chenlinwei/anaconda3/envs/DL3.7/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/zb/v9k82d0554g7r1nv3vg44zj40000gn/T/pip-install-aqeow6hv/pyemd/setup.py'"'"'; file='"'"'/private/var/folders/zb/v9k82d0554g7r1nv3vg44zj40000gn/T/pip-install-aqeow6hv/pyemd/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/zb/v9k82d0554g7r1nv3vg44zj40000gn/T/pip-record-otpm2wj7/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

jsbaan commented 4 years ago

Facing the same issue; any solutions?

big-c-note commented 4 years ago

Same here

umamicode commented 4 years ago

having the same problem here, is this a common issue?

AkuSilvenius commented 4 years ago

Just faced this issue as well, using:

macOS Mojave 10.14.6 Python 3.7.3 (default, Mar 27 2019, 16:54:48) [Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin

umamicode commented 4 years ago

**just my experience, will delete if this causes a confusion hey guys, i solved this problem by solving the problem associated with the 'gcc' issue which is: error: command 'gcc' failed with exit status 1 in the error code. it seems that the latest version of macOS replaced stdlibc++ with libc++ (honestly, i'm not familiar with the terminology but..) so all we need to do is

Screen Shot 2020-04-01 at 1 41 46 AM

but rather than (the captured image was trying to install korean nlp module btw) in the code, do whatever u were trying to do (i was trying pip install textacy myself)

this is the original blog post i've used. (KOREAN), but would be easier to google in your own languages https://lsjsj92.tistory.com/561

simonsone commented 4 years ago

I had the same problem on OSX Mojave. found just doing export MACOSX_DEPLOYMENT_TARGET=10.10 didn't work for me. However, I found that that running xcode-select --install worked for me, and afterwards I could install with pip3 install pyemd. I am on OSX Mojave. See https://github.com/wmayner/pyemd/issues/39

wmayner commented 4 years ago

I will have some time to look into the various installation issues in a few weeks. In the meantime I'm happy to review PRs.

alexgaskell10 commented 4 years ago

same issue here

NicolasNunezSahr commented 3 years ago

Same issue here, using:

Debian GNU/Linux 9.12 (stretch) Python 3.7.3

rpgoldman commented 3 years ago

The solution by @umamiguy does not work for me. The problem seems to be -- as for many other libraries -- the python glue code for C++ expects to find headers in /usr/include, but this directory is not available because of Apple's SIP (no idea what that is). This causes problems with include <cmath> that ... I don't understand C++ well enough to grok.

This yields error messages like:

    In file included from pyemd/emd.cpp:566:
    In file included from pyemd/lib/emd_hat.hpp:95:
    In file included from pyemd/lib/emd_hat_impl.hpp:13:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:318:9: error: no member named 'fpclassify' in the global namespace
    using ::fpclassify;
          ~~^
112358fn commented 3 years ago

As suggested here

This can be fixed by deleting /Library/Developer/CommandLineTools and running sudo xcode-select -s /Applications/Xcode.app

Not very elegant but I hope it helps.

mschwedeler commented 3 years ago

Had the same issue. For the system:

macOS: 10.15.7-x86_64 CLT: 12.0.31.1 Xcode: 12.4

after doing the following, I could install pyemd into a Python 3.8 virtual environment:

Don't ask me why. See also here.