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:
- Created 4 years ago
- Reactions:1
- Comments:18 (10 by maintainers)
Top GitHub Comments
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.
This is the last release 0.6.9 already for a while.