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

circular import when doing "import pandas" on pandas‑0.24.2‑cp38‑cp38m‑win_amd64.whl #26318

Closed
stonebig opened this issue May 8, 2019 · 8 comments
Labels
Build Library building on various platforms Windows Windows OS

Comments

@stonebig
Copy link
Contributor

stonebig commented May 8, 2019

Maybe it's the Python-3.8.0.a4 windows dll change ?

just a remark, as it's all alpha. using cgohlke first wheel on Python-3.8.0a4, I have a strange message

Python 3.8.0a4 (v3.8.0a4:c1004b8546, May  7 2019, 12:46:11) [MSC v.1916 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import pandas
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pandas
  File "C:\WinP\bd38\bu\WPy32-3800a4\python-3.8.0a4\lib\site-packages\pandas\__init__.py", line 49, in <module>
    from pandas.io.api import *
  File "C:\WinP\bd38\bu\WPy32-3800a4\python-3.8.0a4\lib\site-packages\pandas\io\api.py", line 8, in <module>
    from pandas.io.excel import ExcelFile, ExcelWriter, read_excel
  File "C:\WinP\bd38\bu\WPy32-3800a4\python-3.8.0a4\lib\site-packages\pandas\io\excel.py", line 34, in <module>
    from pandas.io.parsers import TextParser
  File "C:\WinP\bd38\bu\WPy32-3800a4\python-3.8.0a4\lib\site-packages\pandas\io\parsers.py", line 19, in <module>
    import pandas._libs.parsers as parsers
  File "pandas\_libs\parsers.pyx", line 1418, in init pandas._libs.parsers
AttributeError: partially initialized module 'pandas' has no attribute '_NA_VALUES' (most likely due to a circular import)
>>> 
@jreback
Copy link
Contributor

jreback commented May 8, 2019

we have no support / testing for 3.8 at all

@cgohlke
Copy link
Contributor

cgohlke commented May 8, 2019

This is more likely due to Cython-3.0a0 (git master from yesterday)

@gfyoung gfyoung added Windows Windows OS Build Library building on various platforms labels May 8, 2019
@gfyoung
Copy link
Member

gfyoung commented May 8, 2019

Feel free to continue the conversation, but due to the comment above, closing this.

@gfyoung gfyoung closed this as completed May 8, 2019
@gfyoung gfyoung added this to the No action milestone May 8, 2019
@stonebig
Copy link
Contributor Author

stonebig commented May 9, 2019

problem solved with the new pandas wheel.

@gfyoung
Copy link
Member

gfyoung commented May 9, 2019

@stonebig : That's great to hear!

@stonebig
Copy link
Contributor Author

stonebig commented May 10, 2019

Other remark, still on this alpha stage., pandas‑0.24.2‑cp38‑cp38m‑win_amd64.whl of cgohlke now fails on this:

#Pandas 
import pandas as pd
import numpy as np

idx = pd.date_range('2000', '2005', freq='d', closed='left')
datas = pd.DataFrame({'Color':  [ 'green' if x> 1 else 'red' for x in np.random.randn(len(idx))], 
         'Measure': np.random.randn(len(idx)), 'Year': idx.year},
          index=idx.date)
datas.query('Measure > 0').groupby(['Color','Year']).size().unstack()

gives

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-25-99840eba54d9> in <module>
----> 1 datas.query('Measure > 0').groupby(['Color','Year']).size().unstack()

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\pandas\core\frame.py in query(self, expr, inplace, **kwargs)
   3086         kwargs['level'] = kwargs.pop('level', 0)   1
   3087         kwargs['target'] = None
-> 3088         res = self.eval(expr, **kwargs)
   3089 
   3090         try:

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\pandas\core\frame.py in eval(self, expr, inplace, **kwargs)
   3201             kwargs['target'] = self
   3202         kwargs['resolvers'] = kwargs.get('resolvers', ())   tuple(resolvers)
-> 3203         return _eval(expr, inplace=inplace, **kwargs)
   3204 
   3205     def select_dtypes(self, include=None, exclude=None):

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\pandas\core\computation\eval.py in eval(expr, parser, engine, truediv, local_dict, global_dict, resolvers, level, target, inplace)
    291                             target=target)
    292 
--> 293         parsed_expr = Expr(expr, engine=engine, parser=parser, env=env,
    294                            truediv=truediv)
    295 

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\pandas\core\computation\expr.py in __init__(self, expr, engine, parser, env, truediv, level)
    747         self.env.scope['truediv'] = truediv
    748         self._visitor = _parsers[parser](self.env, self.engine, self.parser)
--> 749         self.terms = self.parse()
    750 
    751     @property

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\pandas\core\computation\expr.py in parse(self)
    764     def parse(self):
    765         """Parse an expression"""
--> 766         return self._visitor.visit(self.expr)
    767 
    768     @property

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\pandas\core\computation\expr.py in visit(self, node, **kwargs)
    329         method = 'visit_'   node.__class__.__name__
    330         visitor = getattr(self, method)
--> 331         return visitor(node, **kwargs)
    332 
    333     def visit_Module(self, node, **kwargs):

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\pandas\core\computation\expr.py in visit_Module(self, node, **kwargs)
    335             raise SyntaxError('only a single expression is allowed')
    336         expr = node.body[0]
--> 337         return self.visit(expr, **kwargs)
    338 
    339     def visit_Expr(self, node, **kwargs):

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\pandas\core\computation\expr.py in visit(self, node, **kwargs)
    329         method = 'visit_'   node.__class__.__name__
    330         visitor = getattr(self, method)
--> 331         return visitor(node, **kwargs)
    332 
    333     def visit_Module(self, node, **kwargs):

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\pandas\core\computation\expr.py in visit_Expr(self, node, **kwargs)
    338 
    339     def visit_Expr(self, node, **kwargs):
--> 340         return self.visit(node.value, **kwargs)
    341 
    342     def _rewrite_membership_op(self, node, left, right):

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\pandas\core\computation\expr.py in visit(self, node, **kwargs)
    329         method = 'visit_'   node.__class__.__name__
    330         visitor = getattr(self, method)
--> 331         return visitor(node, **kwargs)
    332 
    333     def visit_Module(self, node, **kwargs):

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\pandas\core\computation\expr.py in visit_Compare(self, node, **kwargs)
    664             op = self.translate_In(ops[0])
    665             binop = ast.BinOp(op=op, left=node.left, right=comps[0])
--> 666             return self.visit(binop)
    667 
    668         # recursive case: we have a chained comparison, a CMP b CMP c, etc.

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\pandas\core\computation\expr.py in visit(self, node, **kwargs)
    329         method = 'visit_'   node.__class__.__name__
    330         visitor = getattr(self, method)
--> 331         return visitor(node, **kwargs)
    332 
    333     def visit_Module(self, node, **kwargs):

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\pandas\core\computation\expr.py in visit_BinOp(self, node, **kwargs)
    433 
    434     def visit_BinOp(self, node, **kwargs):
--> 435         op, op_class, left, right = self._maybe_transform_eq_ne(node)
    436         left, right = self._maybe_downcast_constants(left, right)
    437         return self._maybe_evaluate_binop(op, op_class, left, right)

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\pandas\core\computation\expr.py in _maybe_transform_eq_ne(self, node, left, right)
    372             left = self.visit(node.left, side='left')
    373         if right is None:
--> 374             right = self.visit(node.right, side='right')
    375         op, op_class, left, right = self._rewrite_membership_op(node, left,
    376                                                                 right)

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\pandas\core\computation\expr.py in visit(self, node, **kwargs)
    328 
    329         method = 'visit_'   node.__class__.__name__
--> 330         visitor = getattr(self, method)
    331         return visitor(node, **kwargs)
    332 

AttributeError: 'PandasExprVisitor' object has no attribute 'visit_Constant'

@jorisvandenbossche
Copy link
Member

Although it's that we don't have any official support of testing for Python 3.8, it is still nice that people already start testing it, so issues can be catched early (both on our side as on Python's side). So thanks for that @stonebig !

For the last error: I am not very familiar with the DataFrame.query code, but that seems like potentially due to a change in AST ?

@stonebig
Copy link
Contributor Author

error still present with python-3.8.0b1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Library building on various platforms Windows Windows OS
Projects
None yet
Development

No branches or pull requests

5 participants