AnotherSamWilson / miceforest

Multiple Imputation with LightGBM in Python
MIT License
353 stars 31 forks source link

Import miceforest error #89

Closed kestlermai closed 2 months ago

kestlermai commented 2 months ago

How can I resolve the following error when importing the miceforest library after successfully installing it through pip?

import miceforest as mf TypeError: descriptor 'call' for 'type' objects doesn't apply to a 'property' object

AnotherSamWilson commented 2 months ago

Is there any more you can tell me about this error? Are any more lines printed out?

kestlermai commented 2 months ago

Of course!

import miceforest as mf
Traceback (most recent call last):

  Cell In[17], line 1
    import miceforest as mf

  File D:\Anaconda\Lib\site-packages\miceforest\__init__.py:13
    from .imputation_kernel import ImputationKernel

  File D:\Anaconda\Lib\site-packages\miceforest\imputation_kernel.py:7
    from lightgbm import Booster, Dataset, cv, early_stopping, log_evaluation, train

  File ~\AppData\Roaming\Python\Python311\site-packages\lightgbm\__init__.py:9
    from .basic import Booster, Dataset, Sequence, register_logger

  File ~\AppData\Roaming\Python\Python311\site-packages\lightgbm\basic.py:22
    from .compat import (

  File ~\AppData\Roaming\Python\Python311\site-packages\lightgbm\compat.py:152
    from dask.dataframe import DataFrame as dask_DataFrame

  File D:\Anaconda\Lib\site-packages\dask\dataframe\__init__.py:6
    from dask.dataframe import backends, dispatch, rolling

  File D:\Anaconda\Lib\site-packages\dask\dataframe\backends.py:15
    from dask.dataframe.core import DataFrame, Index, Scalar, Series, _Frame

  File D:\Anaconda\Lib\site-packages\dask\dataframe\core.py:36
    from dask.dataframe import methods

  File D:\Anaconda\Lib\site-packages\dask\dataframe\methods.py:34
    from dask.dataframe.utils import is_dataframe_like, is_index_like, is_series_like

  File D:\Anaconda\Lib\site-packages\dask\dataframe\utils.py:20
    from dask.dataframe import (  # noqa: F401 register pandas extension types

  File D:\Anaconda\Lib\site-packages\dask\dataframe\_dtypes.py:9
    from dask.dataframe.extensions import make_array_nonempty, make_scalar

  File D:\Anaconda\Lib\site-packages\dask\dataframe\extensions.py:8
    from dask.dataframe.accessor import (

  File D:\Anaconda\Lib\site-packages\dask\dataframe\accessor.py:126
    class DatetimeAccessor(Accessor):

  File D:\Anaconda\Lib\site-packages\dask\dataframe\accessor.py:81 in __init_subclass__
    _bind_property(cls, pd_cls, attr, min_version)

  File D:\Anaconda\Lib\site-packages\dask\dataframe\accessor.py:35 in _bind_property
    setattr(cls, attr, property(derived_from(pd_cls, version=min_version)(func)))

  File D:\Anaconda\Lib\site-packages\dask\utils.py:856 in wrapper
    method.__doc__ = _derived_from(

  File D:\Anaconda\Lib\site-packages\dask\utils.py:809 in _derived_from
    method_args = get_named_args(method)

  File D:\Anaconda\Lib\site-packages\dask\utils.py:570 in get_named_args
    s = inspect.signature(func)

  File D:\Anaconda\Lib\inspect.py:3263 in signature
    return Signature.from_callable(obj, follow_wrapped=follow_wrapped,

  File D:\Anaconda\Lib\inspect.py:3011 in from_callable
    return _signature_from_callable(obj, sigcls=cls,

  File D:\Anaconda\Lib\inspect.py:2599 in _signature_from_callable
    call = _descriptor_get(call, obj)

  File D:\Anaconda\Lib\inspect.py:2432 in _descriptor_get
    return get(descriptor, obj, type(obj))

TypeError: descriptor '__call__' for 'type' objects doesn't apply to a 'property' object
AnotherSamWilson commented 2 months ago

Hmmm this looks like an issue with importing dask. If you run this line, do you get the same error:

from dask.dataframe import DataFrame as dask_DataFrame

kestlermai commented 2 months ago

Yes, the same error occurred.

AnotherSamWilson commented 2 months ago

Hmm it might be worth opening an issue with dask. But, nothing I can do here.

kestlermai commented 2 months ago

Oh, thank you very much for your reply. If it's resolved, I will provide a solution below