pythonpandasdockercontainers

AttributeError: module 'numba' has no attribute 'generated_jit'


I am trying to run

from ydata_profiling import ProfileReport

profile = ProfileReport(merged_data)
profile.to_notebook_iframe()

in jupyter notebook. But I am getting an error:

AttributeError: module 'numba' has no attribute 'generated_jit'

I am running jupyter notebook in Docker container with requirements listed below:

numpy==1.24.3
pandas==1.4.1
scikit-learn==1.4.1.post1
pyyaml==6.0
dvc==3.48.4
mlflow==2.11.1
seaborn==0.11.2
matplotlib==3.5.1
boto3==1.18.60
jupyter==1.0.0
pandoc==2.3
ydata-profiling==4.7.0
numba==0.59.1

I am using WSL Ubuntu in Visual Studio Code. Tried to build Docker image several times now with different versions of libraries.

EDIT: Adding Traceback:

    AttributeError                            Traceback (most recent call last)
Cell In[3], line 1
----> 1 from ydata_profiling import ProfileReport
      3 profile = ProfileReport(merged_data)
      4 profile.to_notebook_iframe()

File /usr/local/lib/python3.11/site-packages/ydata_profiling/__init__.py:14
     10 warnings.simplefilter("ignore", category=NumbaDeprecationWarning)
     12 import importlib.util  # isort:skip # noqa
---> 14 from ydata_profiling.compare_reports import compare  # isort:skip # noqa
     15 from ydata_profiling.controller import pandas_decorator  # isort:skip # noqa
     16 from ydata_profiling.profile_report import ProfileReport  # isort:skip # noqa

File /usr/local/lib/python3.11/site-packages/ydata_profiling/compare_reports.py:12
     10 from ydata_profiling.model import BaseDescription
     11 from ydata_profiling.model.alerts import Alert
---> 12 from ydata_profiling.profile_report import ProfileReport
     15 def _should_wrap(v1: Any, v2: Any) -> bool:
     16     if isinstance(v1, (list, dict)):

File /usr/local/lib/python3.11/site-packages/ydata_profiling/profile_report.py:25
     23 from tqdm.auto import tqdm
     24 from typeguard import typechecked
---> 25 from visions import VisionsTypeset
     27 from ydata_profiling.config import Config, Settings, SparkSettings
     28 from ydata_profiling.expectations_report import ExpectationsReport

File /usr/local/lib/python3.11/site-packages/visions/__init__.py:4
      1 """Core functionality"""
      3 from visions import types, typesets, utils
----> 4 from visions.backends import *
      5 from visions.declarative import create_type
      6 from visions.functional import (
      7     cast_to_detected,
      8     cast_to_inferred,
      9     detect_type,
     10     infer_type,
     11 )

File /usr/local/lib/python3.11/site-packages/visions/backends/__init__.py:9
      6 try:
      7     import pandas as pd
----> 9     import visions.backends.pandas
     10     from visions.backends.pandas.test_utils import pandas_version
     12     if pandas_version[0] < 1:

File /usr/local/lib/python3.11/site-packages/visions/backends/pandas/__init__.py:2
      1 import visions.backends.pandas.traversal
----> 2 import visions.backends.pandas.types

File /usr/local/lib/python3.11/site-packages/visions/backends/pandas/types/__init__.py:3
      1 import visions.backends.pandas.types.boolean
      2 import visions.backends.pandas.types.categorical
----> 3 import visions.backends.pandas.types.complex
      4 import visions.backends.pandas.types.count
      5 import visions.backends.pandas.types.date

File /usr/local/lib/python3.11/site-packages/visions/backends/pandas/types/complex.py:7
      5 from visions.backends.pandas.series_utils import series_not_empty, series_not_sparse
      6 from visions.backends.pandas.types.float import string_is_float
----> 7 from visions.backends.shared.parallelization_engines import pandas_apply
      8 from visions.types.complex import Complex
      9 from visions.types.string import String

File /usr/local/lib/python3.11/site-packages/visions/backends/shared/__init__.py:1
----> 1 from . import nan_handling, parallelization_engines, utilities

File /usr/local/lib/python3.11/site-packages/visions/backends/shared/nan_handling.py:34
     30 # TODO: There are optimizations here, just have to define precisely the desired missing ruleset in the
     31 # generated jit
     32 if has_numba:
---> 34     @nb.generated_jit(nopython=True)
     35     def is_missing(x):
     36         """
     37         Return True if the value is missing, False otherwise.
     38         """
     39         if isinstance(x, nb.types.Float):

AttributeError: module 'numba' has no attribute 'generated_jit'

Solution

  • The top API level function numba.decorated_jit is deprecated and removed from numba version>=0.59.0.

    I suggest to install last version where numba.decorated_jit is and that is numba==0.58.1