Skip to content

pandas does not import with cpython master #32766

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

Closed
tacaswell opened this issue Mar 17, 2020 · 5 comments · Fixed by #36080
Closed

pandas does not import with cpython master #32766

tacaswell opened this issue Mar 17, 2020 · 5 comments · Fixed by #36080
Labels
Bug Compat pandas objects compatability with Numpy or Python functions

Comments

@tacaswell
Copy link
Contributor

Code Sample, a copy-pastable example if possible

# Your code here
import pandas

Problem description

jupiter@21:38  ➤  ipython                                                                                                                                                                                                                                                       
Python 3.9.0a4+ (heads/master:87ec86c425, Mar 16 2020, 11:05:13) 
Type 'copyright', 'credits' or 'license' for more information
IPython 8.0.0.dev -- An enhanced Interactive Python. Type '?' for help.

In [1]: import pandas                                                                                                                                                                                                                                                           
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-38d4b0363d82> in <module>
----> 1 import pandas

~/.virtualenvs/bleeding/lib/python3.9/site-packages/pandas/__init__.py in <module>
    120 from pandas.tseries.api import infer_freq
    121 from pandas.tseries import offsets
--> 123 from pandas.core.computation.api import eval
    125 from pandas.core.reshape.api import (
    126     concat,
    127     lreshape,
   (...)
    138     qcut,
    139 )
    141 import pandas.api

~/.virtualenvs/bleeding/lib/python3.9/site-packages/pandas/core/computation/api.py in <module>
      1 # flake8: noqa
----> 3 from pandas.core.computation.eval import eval

~/.virtualenvs/bleeding/lib/python3.9/site-packages/pandas/core/computation/eval.py in <module>
     11 from pandas.util._validators import validate_bool_kwarg
     13 from pandas.core.computation.engines import _engines
---> 14 from pandas.core.computation.expr import Expr, _parsers
     15 from pandas.core.computation.parsing import tokenize_string
     16 from pandas.core.computation.scope import ensure_scope

~/.virtualenvs/bleeding/lib/python3.9/site-packages/pandas/core/computation/expr.py in <module>
    188 _expr_nodes = _filter_nodes(ast.expr)
    189 _expr_context_nodes = _filter_nodes(ast.expr_context)
--> 190 _slice_nodes = _filter_nodes(ast.slice)
    191 _boolop_nodes = _filter_nodes(ast.boolop)
    192 _operator_nodes = _filter_nodes(ast.operator)

AttributeError: module 'ast' has no attribute 'slice'

In [2]:   
jupiter@21:41  ➤  git describe                                                                                      
v1.1.0.dev0-846-g7aa3dd274     

It looks like this is due to python/cpython#9605 / https://bugs.python.org/issue34822 and needs to be sorted for py39

@WillAyd
Copy link
Member

WillAyd commented Mar 18, 2020

Cool thanks for taking a look! Would welcome any PRs from you or the community

@WillAyd WillAyd added the Compat pandas objects compatability with Numpy or Python functions label Mar 18, 2020
@WillAyd WillAyd added this to the Contributions Welcome milestone Mar 18, 2020
@tacaswell
Copy link
Contributor Author

py39 is scheduled for October, shouldn't this be a higher priority? If Matplotlib were broken on cpython master I would definitely prioritize getting it fixed and backport it as far as I could ...

@tacaswell
Copy link
Contributor Author

"fixed" by python/cpython#19056 / https://bugs.python.org/issue39999 but at least ast.slice is deprecated and should probably be removed from the pandas parser.

@mroeschke mroeschke added the Bug label Apr 10, 2020
@tacaswell
Copy link
Contributor Author

@TomAugspurger This should get the py39 label as well.

@TomAugspurger
Copy link
Contributor

Thanks. The necessary work here is to update pandas to not use ast.slice?

fangchenli added a commit to fangchenli/pandas that referenced this issue Sep 2, 2020
fangchenli added a commit to fangchenli/pandas that referenced this issue Sep 3, 2020
kesmit13 pushed a commit to kesmit13/pandas that referenced this issue Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Compat pandas objects compatability with Numpy or Python functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants