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

tqdm.pandas() ImportError: cannot import 'PanelGroupBy' #555

Closed
aaronkollasch opened this issue May 17, 2018 · 17 comments
Closed

tqdm.pandas() ImportError: cannot import 'PanelGroupBy' #555

aaronkollasch opened this issue May 17, 2018 · 17 comments
Labels
p0-bug-critical ☢ Exception rasing submodule ⊂ Periphery/subclasses

Comments

@aaronkollasch
Copy link

When using tqdm v4.23.3 and pandas v0.23.0, I get this error:

>>> from tqdm import tqdm
>>> tqdm.pandas()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/username/.conda/envs/py36/lib/python3.6/site-packages/tqdm/_tqdm.py", line 545, in pandas
    from pandas.core.groupby import PanelGroupBy
ImportError: cannot import name 'PanelGroupBy'

It looks like pandas has moved GroupBy to a submodule, and PanelGroupBy is not included in pandas/core/groupby/__init__.py, though it remains in pandas/core/groupby/groupby.py.

Thus, for the latest version of pandas, PanelGroupBy can only be imported using from pandas.core.groupby.groupby import PanelGroupBy.

I've reverted to the previous version of pandas and that fixed the problem, so this is a heads up for the newest and future pandas versions.

@andrewnc
Copy link

What is the status on this fix?

@casperdcl
Copy link
Sponsor Member

should be fixed in tqdm>=4.23.4

@will-holley
Copy link

I am getting this issue in 4.32.2

@casperdcl
Copy link
Sponsor Member

yes, as per #780 this is now due to pandas==0.25.0 on python3

@will-holley
Copy link

I saw that after posting; thanks for following up, @casperdcl.

@casperdcl
Copy link
Sponsor Member

just in case someone else winds up here to follow the trail :)

@chwonghk01
Copy link

Got the same error with pandas==0.25.0 and tqdm==4.32.2, downgrade to pandas==0.24.0 works.

@aloosley
Copy link

At the time of writing this comment, one does not need to downgrade pandas from pandas==0.25.0 but rather update tqdm. I updated tqdm today to tqdm==4.36.1 and everything works.

@casperdcl
Copy link
Sponsor Member

yes as per #780 (comment) fixed in tqdm>=4.33.0

@casperdcl
Copy link
Sponsor Member

likely to break again at some time in future since

  1. pandas has an unstable API
  2. I don't use pandas

vaklyuenkov added a commit to vaklyuenkov/catalyst that referenced this issue Oct 30, 2019
To avoid versions conflicts tqdm/tqdm#555
TezRomacH pushed a commit to catalyst-team/catalyst that referenced this issue Oct 30, 2019
To avoid versions conflicts tqdm/tqdm#555
@lapolonio
Copy link

I think this broke again with pandas 1.0.0

@casperdcl casperdcl reopened this Jan 31, 2020
@casperdcl
Copy link
Sponsor Member

v1.0.0? Awesome! Major version 1 means it's unlikely to break again once it's re-fixed.

casperdcl added a commit that referenced this issue Jan 31, 2020
@sakshamjn
Copy link

Hey
I think this problem comes again in tqdm version 4.43.0

@casperdcl casperdcl reopened this Mar 13, 2020
@Hadrien-Cornier
Copy link

Hadrien-Cornier commented Mar 13, 2020

I have
Python 3.6.9
tqdm 4.28.1
pandas 0.25.3
catalyst 20.03

I am trying to run :

from catalyst.dl import utils
And I have the error message :

<ipython-input-63-fea49b0d6a4e> in <module>()
      1 import catalyst
----> 2 from catalyst.dl import utils

/usr/local/lib/python3.6/dist-packages/catalyst/dl/__init__.py in <module>()
      2 # isort:skip_file
      3 
----> 4 from catalyst.core import *
      5 
      6 from .core import *

/usr/local/lib/python3.6/dist-packages/catalyst/core/__init__.py in <module>()
      8 # runner
      9 
---> 10 from .state import _State
     11 from .callback import Callback, CallbackOrder, CallbackNode, CallbackType
     12 from .callbacks import *

/usr/local/lib/python3.6/dist-packages/catalyst/core/state.py in <module>()
      7 from torch.utils.data import DataLoader
      8 
----> 9 from catalyst import utils
     10 from catalyst.utils.tools.frozen_class import FrozenClass
     11 from catalyst.utils.tools.typing import (

/usr/local/lib/python3.6/dist-packages/catalyst/utils/__init__.py in <module>()
     46     dict2structed, geometric_cumsum, get_one_hot, np_softmax, structed2dict
     47 )
---> 48 from .pandas import (
     49     dataframe_to_list, folds_to_list, split_dataframe_train_test,
     50     split_dataframe_on_folds, split_dataframe_on_stratified_folds,

/usr/local/lib/python3.6/dist-packages/catalyst/utils/pandas.py in <module>()
     10 from catalyst.utils import args_are_not_none
     11 
---> 12 tqdm.pandas()
     13 
     14 

/usr/local/lib/python3.6/dist-packages/tqdm/_tqdm.py in pandas(tclass, *targs, **tkwargs)

ImportError: cannot import name 'PanelGroupBy'

@Hadrien-Cornier
Copy link

Nevermind, I just needed to upgrade to tdqm==4.43.0 and it fixed it !

@chunfengh
Copy link

chunfengh commented Jul 12, 2021

I think this problem still exist with following:

Pandas vesion: 1.1.5
Python version: 3.6.13
tqdm version: v4.61.1

ImportError: cannot import name 'PanelGroupBy'

If the module is lightweight, try adhoc_import - http://go/adhoc-import
If you're already using adhoc_import and are having trouble, see http://go/adhoc-trouble.
Otherwise, use a custom runtime - http://go/colab-custom-runtime
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
tqdm/_tqdm.py in pandas(tclass, *targs, **tkwargs)
    593             # pandas>=0.23.0
--> 594             from pandas.core.groupby.groupby import DataFrameGroupBy, \
    595                 SeriesGroupBy, GroupBy, PanelGroupBy

ImportError: cannot import name 'DataFrameGroupBy'

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
1 frames
<ipython-input-15-aa3b5d28091d> in <module>()
      7 from tqdm import tqdm
      8 
----> 9 tqdm.pandas()
     10 
     11 RESULT_ENTRY_COL = 'COLUMN'

tqdm/_tqdm.py in pandas(tclass, *targs, **tkwargs)
    595                 SeriesGroupBy, GroupBy, PanelGroupBy
    596         except ImportError:
--> 597             from pandas.core.groupby import DataFrameGroupBy, \
    598                 SeriesGroupBy, GroupBy, PanelGroupBy
    599 

ImportError: cannot import name 'PanelGroupBy'

@casperdcl
Copy link
Sponsor Member

@chunfengh you're definitely not using tqdm==4.61.1, you're using tqdm<=4.35.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p0-bug-critical ☢ Exception rasing submodule ⊂ Periphery/subclasses
Projects
None yet
Development

No branches or pull requests

10 participants