cvangysel / pytrec_eval

pytrec_eval is an Information Retrieval evaluation tool for Python, based on the popular trec_eval.
http://ilps.science.uva.nl/
MIT License
284 stars 32 forks source link

Does not install with pip on the Mac (c++ code does not compile with clang) #2

Closed plopezgarcia closed 5 years ago

plopezgarcia commented 6 years ago

The c++ code does not compile on the Mac when installing with pip install pytrec_eval

Output:

src/pytrec_eval.cpp:637:30: error: expected expression
        RelevanceEvaluatorType = {
                                 ^
    11 warnings and 2 errors generated.
    error: command '/usr/bin/clang' failed with exit status 1

As a workaround, I made it work by installing gcc/g++ with homebrew and setting the environment so that pip uses gcc instead of clang.

Useful links:

cBournhonesque commented 5 years ago

I am still getting the error

plopezgarcia commented 5 years ago

I am now getting a new error on the Mac.

An error occurred while installing pytrec-eval==0.4 --hash=sha256:40b72e90f59751db3c7e385d3797849f6bc634ab07beb398b84301e925f54fb9! Will try again.
  🐍   β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰ 58/58 β€” 00:00:30
Installing initially failed dependencies…
[pipenv.exceptions.InstallError]:   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pipenv/core.py", line 1992, in do_install
[pipenv.exceptions.InstallError]:       skip_lock=skip_lock,
[pipenv.exceptions.InstallError]:   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pipenv/core.py", line 1253, in do_init
[pipenv.exceptions.InstallError]:       pypi_mirror=pypi_mirror,
[pipenv.exceptions.InstallError]:   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pipenv/core.py", line 859, in do_install_dependencies
[pipenv.exceptions.InstallError]:       retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
[pipenv.exceptions.InstallError]:   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pipenv/core.py", line 763, in batch_install
[pipenv.exceptions.InstallError]:       _cleanup_procs(procs, not blocking, failed_deps_queue, retry=retry)
[pipenv.exceptions.InstallError]:   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pipenv/core.py", line 681, in _cleanup_procs
[pipenv.exceptions.InstallError]:       raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: ['Collecting pytrec-eval==0.4 (from -r /var/folders/hg/6k165r415tz6z8bjkg3yqz2m0000gn/T/pipenv-d3vblonf-requirements/pipenv-mxq0qbsm-requirement.txt (line 1))', '  Using cached https://files.pythonhosted.org/packages/36/0a/5809ba805e62c98f81e19d6007132712945c78e7612c11f61bac76a25ba3/pytrec_eval-0.4.tar.gz', 'Building wheels for collected packages: pytrec-eval', '  Building wheel for pytrec-eval (setup.py): started', "  Building wheel for pytrec-eval (setup.py): finished with status 'error'", '  Running setup.py clean for pytrec-eval', 'Failed to build pytrec-eval', 'Installing collected packages: pytrec-eval', '  Running setup.py install for pytrec-eval: started', "    Running setup.py install for pytrec-eval: finished with status 'error'"]
[pipenv.exceptions.InstallError]: ['ERROR: Complete output from command /Users/plopez/.local/share/virtualenvs/python-experiments-TzFWBQTs/bin/python3 -u -c \'import setuptools, tokenize;__file__=\'"\'"\'/private/var/folders/hg/6k165r415tz6z8bjkg3yqz2m0000gn/T/pip-install-2b5ejni8/pytrec-eval/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/hg/6k165r415tz6z8bjkg3yqz2m0000gn/T/pip-wheel-x6aay58y --python-tag cp36:', '  ERROR: Fetching trec_eval from https://github.com/usnistgov/trec_eval/archive/v9.0.5.zip.', '  running bdist_wheel', '  running build', '  running build_py', '  creating build', '  creating build/lib.macosx-10.6-intel-3.6', '  creating build/lib.macosx-10.6-intel-3.6/pytrec_eval', '  copying py/__init__.py -> build/lib.macosx-10.6-intel-3.6/pytrec_eval', '  warning: build_py: byte-compiling is disabled, skipping.', '  ', '  running build_ext', "  building 'pytrec_eval_ext' extension", '  creating build/temp.macosx-10.6-intel-3.6', '  creating build/temp.macosx-10.6-intel-3.6/src', '  creating build/temp.macosx-10.6-intel-3.6/var', '  creating build/temp.macosx-10.6-intel-3.6/var/folders', '  creating build/temp.macosx-10.6-intel-3.6/var/folders/hg', '  creating build/temp.macosx-10.6-intel-3.6/var/folders/hg/6k165r415tz6z8bjkg3yqz2m0000gn', '  creating build/temp.macosx-10.6-intel-3.6/var/folders/hg/6k165r415tz6z8bjkg3yqz2m0000gn/T', '  creating build/temp.macosx-10.6-intel-3.6/var/folders/hg/6k165r415tz6z8bjkg3yqz2m0000gn/T/tmpzu91qbsk', '  creating build/temp.macosx-10.6-intel-3.6/var/folders/hg/6k165r415tz6z8bjkg3yqz2m0000gn/T/tmpzu91qbsk/trec_eval-9.0.5', '  /usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DVERSIONID="pytrec_eval" -D_GLIBCXX_USE_CXX11_ABI=0 -DP_NEEDS_GNU_CXX_NAMESPACE=1 -UNDEBUG -I/var/folders/hg/6k165r415tz6z8bjkg3yqz2m0000gn/T/tmpzu91qbsk/trec_eval-9.0.5 -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c src/pytrec_eval.cpp -o build/temp.macosx-10.6-intel-3.6/src/pytrec_eval.o -g -Wall -O3', "  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]", "  src/pytrec_eval.cpp:19:10: fatal error: 'algorithm' file not found", '  #include <algorithm>', '           ^~~~~~~~~~~', '  1 warning and 1 error generated.', "  error: command '/usr/bin/clang' failed with exit status 1", '  ----------------------------------------', '  ERROR: Failed building wheel for pytrec-eval', '    ERROR: Complete output from command /Users/plopez/.local/share/virtualenvs/python-experiments-TzFWBQTs/bin/python3 -u -c \'import setuptools, tokenize;__file__=\'"\'"\'/private/var/folders/hg/6k165r415tz6z8bjkg3yqz2m0000gn/T/pip-install-2b5ejni8/pytrec-eval/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/hg/6k165r415tz6z8bjkg3yqz2m0000gn/T/pip-record-fvdt44zv/install-record.txt --single-version-externally-managed --compile --install-headers /Users/plopez/.local/share/virtualenvs/python-experiments-TzFWBQTs/bin/../include/site/python3.6/pytrec-eval:', '    ERROR: Fetching trec_eval from https://github.com/usnistgov/trec_eval/archive/v9.0.5.zip.', '    running install', '    running build', '    running build_py', '    creating build', '    creating build/lib.macosx-10.6-intel-3.6', '    creating build/lib.macosx-10.6-intel-3.6/pytrec_eval', '    copying py/__init__.py -> build/lib.macosx-10.6-intel-3.6/pytrec_eval', '    warning: build_py: byte-compiling is disabled, skipping.', '    ', '    running build_ext', "    building 'pytrec_eval_ext' extension", '    creating build/temp.macosx-10.6-intel-3.6', '    creating build/temp.macosx-10.6-intel-3.6/src', '    creating build/temp.macosx-10.6-intel-3.6/var', '    creating build/temp.macosx-10.6-intel-3.6/var/folders', '    creating build/temp.macosx-10.6-intel-3.6/var/folders/hg', '    creating build/temp.macosx-10.6-intel-3.6/var/folders/hg/6k165r415tz6z8bjkg3yqz2m0000gn', '    creating build/temp.macosx-10.6-intel-3.6/var/folders/hg/6k165r415tz6z8bjkg3yqz2m0000gn/T', '    creating build/temp.macosx-10.6-intel-3.6/var/folders/hg/6k165r415tz6z8bjkg3yqz2m0000gn/T/tmpcwabdh6j', '    creating build/temp.macosx-10.6-intel-3.6/var/folders/hg/6k165r415tz6z8bjkg3yqz2m0000gn/T/tmpcwabdh6j/trec_eval-9.0.5', '    /usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DVERSIONID="pytrec_eval" -D_GLIBCXX_USE_CXX11_ABI=0 -DP_NEEDS_GNU_CXX_NAMESPACE=1 -UNDEBUG -I/var/folders/hg/6k165r415tz6z8bjkg3yqz2m0000gn/T/tmpcwabdh6j/trec_eval-9.0.5 -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c src/pytrec_eval.cpp -o build/temp.macosx-10.6-intel-3.6/src/pytrec_eval.o -g -Wall -O3', "    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]", "    src/pytrec_eval.cpp:19:10: fatal error: 'algorithm' file not found", '    #include <algorithm>', '             ^~~~~~~~~~~', '    1 warning and 1 error generated.', "    error: command '/usr/bin/clang' failed with exit status 1", '    ----------------------------------------', 'ERROR: Command "/Users/plopez/.local/share/virtualenvs/python-experiments-TzFWBQTs/bin/python3 -u -c \'import setuptools, tokenize;__file__=\'"\'"\'/private/var/folders/hg/6k165r415tz6z8bjkg3yqz2m0000gn/T/pip-install-2b5ejni8/pytrec-eval/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/hg/6k165r415tz6z8bjkg3yqz2m0000gn/T/pip-record-fvdt44zv/install-record.txt --single-version-externally-managed --compile --install-headers /Users/plopez/.local/share/virtualenvs/python-experiments-TzFWBQTs/bin/../include/site/python3.6/pytrec-eval" failed with error code 1 in /private/var/folders/hg/6k165r415tz6z8bjkg3yqz2m0000gn/T/pip-install-2b5ejni8/pytrec-eval/']
ERROR: ERROR: Package installation failed...