Skip to content

"RecursionError: maximum recursion depth exceeded" with pandas 1.1.5 #3977

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
freud14 opened this issue Dec 12, 2020 · 5 comments
Closed

"RecursionError: maximum recursion depth exceeded" with pandas 1.1.5 #3977

freud14 opened this issue Dec 12, 2020 · 5 comments
Labels
Bug 🪲 Crash 💥 A bug that makes pylint crash

Comments

@freud14
Copy link

freud14 commented Dec 12, 2020

As discussed in issue #3939.

Steps to reproduce

It seems that with the new version 1.1.5 of pandas, we get a recursion error when using pandas in a similar way to issue #3939. I use the same script as @arg-123 in issue #3939:

import pandas as pd

def func(df1, df2):
    return pd.merge(df1, df2)  # RecursionError with pylint!

df = pd.DataFrame([[0]])
func(df, df)

Here is the bash script I use to reproduce the bug:

python3.8 -m venv env
source env/bin/activate
pip install pandas pylint # pandas==1.1.5 pylint==2.6
pip install wheel
pip install git+https://github.com/PyCQA/astroid.git
pylint test.py

where test.py is the Python script above.

With pandas 1.1.4, the bug is not present.

Current behavior

Recursion error, see https://pastebin.com/EXJJSiqt

Expected behavior

No recursion error

pylint --version output

pylint 2.6.0
astroid 2.5.0
Python 3.8.5 (default, Jul 28 2020, 12:59:40) 
[GCC 9.3.0]
@hippo91 hippo91 added Bug 🪲 Crash 💥 A bug that makes pylint crash labels Dec 12, 2020
@bnsh
Copy link

bnsh commented Dec 17, 2020

Interesting that you say that with 1.1.4 the bug is not present. I tried with the python:3.8 docker image:

and I get the same recursion error. Perhaps I'll try to find which pandas version will finally allow me to get it working.

FROM python:3.8

MAINTAINER Binesh Bannerjee <[email protected]>

RUN /usr/local/bin/python3.8 -m pip install -U pylint pandas==1.1.4

RUN echo "import pandas as pd" > /tmp/demo.py && \
    echo "pd.merge_asof()" >> /tmp/demo.py

RUN /usr/local/bin/python3.8 -m pip freeze

CMD ["/usr/local/bin/python3.8", "-m", "pylint", "-r", "n", "/tmp/demo.py"]

# docker build -t binesh/pylintbug .
# docker run -it --rm binesh/pylintbug
#
# demo.py simply contains
# import pandas as pd
# pd.merge_asof()
#
# pip freeze output:
# astroid==2.4.2
# isort==5.6.4
# lazy-object-proxy==1.4.3
# mccabe==0.6.1
# numpy==1.19.4
# pandas==1.1.4
# pylint==2.6.0
# python-dateutil==2.8.1
# pytz==2020.4
# six==1.15.0
# toml==0.10.2
# wrapt==1.12.1


@bnsh
Copy link

bnsh commented Dec 17, 2020

pandas==1.0.5 finally runs to completion, with these (correct) python warnings:

/tmp/demo.py:1:0: C0114: Missing module docstring (missing-module-docstring)
/tmp/demo.py:2:0: E1120: No value for argument 'left' in function call (no-value-for-parameter)
/tmp/demo.py:2:0: E1120: No value for argument 'right' in function call (no-value-for-parameter)

Here's it's Dockerfile:

FROM python:3.8

MAINTAINER Binesh Bannerjee <[email protected]>

# pandas==1.1.5 fails.
# pandas==1.1.4 fails.
# pandas==1.1.3 fails.
# pandas==1.1.2 fails.
# pandas==1.1.1 fails.
# pandas==1.0.5 succeeds.
RUN /usr/local/bin/python3.8 -m pip install -U pylint 'pandas<1.1.0'

RUN echo "import pandas as pd" > /tmp/demo.py && \
    echo "pd.merge(pd.DataFrame([[0]]), pd.DataFrame([[0]]))" >> /tmp/demo.py

RUN /usr/local/bin/python3.8 -m pip freeze

CMD ["/usr/local/bin/python3.8", "-m", "pylint", "-r", "n", "/tmp/demo.py"]

# docker build -t binesh/pylintbug .
# docker run -it --rm binesh/pylintbug
#
# demo.py simply contains
# import pandas as pd
# pd.merge(pd.DataFrame([[0]]), pd.DataFrame([[0]]))
#
# pip freeze output:
# astroid==2.4.2
# isort==5.6.4
# lazy-object-proxy==1.4.3
# mccabe==0.6.1
# numpy==1.19.4
# pandas==1.0.5
# pylint==2.6.0
# python-dateutil==2.8.1
# pytz==2020.4
# six==1.15.0
# toml==0.10.2
# wrapt==1.12.1

@freud14
Copy link
Author

freud14 commented Dec 17, 2020

@bnsh it's because you are not at the latest version of astroid, i.e. master branch on GitHub.

@hippo91
Copy link
Contributor

hippo91 commented Jan 16, 2021

Thanks to @dbaty, 👍 i made three kind of tests (all with python 3.8.6).
First one with pandas 1.1.4: the problem is no more present if i use astroid's master branch;
Second one with pandas 1.1.5: the problem is present even with astroid's master branch;
Third one with last pandas version (1.2.0): the problem is not present even with current version of astroid.
Thus i suggest moving from pandas 1.1.4 to pandas 1.2.0.
I close this issue, but will reopen it if needed.

@hippo91 hippo91 closed this as completed Jan 16, 2021
@freud14
Copy link
Author

freud14 commented Jan 16, 2021

@hippo91 Instead of closing this issue, wouldn't it be better to find the underlying issue in astroid? It seems to me that there are a lot of bug reports with recursion errors in astroid and a new version of pandas does not solve the bug that will reappear in a future version or in other libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🪲 Crash 💥 A bug that makes pylint crash
Projects
None yet
Development

No branches or pull requests

3 participants