lyst / lyst/lightfm

ModuleNotFoundError: No module named 'lightfm._lightfm_fast_no_openmp' Docker usage fails on macOS:

Open
#548 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.1k
Forks
724
PR merge metrics
No merged PRs in 30d

Description

I have exact same issue as #211 (and I can't reopen it)
But I use latest version of repo (and Dockerfile)

I just followed the [instructions](https://making.lyst.com/lightfm/docs/home.html?highlight=docker#using-with-docker):

```sh
git clone git@github.com:lyst/lightfm.git && cd lightfm
docker-compose build lightfm
docker-compose run lightfm py.test -x lightfm/tests/
```

then I got this error:
```
~/Desktop/lightfm
docker-compose run lightfm py.test -x lightfm/tests/
=========================================================== test session starts ============================================================
platform linux -- Python 3.7.7, pytest-5.4.3, py-1.9.0, pluggy-0.13.1
rootdir: /home/lightfm
collected 0 items / 1 error

================================================================== ERRORS ==================================================================
____________________________________________________ ERROR collecting tests/test_api.py ____________________________________________________
ImportError while importing test module '/home/lightfm/tests/test_api.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
lightfm/lightfm/__init__.py:2: in
__LIGHTFM_SETUP__
E NameError: name '__LIGHTFM_SETUP__' is not defined

During handling of the above exception, another exception occurred:
lightfm/lightfm/_lightfm_fast.py:3: in
from ._lightfm_fast_openmp import * # NOQA
E ModuleNotFoundError: No module named 'lightfm._lightfm_fast_openmp'

During handling of the above exception, another exception occurred:
lightfm/tests/test_api.py:7: in
from lightfm.lightfm import LightFM
lightfm/lightfm/__init__.py:4: in
from .lightfm import LightFM
lightfm/lightfm/lightfm.py:8: in
from ._lightfm_fast import (
lightfm/lightfm/_lightfm_fast.py:14: in
from ._lightfm_fast_no_openmp import * # NOQA
E ModuleNotFoundError: No module named 'lightfm._lightfm_fast_no_openmp'
============================================================= warnings summary =============================================================
lightfm/lightfm/_lightfm_fast.py:10
/home/lightfm/lightfm/_lightfm_fast.py:10: UserWarning: LightFM was compiled without OpenMP support. Only a single thread will be used.
"LightFM was compiled without OpenMP support. "

-- Docs: https://docs.pytest.org/en/latest/warnings.html
========================================================= short test summary info ==========================================================
ERROR lightfm/tests/test_api.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================= 1 warning, 1 error in 0.39s ========================================================
```

docker-compose build lightfm log

~/Desktop/lightfm

docker-compose build lightfm
Building lightfm
Step 1/10 : FROM ubuntu:16.04
---> c522ac0d6194
Step 2/10 : RUN apt-get update
---> Using cache
---> b64441cabfa6
Step 3/10 : RUN apt-get install -y libxml2 libxslt-dev wget bzip2 gcc
---> Using cache
---> 34e05995837b
Step 4/10 : RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh && wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && /bin/bash ~/miniconda.sh -b -p /opt/conda && rm ~/miniconda.sh
---> Using cache
---> ab459584d9f0
Step 5/10 : ENV PATH /opt/conda/bin:$PATH
---> Using cache
---> 2572771054cb
Step 6/10 : RUN conda install pytest jupyter scikit-learn
---> Using cache
---> 617daf37b1f1
Step 7/10 : ENV PYTHONDONTWRITEBYTECODE 1
---> Using cache
---> 884626f7f728
Step 8/10 : ADD . /home/lightfm/
---> 3ffc2c90de13
Step 9/10 : WORKDIR /home/
---> Running in 8158241109ab
Removing intermediate container 8158241109ab
---> 0f9fe63d6dd5
Step 10/10 : RUN cd lightfm && pip install -e .
---> Running in fd5cd5862536
Obtaining file:///home/lightfm
Requirement already satisfied: numpy in /opt/conda/lib/python3.7/site-packages (from lightfm==1.15) (1.18.5)
Requirement already satisfied: scipy>=0.17.0 in /opt/conda/lib/python3.7/site-packages (from lightfm==1.15) (1.5.0)
Requirement already satisfied: requests in /opt/conda/lib/python3.7/site-packages (from lightfm==1.15) (2.23.0)
Requirement already satisfied: scikit-learn in /opt/conda/lib/python3.7/site-packages (from lightfm==1.15) (0.23.1)
Requirement already satisfied: certifi>=2017.4.17 in /opt/conda/lib/python3.7/site-packages (from requests->lightfm==1.15) (2020.6.20)
Requirement already satisfied: chardet<4,>=3.0.2 in /opt/conda/lib/python3.7/site-packages (from requests->lightfm==1.15) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in /opt/conda/lib/python3.7/site-packages (from requests->lightfm==1.15) (2.9)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /opt/conda/lib/python3.7/site-packages (from requests->lightfm==1.15) (1.25.8)
Requirement already satisfied: joblib>=0.11 in /opt/conda/lib/python3.7/site-packages (from scikit-learn->lightfm==1.15) (0.16.0)
Requirement already satisfied: threadpoolctl>=2.0.0 in /opt/conda/lib/python3.7/site-packages (from scikit-learn->lightfm==1.15) (2.1.0)
Installing collected packages: lightfm
Running setup.py develop for lightfm
Successfully installed lightfm
Removing intermediate container fd5cd5862536
---> 3ed973884559
Successfully built 3ed973884559
Successfully tagged lightfm_lightfm:latest
~/Desktop/lightfm

macOS Catalina 10.15.5 (19F101)
Macbook Pro 16-inch (A2141)
Docker 2.3.0.3 (45519)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the documented docker-compose build and test commands, then inspect the Dockerfile installation step and lightfm/_lightfm_fast.py, which reports both missing native modules. Use lightfm/tests/ and the failing tests/test_api.py collection as the validation target; done means the container builds and the test suite no longer fails during module import.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, python
Domain
build-system, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.