Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gfournier opened this issue May 28, 2019 · 3 comments · Fixed by #41
Closed

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

gfournier opened this issue May 28, 2019 · 3 comments · Fixed by #41

Comments

@gfournier
Copy link

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/
@yuoppp
Copy link

yuoppp commented Jun 5, 2019

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

@javabrett
Copy link
Contributor

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 .

@javabrett
Copy link
Contributor

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.

javabrett added a commit to javabrett/pyemd that referenced this issue Jun 10, 2019
…10.9.

Modified setup.py to set env MACOSX_DEPLOYMENT_TARGET=10.9 when the build
MacOS is that or newer, but the default MACOSX_DEPLOYMENT_TARGET (when absent)
is <10.9, which happens when the running Python targets <10.9 min.

This happens for example when running a current Anaconda Python, which
has target 10.7.

This fix taken verbatim from similar in Pandas,
pandas-dev/pandas#24274 .

Fixed wmayner#39.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants