dfm / george

Fast and flexible Gaussian Process regression in Python
http://george.readthedocs.io
MIT License
446 stars 128 forks source link

Installation fails in macOS Monterrey (M1) after upgrading python to 3.11 #160

Closed jlillo closed 10 months ago

jlillo commented 10 months ago

I upgraded my python from 3.7 to 3.11 and tried re-installing george. I tried updatting pip and setuptools but this has not solved the installation issue, which fails with many errors and ending in:

` ^ src/george/solvers/_hodlr.cpp:180:10: note: in instantiation of function template specialization 'Solver::apply_inverse<Eigen::Matrix<double, -1, 1, 0>>' requested here self.apply_inverse(alpha); ^ vendor/eigen/Eigen/src/Cholesky/LDLT.h:598:8: note: use function 'std::abs' instead if(abs(vecD(i)) > tolerance) ^~~ std::abs vendor/eigen/Eigen/src/Cholesky/LDLT.h:598:8: note: include the header or explicitly provide a declaration for 'std::abs' 216 warnings and 11 errors generated. error: command '/usr/bin/clang' 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 george Failed to build george ERROR: Could not build wheels for george, which is required to install pyproject.toml-based projects`

Any idea or help would be very much appreciated?

Thanks a lot.

dfm commented 10 months ago

I can't reproduce your error over here (also on an M1 mac) in a fresh conda environment. It looks like some compiler flags might not be getting set properly. I've opened a PR (https://github.com/dfm/george/pull/161) with some updates to the build infrastructure - can you see if that branch works for you? Alternatively, after I merge that, I can release a new version so that 3.11 binary wheels will be available on PyPI.

jlillo commented 10 months ago

Thanks a lot for checking. I cloned the main repo into my mac and tried to install it through sudo python -m pip install -e .

However I get the following error messages:

  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Installing backend dependencies ... done
  Preparing editable metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [25 lines of output]
      Traceback (most recent call last):
        File "/Users/lillo_box/anaconda3/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/lillo_box/anaconda3/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/lillo_box/anaconda3/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 181, in prepare_metadata_for_build_editable
          return hook(metadata_directory, config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/tmp/pip-build-env-t42yv91h/overlay/lib/python3.11/site-packages/scikit_build_core/build/__init__.py", line 85, in prepare_metadata_for_build_editable
          return _build_wheel_impl(
                 ^^^^^^^^^^^^^^^^^^
        File "/private/tmp/pip-build-env-t42yv91h/overlay/lib/python3.11/site-packages/scikit_build_core/build/wheel.py", line 132, in _build_wheel_impl
          metadata = get_standard_metadata(pyproject, settings)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/tmp/pip-build-env-t42yv91h/overlay/lib/python3.11/site-packages/scikit_build_core/settings/metadata.py", line 36, in get_standard_metadata
          new_pyproject_dict["project"][field] = provider.dynamic_metadata(field, config)
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/tmp/pip-build-env-t42yv91h/overlay/lib/python3.11/site-packages/scikit_build_core/metadata/setuptools_scm.py", line 46, in dynamic_metadata
          raise ValueError(msg)
      **ValueError: setuptools-scm was unable to detect version for /Users/lillo_box/Downloads/george-main.**

      Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout without the .git folder) don't contain the necessary metadata and will not work.

      For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
dfm commented 10 months ago

Are you sure that you cloned the repo? It looks like you might have downloaded the tarball instead? That won't work because of how we generate version numbers based on the git history. You need to make sure you use:

git clone --recursive https://github.com/dfm/george.git

(don't forget the --recursive!)

But, I'll also have the binary wheels pushed to PyPI by later today.

jlillo commented 10 months ago

You are right. It now works! Thanks a lot. By the way, I have similar problems when trying the installation of celerite and celerite2, just in case you can do a similar fix. I can open an issue in the corresponding repos if needed. Thanks!

dfm commented 10 months ago

Great! Please do open issues on the relevant repos.

dfm commented 10 months ago

A little late, but the latest version is now available on PyPI with Py3.11 and 3.12 binaries!