storpipfugl / pykdtree

Fast kd-tree implementation in Python
GNU Lesser General Public License v3.0
215 stars 47 forks source link

pip installation error #54

Closed raybellwaves closed 2 years ago

raybellwaves commented 4 years ago

This pops up when installing satpy and its dependencies using pip (https://github.com/pytroll/satpy/issues/1337).

On MacOS.

$ conda create -n test_env python=3.8
$ conda activate test_env

(test_env) Ray@UM-404XFVH4 ~ % pip install pykdtree               
Collecting pykdtree
  Using cached pykdtree-1.3.1.tar.gz (78 kB)
Collecting numpy
  Using cached numpy-1.19.1-cp38-cp38-macosx_10_9_x86_64.whl (15.3 MB)
Building wheels for collected packages: pykdtree
  Building wheel for pykdtree (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/Ray/miniconda3/envs/test_env/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/19/wvb4n9js73z6j4sv545bfvxm0000gq/T/pip-install-zncrrmi8/pykdtree/setup.py'"'"'; __file__='"'"'/private/var/folders/19/wvb4n9js73z6j4sv545bfvxm0000gq/T/pip-install-zncrrmi8/pykdtree/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/19/wvb4n9js73z6j4sv545bfvxm0000gq/T/pip-wheel-kd4yfwat
       cwd: /private/var/folders/19/wvb4n9js73z6j4sv545bfvxm0000gq/T/pip-install-zncrrmi8/pykdtree/
  Complete output (15 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-3.8
  creating build/lib.macosx-10.9-x86_64-3.8/pykdtree
  copying pykdtree/test_tree.py -> build/lib.macosx-10.9-x86_64-3.8/pykdtree
  copying pykdtree/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pykdtree
  running build_ext
  building 'pykdtree.kdtree' extension
  creating build/temp.macosx-10.9-x86_64-3.8
  creating build/temp.macosx-10.9-x86_64-3.8/pykdtree
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/Ray/miniconda3/envs/test_env/include -arch x86_64 -I/Users/Ray/miniconda3/envs/test_env/include -arch x86_64 -I/Users/Ray/miniconda3/envs/test_env/include/python3.8 -I/private/var/folders/19/wvb4n9js73z6j4sv545bfvxm0000gq/T/pip-install-zncrrmi8/pykdtree/.eggs/numpy-1.19.1-py3.8-macosx-10.9-x86_64.egg/numpy/core/include -c pykdtree/kdtree.c -o build/temp.macosx-10.9-x86_64-3.8/pykdtree/kdtree.o -std=c99 -O3 -fopenmp
  clang: error: unsupported option '-fopenmp'
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pykdtree
  Running setup.py clean for pykdtree
Failed to build pykdtree
DEPRECATION: Could not build wheels for pykdtree which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
Installing collected packages: numpy, pykdtree
    Running setup.py install for pykdtree ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/Ray/miniconda3/envs/test_env/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/19/wvb4n9js73z6j4sv545bfvxm0000gq/T/pip-install-zncrrmi8/pykdtree/setup.py'"'"'; __file__='"'"'/private/var/folders/19/wvb4n9js73z6j4sv545bfvxm0000gq/T/pip-install-zncrrmi8/pykdtree/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/19/wvb4n9js73z6j4sv545bfvxm0000gq/T/pip-record-7lgyz2ap/install-record.txt --single-version-externally-managed --compile --install-headers /Users/Ray/miniconda3/envs/test_env/include/python3.8/pykdtree
         cwd: /private/var/folders/19/wvb4n9js73z6j4sv545bfvxm0000gq/T/pip-install-zncrrmi8/pykdtree/
    Complete output (15 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.8
    creating build/lib.macosx-10.9-x86_64-3.8/pykdtree
    copying pykdtree/test_tree.py -> build/lib.macosx-10.9-x86_64-3.8/pykdtree
    copying pykdtree/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pykdtree
    running build_ext
    building 'pykdtree.kdtree' extension
    creating build/temp.macosx-10.9-x86_64-3.8
    creating build/temp.macosx-10.9-x86_64-3.8/pykdtree
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/Ray/miniconda3/envs/test_env/include -arch x86_64 -I/Users/Ray/miniconda3/envs/test_env/include -arch x86_64 -I/Users/Ray/miniconda3/envs/test_env/include/python3.8 -I/Users/Ray/miniconda3/envs/test_env/lib/python3.8/site-packages/numpy/core/include -c pykdtree/kdtree.c -o build/temp.macosx-10.9-x86_64-3.8/pykdtree/kdtree.o -std=c99 -O3 -fopenmp
    clang: error: unsupported option '-fopenmp'
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/Ray/miniconda3/envs/test_env/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/19/wvb4n9js73z6j4sv545bfvxm0000gq/T/pip-install-zncrrmi8/pykdtree/setup.py'"'"'; __file__='"'"'/private/var/folders/19/wvb4n9js73z6j4sv545bfvxm0000gq/T/pip-install-zncrrmi8/pykdtree/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/19/wvb4n9js73z6j4sv545bfvxm0000gq/T/pip-record-7lgyz2ap/install-record.txt --single-version-externally-managed --compile --install-headers /Users/Ray/miniconda3/envs/test_env/include/python3.8/pykdtree Check the logs for full command output.
joleenf commented 4 years ago

Not sure if this is the exact same problem seen when performing a pip install -e . in development mode:

    Running setup.py install for pykdtree ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/joleenf/miniconda3/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wm/41wmwmns5sv0cwh621_29z880000gp/T/pip-install-4rbqbnnj/pykdtree/setup.py'"'"'; __file__='"'"'/private/var/folders/wm/41wmwmns5sv0cwh621_29z880000gp/T/pip-install-4rbqbnnj/pykdtree/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/wm/41wmwmns5sv0cwh621_29z880000gp/T/pip-record-khlagwoi/install-record.txt --single-version-externally-managed --compile --install-headers /Users/joleenf/miniconda3/include/python3.6m/pykdtree
         cwd: /private/var/folders/wm/41wmwmns5sv0cwh621_29z880000gp/T/pip-install-4rbqbnnj/pykdtree/
    Complete output (26 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.6
    creating build/lib.macosx-10.7-x86_64-3.6/pykdtree
    copying pykdtree/test_tree.py -> build/lib.macosx-10.7-x86_64-3.6/pykdtree
    copying pykdtree/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/pykdtree
    running build_ext
    building 'pykdtree.kdtree' extension
    creating build/temp.macosx-10.7-x86_64-3.6
    creating build/temp.macosx-10.7-x86_64-3.6/pykdtree
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/joleenf/miniconda3/include -arch x86_64 -I/Users/joleenf/miniconda3/include -arch x86_64 -I/Users/joleenf/miniconda3/include/python3.6m -I/Users/joleenf/miniconda3/lib/python3.6/site-packages/numpy/core/include -c pykdtree/kdtree.c -o build/temp.macosx-10.7-x86_64-3.6/pykdtree/kdtree.o -std=c99 -O3 -fopenmp
    In file included from pykdtree/kdtree.c:525:
    In file included from /Users/joleenf/miniconda3/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4:
    In file included from /Users/joleenf/miniconda3/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
    In file included from /Users/joleenf/miniconda3/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830:
    /Users/joleenf/miniconda3/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
    #warning "Using deprecated NumPy API, disable it with " \
     ^
    1 warning generated.
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/joleenf/miniconda3/include -arch x86_64 -I/Users/joleenf/miniconda3/include -arch x86_64 -I/Users/joleenf/miniconda3/include/python3.6m -I/Users/joleenf/miniconda3/lib/python3.6/site-packages/numpy/core/include -c pykdtree/_kdtree_core.c -o build/temp.macosx-10.7-x86_64-3.6/pykdtree/_kdtree_core.o -std=c99 -O3 -fopenmp
    gcc -bundle -undefined dynamic_lookup -L/Users/joleenf/miniconda3/lib -arch x86_64 -L/Users/joleenf/miniconda3/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.6/pykdtree/kdtree.o build/temp.macosx-10.7-x86_64-3.6/pykdtree/_kdtree_core.o -o build/lib.macosx-10.7-x86_64-3.6/pykdtree/kdtree.cpython-36m-darwin.so -lgomp
    ld: library not found for -lgomp
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/joleenf/miniconda3/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wm/41wmwmns5sv0cwh621_29z880000gp/T/pip-install-4rbqbnnj/pykdtree/setup.py'"'"'; __file__='"'"'/private/var/folders/wm/41wmwmns5sv0cwh621_29z880000gp/T/pip-install-4rbqbnnj/pykdtree/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/wm/41wmwmns5sv0cwh621_29z880000gp/T/pip-record-khlagwoi/install-record.txt --single-version-externally-managed --compile --install-headers /Users/joleenf/miniconda3/include/python3.6m/pykdtree Check the logs for full command output.

However, it seems that installing with the version number resolved the issue, I can at least import satpy and pykdtree now.

conda install --name satpy-dev pykdtree=1.3.1 pip install -e .

The conda install with a pykdtree version number as written above did not really work.

djhoese commented 2 years ago

I just made a release on PyPI (not on conda-forge yet) that has Python 3.10 wheels (and 3.8 and 3.9). Could one of you try installing it and see if you get installation errors?

joleenf commented 2 years ago

There were no install errors for me.

djhoese commented 2 years ago

Ok, thanks @joleenf. Let's close this and if someone has installation issues with a recent release of pykdtree, please file a new bug.