Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pandera import fails due to DatetimeAccessor issue in Python 3.11.9 #1554

Open
3 tasks done
CharlesDc9 opened this issue Apr 3, 2024 · 1 comment
Open
3 tasks done
Labels
bug Something isn't working

Comments

@CharlesDc9
Copy link

Describe the bug
A clear and concise description of what the bug is.

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of pandera.
  • (optional) I have confirmed this bug exists on the master branch of pandera.

Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

import pandera

Expected behavior

The command import pandera will fail in Python 3.11.9 due to an import error with dask.
dask/dask#11035
This dask error is itself caused by a change in python 3.11.9 on the DatetimeAccessor object.

Desktop (please complete the following information):

  • OS: MacOS (M1 chip)
  • Version pandera 0.15.2

Screenshots

{
	"name": "TypeError",
	"message": "descriptor '__call__' for 'type' objects doesn't apply to a 'property' object",
	"stack": "---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[3], line 1
----> 1 import pandera

File ~/Library/Caches/pypoetry/virtualenvs/harvest-flow-JgQBxkdu-py3.11/lib/python3.11/site-packages/pandera/__init__.py:4
      1 \"\"\"A flexible and expressive pandas validation library.\"\"\"
      2 import platform
----> 4 from pandera import errors, external_config, typing
      5 from pandera.accessors import pandas_accessor
      6 from pandera.api import extensions

…


File ~/Library/Caches/pypoetry/virtualenvs/harvest-flow-JgQBxkdu-py3.11/lib/python3.11/site-packages/dask/dataframe/accessor.py:126
    113         token = f\"{self._accessor_name}-{attr}\"
    114         return self._series.map_partitions(
    115             self._delegate_method,
    116             self._accessor_name,
   (...)
    122             token=token,
    123         )
--> 126 class DatetimeAccessor(Accessor):
    127     \"\"\"Accessor object for datetimelike properties of the Series values.
    128 
    129     Examples
   (...)
    132     >>> s.dt.microsecond  # doctest: +SKIP
    133     \"\"\"
    135     _accessor_name = \"dt\"

…


File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/inspect.py:2432, in _descriptor_get(descriptor, obj)
   2430 if get is _sentinel:
   2431     return descriptor
-> 2432 return get(descriptor, obj, type(obj))

TypeError: descriptor '__call__' for 'type' objects doesn't apply to a 'property' object"
}

Additional context

As you can see on this stack trace, pandera tries to import dask. It seems that the issue is being fixed on dask side. Maybe there should be a version bump on pandera side when the fix is implemented in dask.

@CharlesDc9 CharlesDc9 added the bug Something isn't working label Apr 3, 2024
@cosmicBboy
Copy link
Collaborator

Since dask/dask#11035 has been merged is this still an issue @CharlesDc9 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants