question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pandas 1.0.0 ImportError: cannot import name 'generic' from 'pandas.core.groupby'

See original GitHub issue
  • Nuitka version, full Python version and Platform (Windows, OSX, Linux …) Nuitka 0.6.7 Python: 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)] Executable: C:\Anaconda3\envs\pandas_nuitka\python.exe OS: Windows Arch: x86_64

  • How did you install Nuitka and Python (pip, anaconda, deb, rpm, from source, what is a virtualenv …), this is very important usually. Anaconda python, conda enviroment. Used pip to install nuitka and pandas. conda list shows:

# packages in environment at C:\Anaconda3\envs\pandas_nuitka:
#
# Name                    Version                   Build  Channel
certifi                   2019.11.28               py37_0
nuitka                    0.6.7                    pypi_0    pypi
numpy                     1.18.1                   pypi_0    pypi
pandas                    1.0.0                    pypi_0    pypi
pip                       20.0.2                   py37_1
python                    3.7.0                hea74fb7_0
python-dateutil           2.8.1                    pypi_0    pypi
pytz                      2019.3                   pypi_0    pypi
setuptools                45.1.0                   py37_0
six                       1.14.0                   pypi_0    pypi
vc                        14.1                 h0510ff6_4
vs2015_runtime            14.16.27012          hf0eaf9b_1
wheel                     0.34.1                   py37_0
wincertstore              0.2                      py37_0

  • If possible please supply a Short, Self Contained, Correct, Example that demonstrates the issue i.e a small piece of code which reproduces the issue and can be run with out any other (or as few as possible) external dependencies.

Performed hinted compilation (using files from Nuitka Utilities) of the following code with pandas version 1.0.0 (this was in file “mwe.py”):

import pandas as pd
df = pd.DataFrame({'a': [1, 2, 3]})
print(df)

To perform compilation, used the following commands in a Windows batch file:

:: Activate the environment
call conda activate pandas_nuitka
:: Get hints and compile
python get-hints.py mwe.py
python nuitka-hints.py mwe.py
:: Deactivate the environment
call conda deactivate

Compilation worked, but when running the executable we get the following error:

C:\Users\<my_user>\Documents\python_projects\pandas_nuikta>mwe.dist\mwe.exe
Traceback (most recent call last):
  File "C:\Users\<my_user>\Documents\python_projects\pandas_nuikta\mwe.dist\mwe.py", line 1, in <module>
  File "C:\Users\<my_user>\Documents\python_projects\pandas_nuikta\mwe.dist\pandas\__init__.py", line 54, in <module pandas>
  File "C:\Users\<my_user>\Documents\python_projects\pandas_nuikta\mwe.dist\pandas\core\api.py", line 29, in <module pandas.core.api>
  File "C:\Users\<my_user>\Documents\python_projects\pandas_nuikta\mwe.dist\pandas\core\groupby\__init__.py", line 1, in <module pandas.core.groupby>
  File "C:\Users\<my_user>\Documents\python_projects\pandas_nuikta\mwe.dist\pandas\core\groupby\generic.py", line 60, in <module pandas.core.groupby.generic>
  File "C:\Users\<my_user>\Documents\python_projects\pandas_nuikta\mwe.dist\pandas\core\frame.py", line 105, in <module pandas.core.frame>
ImportError: cannot import name 'generic' from 'pandas.core.groupby' (C:\Users\<my_user>\Documents\python_projects\pandas_nuikta\mwe.dist\pandas\core\groupby\__init__.py)

When downgrading pandas to version 0.25.0 with pip install pandas==0.25.0, the compilation worked and the code executed correctly:

C:\Users\<my_user>\Documents\python_projects\pandas_nuikta>mwe.dist\mwe.exe
   a
0  1
1  2
2  3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
manukgitncommented, Jul 15, 2020

Hello, Does this bug with cyclic imports solved?

In #618 it seems solved, but meet similar problem on standalone binary built by nuitka(0.6.9rc5): Traceback (most recent call last): File “somepath/my_staff.dist/mo_staff.py”, line 10, in <module> File “somepath/my_staff.dist/pandas/init.py”, line 55, in <module pandas> File “somepath/my_staff.dist/pandas/core/api.py”, line 29, in <module pandas.core.api> File “somepath/my_staff.dist/pandas/core/groupby/init.py”, line 1, in <module pandas.core.groupby> File “somepath/my_staff.dist/pandas/core/groupby/generic.py”, line 60, in <module pandas.core.groupby.generic> File “somepath/my_staff.dist/pandas/core/frame.py”, line 105, in <module pandas.core.frame> ImportError: cannot import name ‘generic’ from ‘pandas.core.groupby’ (somepath/my_staff.dist/pandas/core/groupby/init.py)

Used version of nuitka: python3.8 -m nuitka --version 0.6.9rc5 Python: 3.8.4rc1 (default, Jul 14 2020, 21:15:24) Executable: /usr/local/bin/python3.8 OS: Linux Arch: x86_64

Environment: pip3.8 list Package Version Nuitka 0.6.9rc5 numpy 1.19.0 pandas 1.0.5 pip 20.1.1 python-dateutil 2.8.1 pytz 2020.1 setuptools 47.1.0 six 1.15.0 wheel 0.34.2

Command creating binary: python3.8 -m nuitka -j 2 --standalone --follow-imports --show-modules --output-dir=my_bin mo_staff.py

At this moment don’t have minimal reproducible example, but ll make in a days if necessary.

0reactions
kayhayencommented, Oct 2, 2020

This is the last release 0.6.9 already for a while.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to import pandas (pandas._libs.window.aggregations)
window.aggregations as window_aggregations ImportError: DLL load failed while importing aggregations: The specified module could not be found.
Read more >
cannot import pandas in vs code - You.com | The AI Search ...
Nuitka/NuitkaPandas 1.0.0 ImportError: cannot import name 'generic' from 'pandas.core.groupby'#616. Created almost 3 years ago.
Read more >
What's new in 1.0.0 (January 29, 2020) - Pandas
From pandas 1.0, only the very first argument, which maps labels to their new names along the default axis, is allowed to be...
Read more >
pandas.core.series — Lux 0.1.2 documentation
_libs import lib, properties, reshape, tslibs from pandas. ... from pandas.core.frame import DataFrame from pandas.core.groupby.generic import SeriesGroupBy ...
Read more >
Source code for pandas.core.frame - OMFIT
_libs import algos as libalgos, lib, properties from pandas. ... import Literal from pandas.core.groupby.generic import DataFrameGroupBy ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found