giganano / VICE

A python package designed to run numerical simulations of galactic chemical evolution
MIT License
23 stars 5 forks source link

trouble installing on python 3.11 #33

Closed ajwheeler closed 11 months ago

ajwheeler commented 1 year ago

pip3 install vice is failing for me. I think it's a python 3.11 thing?

Collecting vice
  Using cached vice-1.3.0.tar.gz (1.9 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      /Users/wheeler.883/brew/lib/python3.11/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
        dist.fetch_build_eggs(dist.setup_requires)
      error in vice setup command: 'python_requires' must be a string containing valid version specifiers; Invalid specifier: '>=3.6.*'
      [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.
giganano commented 1 year ago

Hi Adam

Thanks for opening this issue -- I've ran into this problem as well, though so far I've only attempted a python 3.11 installation on M2 macs. Are you running an M2 system? I'll also check this on M1 and x86_64 Macs, which should tell us if it's an M2 thing or a python 3.11 thing. In either case, it probably just wants ">=3.6" as opposed to ">=3.6.*" in the python_requires field, but it'd be wise to figure out where the issue is coming from before fixing it.

Cheers James

ajwheeler commented 1 year ago

I am running an M2, thanks!

On Mon, Sep 18, 2023 at 6:47 PM James W. Johnson @.***> wrote:

Hi Adam

Thanks for opening this issue -- I've ran into this problem as well, though so far I've only attempted a python 3.11 installation on M2 macs. Are you running an M2 system? I'll also check this on M1 and x86_64 Macs, which should tell us if it's an M2 thing or a python 3.11 thing. In either case, it probably just wants ">=3.6" as opposed to ">=3.6.*" in the python_requires field, but it'd be wise to figure out where the issue is coming from before fixing it.

Cheers James

— Reply to this email directly, view it on GitHub https://github.com/giganano/VICE/issues/33#issuecomment-1724564992, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFN2G4YF6FTT7Z2SY7MMETX3DFOLANCNFSM6AAAAAA45JVOME . You are receiving this because you authored the thread.Message ID: @.***>

giganano commented 1 year ago

Okay, so it turns out this is a python 3.11 thing -- there's more to it than just this version string specifier though. The current workaround is simple:

  1. Clone the repository, and modify line 330 of the setup.py file to python_requires = ">=3.6, <4" -- essentially just removing the .*. Swap branches before making this change if you want to install a development version.
  2. Ensure that you're running Cython <= 0.29.36. They released version 3.0.0 back in July, but this version throws compiler errors on vice/core/_cutils.pyx regarding exception handling with calling python function from C in the backend.
  3. Install from source as usual: python setup.py build -j N install [--user] -- swap out N for the number of cores you want to install on, and add --user if you don't have admin privileges.

That should just about do it, but please let me know if you run into issues with that. More long term, we'll need to update VICE's installation process since calling a setup.py file directly is now deprecated. I'll also need to patch vice/core/_cutils.pyx to play nicely in the sandbox with the more recent versions of Cython.

giganano commented 11 months ago

Coming back to this to note that the fix is coming imminently in the form of a patch with version number 1.3.1. There will be more with that patch, handling some issues that came up with compiling with Cython>=3.0 and the inheritance structure of VICE's dataframe that arose in python 3.11 and 3.12. There's also some updates to how non-zero metallicity infall is handled to improve the numerical stability of the calculation near edge cases.

The previous installation process of pip install vice should run as normal once again.