jdtuck / fdasrsf_python

elastic fda python code
http://research.tetonedge.net
BSD 3-Clause "New" or "Revised" License
52 stars 18 forks source link

Unable to install, ERROR: Failed building wheel for fdasrsf #47

Closed shanghongxie closed 4 months ago

shanghongxie commented 4 months ago

I am using Spyder Python 3.8.1 in MacOS Monterey. I tried to install fdasrsf using the command in Spyder: pip install fdasrsf However, I got the following errors. Could you help me to resolve it?

Building wheel for fdasrsf (pyproject.toml) ... [?25lerror error: subprocess-exited-with-error

× Building wheel for fdasrsf (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [103 lines of output] generating build/_DP.c (already up-to-date) running bdist_wheel running build running build_py creating build/lib.macosx-10.9-x86_64-cpython-38 creating build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/plot_style.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/curve_stats.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/curve_functions.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/interparc.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/geodesic.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/utility_functions.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/regression.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/elastic_glm_regression.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/tolerance.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/elastic_changepoint.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/gp.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/pcr_regression.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/image_functions.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/init.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/kmeans.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/fPCA.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/bayesian_functions.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/umap_metric.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/time_warping.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/geometry.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/curve_regression.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/rbfgs.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/fPLS.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/boxplots.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/image.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf copying fdasrsf/curve_pcr_regression.py -> build/lib.macosx-10.9-x86_64-cpython-38/fdasrsf running egg_info writing fdasrsf.egg-info/PKG-INFO writing dependency_links to fdasrsf.egg-info/dependency_links.txt writing requirements to fdasrsf.egg-info/requires.txt writing top-level names to fdasrsf.egg-info/top_level.txt reading manifest file 'fdasrsf.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'LICENSE.txt' writing manifest file 'fdasrsf.egg-info/SOURCES.txt' running build_ext Installation: Using BLAS library found in: /Users/shanghongxie/opt/anaconda3/lib/libmkl_rt.dylib

  Compiling src/optimum_reparamN2.pyx because it changed.
  [1/1] Cythonizing src/optimum_reparamN2.pyx
  building 'optimum_reparamN2' extension
  C compiler: x86_64-apple-darwin13.4.0-clang -fno-strict-aliasing -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O3 -Wall -Wstrict-prototypes -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O3 -pipe -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=/Users/shanghongxie/opt/anaconda3=/usr/local/src/conda-prefix -flto -Wl,-export_dynamic -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O3 -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/shanghongxie/opt/anaconda3/include -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -isystem /Users/shanghongxie/opt/anaconda3/include

  creating build/temp.macosx-10.9-x86_64-cpython-38
  creating build/temp.macosx-10.9-x86_64-cpython-38/src
  compile options: '-DHAS_MKL -DNO_CBLAS_HEADER -I/private/var/folders/05/08wdkcbd2cqf7v5s7w_7dzy40000gn/T/pip-build-env-43me83q0/overlay/lib/python3.8/site-packages/numpy/core/include -I/private/var/folders/05/08wdkcbd2cqf7v5s7w_7dzy40000gn/T/pip-build-env-43me83q0/overlay/lib/python3.8/site-packages/findblas/ -I/Users/shanghongxie/opt/anaconda3/include/python3.8 -c'
  x86_64-apple-darwin13.4.0-clang: src/DynamicProgrammingQ2.c
  x86_64-apple-darwin13.4.0-clang: src/dp_grid.c
  x86_64-apple-darwin13.4.0-clang: src/dp_nbhd.c
  x86_64-apple-darwin13.4.0-clang: src/optimum_reparamN2.c
  clang-10: warning: -Wl,-export_dynamic: 'linker' input unused [-Wunused-command-line-argument]
  clang-10: warning: -Wl,-export_dynamic: 'linker' input unused [-Wunused-command-line-argument]
  clang-10: warning: -Wl,-export_dynamic: 'linker' input unused [-Wunused-command-line-argument]
  clang-10: warning: -Wl,-export_dynamic: 'linker' input unused [-Wunused-command-line-argument]
  src/dp_grid.c:31:19: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
        for ( i=0; i<dp_nbhd_count; ++i )
                   ~^~~~~~~~~~~~~~
  1 warning generated.
  In file included from src/optimum_reparamN2.c:1289:
  In file included from /private/var/folders/05/08wdkcbd2cqf7v5s7w_7dzy40000gn/T/pip-build-env-43me83q0/overlay/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:4:
  In file included from /private/var/folders/05/08wdkcbd2cqf7v5s7w_7dzy40000gn/T/pip-build-env-43me83q0/overlay/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
  In file included from /private/var/folders/05/08wdkcbd2cqf7v5s7w_7dzy40000gn/T/pip-build-env-43me83q0/overlay/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830:
  /private/var/folders/05/08wdkcbd2cqf7v5s7w_7dzy40000gn/T/pip-build-env-43me83q0/overlay/lib/python3.8/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 " \
   ^
  src/optimum_reparamN2.c:16410:76: warning: code will never be executed [-Wunreachable-code]
          if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad;
                                                                             ^~~~~~~~
  src/optimum_reparamN2.c:16410:73: note: silence by adding parentheses to mark code as explicitly dead
          if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad;
                                                                          ^
                                                                          /* DISABLES CODE */ ( )
  src/optimum_reparamN2.c:16819:26: warning: code will never be executed [-Wunreachable-code]
                  module = PyImport_ImportModuleLevelObject(
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/optimum_reparamN2.c:18213:5: warning: 'tp_print' is deprecated [-Wdeprecated-declarations]
      0,
      ^
  /Users/shanghongxie/opt/anaconda3/include/python3.8/cpython/object.h:260:5: note: 'tp_print' has been explicitly marked deprecated here
      Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);
      ^
  /Users/shanghongxie/opt/anaconda3/include/python3.8/pyport.h:515:54: note: expanded from macro 'Py_DEPRECATED'
  #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                       ^
  4 warnings generated.
  x86_64-apple-darwin13.4.0-clang -bundle -undefined dynamic_lookup -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/shanghongxie/opt/anaconda3/lib -L/Users/shanghongxie/opt/anaconda3/lib -flto -Wl,-export_dynamic -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/shanghongxie/opt/anaconda3/lib -L/Users/shanghongxie/opt/anaconda3/lib -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/shanghongxie/opt/anaconda3/lib -L/Users/shanghongxie/opt/anaconda3/lib -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/shanghongxie/opt/anaconda3/include -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -isystem /Users/shanghongxie/opt/anaconda3/include build/temp.macosx-10.9-x86_64-cpython-38/src/DynamicProgrammingQ2.o build/temp.macosx-10.9-x86_64-cpython-38/src/dp_grid.o build/temp.macosx-10.9-x86_64-cpython-38/src/dp_nbhd.o build/temp.macosx-10.9-x86_64-cpython-38/src/optimum_reparamN2.o -o build/lib.macosx-10.9-x86_64-cpython-38/optimum_reparamN2.cpython-38-darwin.so -L/Users/shanghongxie/opt/anaconda3/lib -lmkl_rt -Wl,-rpath,/Users/shanghongxie/opt/anaconda3/lib
  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/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64
  clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
  <string>:53: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  not modified: 'build/_DP.c'
  /private/var/folders/05/08wdkcbd2cqf7v5s7w_7dzy40000gn/T/pip-build-env-43me83q0/overlay/lib/python3.8/site-packages/findblas/distutils.py:165: UserWarning: No CBLAS headers were found - function propotypes might be unreliable.
    warnings.warn(warning_msg)
  error: Command "x86_64-apple-darwin13.4.0-clang -bundle -undefined dynamic_lookup -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/shanghongxie/opt/anaconda3/lib -L/Users/shanghongxie/opt/anaconda3/lib -flto -Wl,-export_dynamic -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/shanghongxie/opt/anaconda3/lib -L/Users/shanghongxie/opt/anaconda3/lib -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/shanghongxie/opt/anaconda3/lib -L/Users/shanghongxie/opt/anaconda3/lib -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/shanghongxie/opt/anaconda3/include -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -isystem /Users/shanghongxie/opt/anaconda3/include build/temp.macosx-10.9-x86_64-cpython-38/src/DynamicProgrammingQ2.o build/temp.macosx-10.9-x86_64-cpython-38/src/dp_grid.o build/temp.macosx-10.9-x86_64-cpython-38/src/dp_nbhd.o build/temp.macosx-10.9-x86_64-cpython-38/src/optimum_reparamN2.o -o build/lib.macosx-10.9-x86_64-cpython-38/optimum_reparamN2.cpython-38-darwin.so -L/Users/shanghongxie/opt/anaconda3/lib -lmkl_rt -Wl,-rpath,/Users/shanghongxie/opt/anaconda3/lib" failed with exit status 1
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for fdasrsf ailed to build fdasrsf ERROR: Could not build wheels for fdasrsf, which is required to install pyproject.toml-based projects Note: you may need to restart the kernel to use updated packages.

jdtuck commented 4 months ago

Your cython is too old and since you are using anaconda I recommend upgrading to the a new version of Python >3.9.

0todd0000 commented 4 months ago

(I see that this issue is closed but your suggested solution did not work for me so I propose re-opening this issue. I'd be happy to create a new issue if you prefer.)



I encounter the same wheel build error with Python 3.11 when using pip install fdasrsf (not in Spyder and not in Anaconda).

note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for fdasrsf
Failed to build fdasrsf
ERROR: Could not build wheels for fdasrsf, which is required to install pyproject.toml-based projects

The versions I am using are:

I have updated all other packages using pip-review so I believe that I have the most recent versions of all requirements.

I have also tried pip install mkl-devel as suggested here

I encounter the identical error when trying to install via pip in Python 3.10 and 3.9 environments.

I can install in Anaconda using conda install -c conda-forge fdasrsf without problems, but when I attempt to install in an isolated Python environment I encounter this wheels build error no matter what I try.

Please help!

0todd0000 commented 4 months ago

Hello again, sorry for multiple posts. I have finally found a solution so I am posting it here just in case anyone else encounters a similar issue. In my case (a) upgrading pip and (b) installing mkl-devel have solved my installation problems. The commands I used appear below.

Apologies to Dr. Tucker for clogging up this issue! I thank you very much for creating and distributing this wonderful package!!

on macos:

/usr/local/bin/python3.10 -m venv /Users/USERNAME/envs/fdasrsf

source /Users/USERNAME/envs/fdasrsf/bin/activate

python -m pip install --upgrade pip

pip install mkl-devel

pip install fdasrsf

and on Windows:

C:\Users\USERNAME\AppData\Local\Programs\Python\Python310\python -m venv C:\envs\fdasrsf

C:\envs\fdasrsf\Scripts\activate

python -m pip install --upgrade pip

pip install mkl-devel

pip install fdasrsf