wmayner / pyemd

Fast EMD for Python: a wrapper for Pele and Werman's C++ implementation of the Earth Mover's Distance metric

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pyemd not building on MacOS X "Mojave" + Python 3.7

gfournier opened this issue · comments

pyemd fails installing on python 3.7 environment on Mac OS X Mojave (version 10.14.3).

Python 3.6

conda create -n test_pyemd_py36 python=3.6
pip install pyemd

Installation successful.

Python 3.7

conda create -n test_pyemd_py37 python=3.7
pip install premed

Fails while rebuilding wheels (because not published).

Error log:

    ERROR: Complete output from command /anaconda3/envs/test_pyemd_py37/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/d1/fh2k9h6s6j39smdvttzv4hx40000gn/T/pip-install-06if_qq4/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/d1/fh2k9h6s6j39smdvttzv4hx40000gn/T/pip-record-9l7e48vz/install-record.txt --single-version-externally-managed --compile:
    ERROR: 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/anaconda3/envs/test_pyemd_py37/include -arch x86_64 -I/anaconda3/envs/test_pyemd_py37/include -arch x86_64 -I/anaconda3/envs/test_pyemd_py37/include/python3.7m -I/anaconda3/envs/test_pyemd_py37/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 '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
    pyemd/emd.cpp:556:10: fatal error: 'utility' file not found
    #include <utility>
             ^~~~~~~~~
    1 warning and 1 error generated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command "/anaconda3/envs/test_pyemd_py37/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/d1/fh2k9h6s6j39smdvttzv4hx40000gn/T/pip-install-06if_qq4/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/d1/fh2k9h6s6j39smdvttzv4hx40000gn/T/pip-record-9l7e48vz/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/d1/fh2k9h6s6j39smdvttzv4hx40000gn/T/pip-install-06if_qq4/pyemd/

Facing the same issue.
I don't want to downgrade python version

Solution for this:

  1. Ensure you have XCode installed - xcode-select --install
  2. You may also benefit from running the package /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

... but neither of these is likely to fix. What will is, before installing, do:

export MACOSX_DEPLOYMENT_TARGET=10.9

It looks like there's some XCode/platform version compat issues. This project may need a PR similar to https://github.com/pandas-dev/pandas/pull/24274/files .

Note that this should mainly be a problem for Anaconda Python builds. The target MACOSX_DEPLOYMENT_TARGET comes from sysconfig variables, so you can check any Python dists you are trying to build with:

>>> import sysconfig;sysconfig.get_config_vars()['MACOSX_DEPLOYMENT_TARGET']
'10.7'

Above is from Anaconda Python 3.7.1. If I switch to the standard or Brew python dists, I get 10.9.