lyst / lightfm

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

Can't seem to install with with poetry #711

Open RILUCK opened 1 month ago

RILUCK commented 1 month ago

Installing lightfm on python 3.8.11

× Getting requirements to build wheel did not run successfully.

    │ exit code: 1

    ╰─> [17 lines of output]

        Traceback (most recent call last):

          File "/opt/pysetup/.venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>

            main()

          File "/opt/pysetup/.venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main

            json_out['return_val'] = hook(**hook_input['kwargs'])

          File "/opt/pysetup/.venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel

            return hook(config_settings)

          File "/tmp/pip-build-env-adt3095f/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel

            return self._get_build_requires(config_settings, requirements=['wheel'])

          File "/tmp/pip-build-env-adt3095f/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires

            self.run_setup()

          File "/tmp/pip-build-env-adt3095f/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 487, in run_setup

            super().run_setup(setup_script=setup_script)

          File "/tmp/pip-build-env-adt3095f/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 311, 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.

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

  at /opt/poetry/venv/lib/python3.8/site-packages/poetry/utils/env.py:1540 in _run

      1536│                 output = subprocess.check_output(

      1537│                     command, stderr=subprocess.STDOUT, env=env, **kwargs

      1538│                 )

      1539│         except CalledProcessError as e:

    → 1540│             raise EnvCommandError(e, input=input_)

      1541│ 

      1542│         return decode(output)

      1543│ 

      1544│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:

  PoetryException

  Failed to install /root/.cache/pypoetry/artifacts/55/4b/97/76f28bb1a5cc3e8cde69ba3bd8013eb7b16ea32c94c8f82238862c972d/lightfm-1.17.tar.gz

  at /opt/poetry/venv/lib/python3.8/site-packages/poetry/utils/pip.py:58 in pip_install

       54│ 

       55│     try:

       56│         return environment.run_pip(*args)

       57│     except EnvCommandError as e:

    →  58│         raise PoetryException(f"Failed to install {path.as_posix()}") from e

       59│ 

The command '/bin/sh -c set -ex     && poetry install --without dev' returned a non-zero code: 1

script returned exit code 1

I see couple of threads around it but none of them works. like

python -m pip install --upgrade pip setuptools wheel python -m pip install --no-use-pep517 lightfm pip install -r requirements.txt

hugolytics commented 1 month ago

we're facing the same issue!

RILUCK commented 1 month ago

I was able to resolve this error using

ENV POETRY_VERSION=1.3.2
#RUN curl -sSL https://install.python-poetry.org | python3 -
RUN pip install --upgrade pip &&\
    pip install poetry==$POETRY_VERSION

WORKDIR $PYSETUP_PATH
COPY ./poetry.lock ./pyproject.toml ./
COPY .netrc /root/.netrc
RUN set -ex \
    && poetry install --without dev \
    && python -m pip install --upgrade pip setuptools wheel \
    && python -m pip install --no-use-pep517 lightfm

But now getting new error which is related to this https://github.com/lyst/lightfm/issues/548

which boils down to this solution but it's not working

https://github.com/lyst/lightfm/pull/212/files