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 62 forks source link

Cannot install using pip with python3.6 and RHEL 7 #40

Closed CharlyEmpereurmot closed 5 years ago

CharlyEmpereurmot commented 5 years ago

Hey there :)

First, thank you very much for PyEMD :+1:

I'm trying to install using pip with python3.6 under RHEL 7 but I get the following error. This is consistent across several machines / installations I'm trying to build on.

Does someone has any idea where does this come from ? Any help greatly appreciated !

# pip install pyemd
Collecting pyemd
  Using cached https://files.pythonhosted.org/packages/c0/c5/7fea8e7a71cd026b30ed3c40e4c5ea13a173e28f8855da17e25271e8f545/pyemd-0.5.1.tar.gz
Requirement already satisfied: numpy<2.0.0,>=1.9.0 in /usr/local/lib64/python3.6/site-packages (from pyemd) (1.16.4)
Installing collected packages: pyemd
  Running setup.py install for pyemd ... error
    ERROR: Complete output from command /usr/bin/python3.6 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-dchvj4ox/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 /tmp/pip-record-vvppeh96/install-record.txt --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/pyemd
    copying pyemd/__about__.py -> build/lib.linux-x86_64-3.6/pyemd
    copying pyemd/__init__.py -> build/lib.linux-x86_64-3.6/pyemd
    running build_ext
    building 'pyemd.emd' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/pyemd
    gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.6m -I/usr/local/lib64/python3.6/site-packages/numpy/core/include -c pyemd/emd.cpp -o build/temp.linux-x86_64-3.6/pyemd/emd.o
    pyemd/emd.cpp:23:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
                        ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command "/usr/bin/python3.6 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-dchvj4ox/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 /tmp/pip-record-vvppeh96/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-dchvj4ox/pyemd/
CharlyEmpereurmot commented 5 years ago

Sorry I'm the worst animal ... I was missing dev headers etc and this fixed my problem:

yum install python36-devel