hdmedians icon indicating copy to clipboard operation
hdmedians copied to clipboard

Pip installation error "ERROR: Failed building wheel for hdmedians"

Open chris-rands opened this issue 2 years ago • 3 comments

Hello, we get an error when trying to install via pip in a virtualenv. "ERROR: Failed building wheel for hdmedians". Full traceback follows. Thank you for your help

$ python3.8 -m pip install hdmedians
Collecting hdmedians
  Using cached hdmedians-0.14.2.tar.gz (7.6 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting numpy
  Using cached numpy-1.22.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.8 MB)
Collecting Cython>=0.23
  Using cached Cython-0.29.28-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (1.9 MB)
Building wheels for collected packages: hdmedians
  Building wheel for hdmedians (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for hdmedians (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [30 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.8
      creating build/lib.linux-x86_64-3.8/hdmedians
      copying hdmedians/__init__.py -> build/lib.linux-x86_64-3.8/hdmedians
      copying hdmedians/medoid.py -> build/lib.linux-x86_64-3.8/hdmedians
      creating build/lib.linux-x86_64-3.8/hdmedians/tests
      copying hdmedians/tests/test_medoid.py -> build/lib.linux-x86_64-3.8/hdmedians/tests
      copying hdmedians/tests/test_geomedian.py -> build/lib.linux-x86_64-3.8/hdmedians/tests
      copying hdmedians/tests/__init__.py -> build/lib.linux-x86_64-3.8/hdmedians/tests
      running build_ext
      cythoning hdmedians/geomedian.pyx to hdmedians/geomedian.c
      building 'hdmedians.geomedian' extension
      creating build/temp.linux-x86_64-3.8
      creating build/temp.linux-x86_64-3.8/hdmedians
      /home/user/.conda/envs/py38/bin/x86_64-conda-linux-gnu-cc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/user/.conda/envs/py38/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/user/.conda/envs/py38/include -fPIC -I/scratch/user/pip-build-env-gcmtcp8a/overlay/lib/python3.8/site-packages/numpy/core/include -I/home/user/scanpy/scanpy_env2/include -I/home/user/.conda/envs/py38/include/python3.8 -c hdmedians/geomedian.c -o build/temp.linux-x86_64-3.8/hdmedians/geomedian.o
      In file included from /scratch/user/pip-build-env-gcmtcp8a/overlay/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,
                       from /scratch/user/pip-build-env-gcmtcp8a/overlay/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                       from /scratch/user/pip-build-env-gcmtcp8a/overlay/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                       from hdmedians/geomedian.c:688:
      /scratch/user/pip-build-env-gcmtcp8a/overlay/lib/python3.8/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
       #warning "Using deprecated NumPy API, disable it with " \
        ^~~~~~~
      gcc -pthread -shared -B /home/user/.conda/envs/py38/compiler_compat -L/home/user/.conda/envs/py38/lib -Wl,-rpath=/home/user/.conda/envs/py38/lib -Wl,--no-as-needed -Wl,--sysroot=/ -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/home/user/.conda/envs/py38/lib -Wl,-rpath-link,/home/user/.conda/envs/py38/lib -L/home/user/.conda/envs/py38/lib -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/user/.conda/envs/py38/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/user/.conda/envs/py38/include build/temp.linux-x86_64-3.8/hdmedians/geomedian.o -o build/lib.linux-x86_64-3.8/hdmedians/geomedian.cpython-38-x86_64-linux-gnu.so
      gcc: error: unrecognized command line option ‘-fno-plt’
      /scratch/user/pip-build-env-gcmtcp8a/overlay/lib/python3.8/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /scratch/user/pip-install-b_2ajirb/hdmedians_a6d88b5d918246fcbca4200687f7dc4d/hdmedians/geomedian.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      error: command '/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for hdmedians
Failed to build hdmedians
ERROR: Could not build wheels for hdmedians, which is required to install pyproject.toml-based projects

chris-rands avatar Mar 23 '22 20:03 chris-rands

I had the same issue and resolved it by:

  1. pip3 install --upgrade pip
  2. pip install --upgrade pip setuptools wheel
  3. Upgrading Microsoft Visual C++ (14.0 or greater)

Alex-Kopylov avatar Aug 16 '22 08:08 Alex-Kopylov

Getting a similar error when trying to download biocore/evident. Error was leading to hdmedians so tried to update to 0.14.2 but got this following error:

  Building wheel for hdmedians (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/atharvakulkarni/miniforge3/envs/qiime2-2020.6-v2/bin/python3.6 /Users/atharvakulkarni/miniforge3/envs/qiime2-2020.6-v2/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /var/folders/hg/mjm9vbvs4zvbh9qc0q2jxsdw0000gn/T/tmpzi9vtm5j
       cwd: /private/var/folders/hg/mjm9vbvs4zvbh9qc0q2jxsdw0000gn/T/pip-install-egsrakg7/hdmedians_f0e2821505e44df2817a8c1cd462123d
  Complete output (33 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-3.6
  creating build/lib.macosx-10.9-x86_64-3.6/hdmedians
  copying hdmedians/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/hdmedians
  copying hdmedians/medoid.py -> build/lib.macosx-10.9-x86_64-3.6/hdmedians
  creating build/lib.macosx-10.9-x86_64-3.6/hdmedians/tests
  copying hdmedians/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/hdmedians/tests
  copying hdmedians/tests/test_geomedian.py -> build/lib.macosx-10.9-x86_64-3.6/hdmedians/tests
  copying hdmedians/tests/test_medoid.py -> build/lib.macosx-10.9-x86_64-3.6/hdmedians/tests
  running build_ext
  cythoning hdmedians/geomedian.pyx to hdmedians/geomedian.c
  building 'hdmedians.geomedian' extension
  creating build/temp.macosx-10.9-x86_64-3.6
  creating build/temp.macosx-10.9-x86_64-3.6/hdmedians
  x86_64-apple-darwin13.4.0-clang -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/atharvakulkarni/miniforge3/envs/qiime2-2020.6-v2/include -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -isystem /Users/atharvakulkarni/miniforge3/envs/qiime2-2020.6-v2/include -I/private/var/folders/hg/mjm9vbvs4zvbh9qc0q2jxsdw0000gn/T/pip-build-env-ty4dq1si/overlay/lib/python3.6/site-packages/numpy/core/include -I/Users/atharvakulkarni/miniforge3/envs/qiime2-2020.6-v2/include/python3.6m -c hdmedians/geomedian.c -o build/temp.macosx-10.9-x86_64-3.6/hdmedians/geomedian.o
  In file included from hdmedians/geomedian.c:747:
  In file included from /private/var/folders/hg/mjm9vbvs4zvbh9qc0q2jxsdw0000gn/T/pip-build-env-ty4dq1si/overlay/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4:
  In file included from /private/var/folders/hg/mjm9vbvs4zvbh9qc0q2jxsdw0000gn/T/pip-build-env-ty4dq1si/overlay/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18:
  In file included from /private/var/folders/hg/mjm9vbvs4zvbh9qc0q2jxsdw0000gn/T/pip-build-env-ty4dq1si/overlay/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1809:
  /private/var/folders/hg/mjm9vbvs4zvbh9qc0q2jxsdw0000gn/T/pip-build-env-ty4dq1si/overlay/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by "          "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
  #warning "Using deprecated NumPy API, disable it by " \
   ^
  1 warning generated.
  x86_64-apple-darwin13.4.0-clang -bundle -undefined dynamic_lookup -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-rpath,/Users/atharvakulkarni/miniforge3/envs/qiime2-2020.6-v2/lib -L/Users/atharvakulkarni/miniforge3/envs/qiime2-2020.6-v2/lib -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-rpath,/Users/atharvakulkarni/miniforge3/envs/qiime2-2020.6-v2/lib -L/Users/atharvakulkarni/miniforge3/envs/qiime2-2020.6-v2/lib -Wl,-export_dynamic -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/atharvakulkarni/miniforge3/envs/qiime2-2020.6-v2/lib -L/Users/atharvakulkarni/miniforge3/envs/qiime2-2020.6-v2/lib -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/atharvakulkarni/miniforge3/envs/qiime2-2020.6-v2/include -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -isystem /Users/atharvakulkarni/miniforge3/envs/qiime2-2020.6-v2/include -arch x86_64 build/temp.macosx-10.9-x86_64-3.6/hdmedians/geomedian.o -o build/lib.macosx-10.9-x86_64-3.6/hdmedians/geomedian.cpython-36m-darwin.so
  ld: warning: -pie being ignored. It is only used when linking a main executable
  ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/lib/libSystem.tbd' for architecture x86_64
  clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
  /private/var/folders/hg/mjm9vbvs4zvbh9qc0q2jxsdw0000gn/T/pip-build-env-ty4dq1si/overlay/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /private/var/folders/hg/mjm9vbvs4zvbh9qc0q2jxsdw0000gn/T/pip-install-egsrakg7/hdmedians_f0e2821505e44df2817a8c1cd462123d/hdmedians/geomedian.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  error: command 'x86_64-apple-darwin13.4.0-clang' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for hdmedians
Failed to build hdmedians
ERROR: Could not build wheels for hdmedians, which is required to install pyproject.toml-based projects

For reference this is a m1 macbook running on Monterey 12.3

tharvipop avatar Aug 25 '22 21:08 tharvipop

Hello I had the same problem in Ubunutu, but updating setuptools and wheel did not change anything (I already had the last version).

To fix the problem I had to install apt packages : apt-get install gcc libpq-dev python3-dev

After that, I could install hdmedians with pip, hope this could help ! :)

BobBDE avatar Jul 10 '23 13:07 BobBDE