jdtuck / fdasrsf_python

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

Unable to install on Mac #40

Closed SoptikHa2 closed 8 months ago

SoptikHa2 commented 8 months ago

Hi,

I tried to install your library on Mac, both arm and x86 via rosetta, however, it failed during installation. (I have installed openblas, but it didn't change anything).

From the error, it looks like findblas cannot find numpy nor scipy, however, both are installed in the venv when I do pip freeze (see below the error message).

When I run find blas myself in python interpreter in the same venv where I try to install fdasrsf, it works, this one provides me with the blas path:

import findblas
findblas.find_blas()

Error during installation:

  <string>:53: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  not modified: 'build/_DP.c'
  generating build/_DP.c
  (already up-to-date)
  running bdist_wheel
  running build
  running build_py
  creating build/lib.macosx-13.2-x86_64-cpython-310
  creating build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/plot_style.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/curve_stats.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/curve_functions.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/interparc.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/geodesic.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/utility_functions.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/regression.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/elastic_glm_regression.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/tolerance.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/elastic_changepoint.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/gp.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/pcr_regression.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/image_functions.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/__init__.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/kmeans.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/fPCA.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/bayesian_functions.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/umap_metric.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/time_warping.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/geometry.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/curve_regression.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/rbfgs.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/fPLS.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/boxplots.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/image.py -> build/lib.macosx-13.2-x86_64-cpython-310/fdasrsf
  copying fdasrsf/curve_pcr_regression.py -> build/lib.macosx-13.2-x86_64-cpython-310/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
  Traceback (most recent call last):
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/findblas/__init__.py", line 1006, in find_blas
      files_np = [f for f in os.listdir(path_np) if bool(re.search("blas", f))]
  FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/numpy/.libs'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/findblas/__init__.py", line 1022, in find_blas
      import scipy.linalg
  ModuleNotFoundError: No module named 'scipy'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/Users/xxx/.pyenv-i386/versions/3.10.10/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/Users/xxx/.pyenv-i386/versions/3.10.10/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/Users/xxx/.pyenv-i386/versions/3.10.10/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 410, in build_wheel
      return self._build_with_temp_dir(
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 395, in _build_with_temp_dir
      self.run_setup()
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 126, in <module>
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
      return run_commands(dist)
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
      dist.run_commands()
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/setuptools/dist.py", line 963, in run_command
      super().run_command(command)
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 368, in run
      self.run_command("build")
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/setuptools/dist.py", line 963, in run_command
      super().run_command(command)
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 131, in run
      self.run_command(cmd_name)
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/setuptools/dist.py", line 963, in run_command
      super().run_command(command)
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
      self.build_extensions()
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/findblas/distutils.py", line 23, in build_extensions
      blas_path, blas_file, incl_path, incl_file, flags = findblas.find_blas()
    File "/var/folders/jp/2gbqkrrx4dvc4b46srr4qysr0000gn/T/tmpreazy9hx/.venv/lib/python3.10/site-packages/findblas/__init__.py", line 1040, in find_blas
      raise ValueError(err_msg)
  ValueError: Could not locate MKL, OpenBLAS, BLIS, ATLAS or GSL libraries - you'll need to manually modify setup.py to add BLAS path.

Pip freeze:

cffi==1.16.0
contourpy==1.2.0
cycler==0.12.1
Cython==3.0.8
findblas==0.1.23
fonttools==4.49.0
joblib==1.3.2
kiwisolver==1.4.5
llvmlite==0.42.0
matplotlib==3.8.3
numba==0.59.0
numpy==1.26.4
packaging==23.2
patsy==0.5.6
pillow==10.2.0
pycparser==2.21
pyparsing==3.1.1
python-dateutil==2.8.2
scipy==1.12.0
six==1.16.0
tqdm==4.66.2

Any idea what to do with this?

SoptikHa2 commented 8 months ago

We get different error when we add

install_requires = [ "scipy", "numpy", "findblas" ],

to setup in setup.py, however, the linker fails afterwards regardless, so not sure whether the fix is sound.

jdtuck commented 8 months ago

That fix is not sound and what what distribution of python (e.g., conda, mac default, homebrew)?

jdtuck commented 8 months ago

One fix if not using conda is to pip install mkl-devel before installing the pacakge

jdtuck commented 8 months ago

Also one more question, please let me know what pip install . gives instead of using setup.py

jdtuck commented 8 months ago

also after further this seems to be a bug with findblas and I will file a report there. One suggestion is to use conda in the menatime.

SoptikHa2 commented 8 months ago

I was using homebrew and the same error happened even when using pip install .

Anyway thanks for your help! We worked around this.