lyst / lightfm

A Python implementation of LightFM, a hybrid recommendation algorithm.
Apache License 2.0
4.66k stars 679 forks source link

Python 3.10 (and above) Support #675

Open wutaomsft opened 1 year ago

wutaomsft commented 1 year ago

Hi,

Great work on lightfm! Curious if you have any plan/schedule to support Python 3.10 (and eventually 3.11). We are looking at supporting Python 3.10 at microsoft recommenders which depends on lightfm. It looks we will need lightfm to support it before we can move forward.
Thanks!

maciejkula commented 1 year ago

This should work with version 1.17. Please give it a go.

ehuijzer commented 1 year ago

I tried with Python 3.11. In case no loss is specified, it does complete successfully.

However, I'm getting a hard error when using loss "warp", "bpr", "warp-kos". No warning or error message. Just exit code -1073741819 (0xC0000005)

I could debug down to fit_warp / fit_bpr / fit_warp_kos where the error occurs.

ocardia commented 1 year ago

I tried with both Python 3.10 and 3.11, and it failed with

  AttributeError: 'dict' object has no attribute '__LIGHTFM_SETUP__'

when using poetry, which also says

Note: This error originates from the build backend, and is likely not a problem with poetry but with lightfm (1.17) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "lightfm (==1.17)"'.

The latter wheel command fails as

Collecting lightfm==1.17
  Using cached lightfm-1.17.tar.gz (316 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "<**Redacted**>/.pyenv/versions/3.10.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "<**Redacted**>/.pyenv/versions/3.10.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "<**Redacted**>/.pyenv/versions/3.10.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/private/var/folders/j9/r1tf7x3j7598t3xhss1v_wjw0000gp/T/pip-build-env-72ddgftg/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/private/var/folders/j9/r1tf7x3j7598t3xhss1v_wjw0000gp/T/pip-build-env-72ddgftg/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/j9/r1tf7x3j7598t3xhss1v_wjw0000gp/T/pip-build-env-72ddgftg/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/private/var/folders/j9/r1tf7x3j7598t3xhss1v_wjw0000gp/T/pip-build-env-72ddgftg/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 11, in <module>
      AttributeError: 'dict' object has no attribute '__LIGHTFM_SETUP__'
      [end of output]

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

I'll keep on investigating, but if someone has already made steps further, I'll gladly leap ahead. 😉

np-n commented 12 months ago

I am stuck on the same issue in Python 3.10, the kernel dies when I try to call .fit() method.

dym-ok commented 7 months ago

Hey @ocardia, did you have any luck with installing lightfm with Poetry? I'm having the same issue with Python 3.10.13 + Poetry 1.7.0 currently.

ocardia commented 7 months ago

To be honest, I tried again a couple of months ago with no success.

I may give it a try in a couple of weeks, but I'd need to check if there's work being done in this library at all, or directly consider moving away from it. 🤷🏻‍♂️ 😞

I'll keep you posted, regardless.

dym-ok commented 7 months ago

I had to abandon Poetry in this project as I can still install it with pip. But this is a worrying sign indeed 😟