Problem with np.bool dependency in "dataiku" package in python

collig Registered Posts: 3


I'm having a problem importing the "dataiku" package in python in the following environments since update to 11.2

python 3.6

python 3.7

python 3.9

# Example: load a DSS dataset as a Pandas dataframe
mydataset = dataiku.Dataset("PWHRn6UM")

import dataiku
/data1/dss/dataiku-dss-11.2.0/python/dataiku/core/ FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.  (This may have returned Python scalars in past versions.
  'boolean': np.bool

Appears at first to be a soft warning but any attempt to use the dataiku package fails

NameError                                 Traceback (most recent call last)
<ipython-input-3-4bdc522e44af> in <cell line: 2>()
      1 # Example: load a DSS dataset as a Pandas dataframe
----> 2 mydataset = dataiku.Dataset("PWHRn6UM")

NameError: name 'dataiku' is not defined

AttributeError                            Traceback (most recent call last)
<ipython-input-4-3acb3cd0f9dd> in <cell line: 1>()
----> 1 import dataiku

/data1/dss/dataiku-dss-11.2.0/python/dataiku/ in <module>
     11 from .base import remoterun
     12 from .core.base import is_container_exec
---> 13 from .core.dataset import Dataset, _dataset_writer_atexit_handler
     14 from .core.schema_handling import get_schema_from_df

/data1/dss/dataiku-dss-11.2.0/python/dataiku/core/ in <module>
     34 # Module code
---> 35 from dataiku.core import flow, base, schema_handling, dkuio
     36 from dataiku.core.platform_exec import read_dku_json
     37 from dataiku.core.dkujson import dump_to_filepath, load_from_filepath

/data1/dss/dataiku-dss-11.2.0/python/dataiku/core/ in <module>
     15     'float': np.float32,
     16     'double': np.float64,
---> 17     'boolean': np.bool
     18 }

/data1/dss/dss_data/code-envs/python/GC_dbs_39/lib64/python3.9/site-packages/numpy/ in __getattr__(attr)
    282             return Tester
--> 284         raise AttributeError("module {!r} has no attribute "    285                              "{!r}".format(__name__, attr))

AttributeError: module 'numpy' has no attribute 'bool'


Operating system used: Windows

Operating system used: Windows

Best Answer

  • Miguel Angel
    Miguel Angel Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 118 Dataiker
    Answer ✓


    The error is not related to the newer DSS version. This behaviour comes from the numpy package version it uses.

    While the deprecation warning is harmless, the attribute error comes from 'numpy.bool' not being available since numpy 1.24.0 (released on 19th of December):

    ​We are in process of fixing this globally for DSS. In the meantime, we can do a quick workaround on your code env:
    1) Go to Administration > Code Envs > Select your code env
    2) Add the following in 'Packages to install': numpy < 1.24'
    3) Click 'UPDATE'


Setup Info
      Help me…