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.

RecursionError when opening a dataframe with Pandas 1.1.0 in the kernel and 1.0.5 in Spyder

See original GitHub issue

Description

What steps will reproduce the problem?

import pandas as pd
df = pd.DataFrame({"a":range(10),"b":range(10)})

Try to open df by double clicking on the DataFrame in the variable explorer.

This was previously working fine. I believe that a recent install of spyder-kernels to my virtual environment caused this problem, but I’m not sure how.

To avoid having to install spyder in every virtual environment I works with, I just install spyder-kernels in the venv, launch spyder from my base environment, and point the python interpreter to the python instance inside my venv. This process has been working fine, until I just had to a create a new venv for a project. I repeated this process and am now getting this error. This only happens when the python interpreter is pointing to my venv interpreter, not base spyder.

Quick googling seems like this may be related to incompatible versions of ipykernel and spyder-kernels (?) https://github.com/python-poetry/poetry/issues/2133

-version of spyder-kernels = 1.9.3 -version of ipykernel: 5.3.4, which was installed with spyder-kernels

Traceback

  File "/Users/lmariano/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pandas/core/generic.py", line 5272, in __getattr__
    if self._info_axis._can_hold_identifiers_and_holds_name(name):
  File "/Users/lmariano/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pandas/core/generic.py", line 5272, in __getattr__
    if self._info_axis._can_hold_identifiers_and_holds_name(name):
  File "/Users/lmariano/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pandas/core/generic.py", line 5272, in __getattr__
    if self._info_axis._can_hold_identifiers_and_holds_name(name):
  [Previous line repeated 993 more times]
  File "/Users/lmariano/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pandas/core/generic.py", line 493, in _info_axis
    return getattr(self, self._info_axis_name)
  File "/Users/lmariano/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pandas/core/generic.py", line 5270, in __getattr__
    return object.__getattribute__(self, name)
  File "pandas/_libs/properties.pyx", line 63, in pandas._libs.properties.AxisProperty.__get__
  File "/Users/lmariano/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pandas/core/generic.py", line 5270, in __getattr__
    return object.__getattribute__(self, name)
RecursionError: maximum recursion depth exceeded while calling a Python object

Versions

  • Spyder version: 4.1.4
  • Python version: 3.7.7
  • Qt version: 5.12.9
  • PyQt5 version: 5.12.3
  • Operating System: Darwin 19.6.0

Dependencies


# Mandatory:
applaunchservices >=0.1.7      :  0.2.1 (OK)
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.5.0 (OK)
diff_match_patch >=20181111    :  20200713 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.16.1 (OK)
jedi =0.17.1                   :  0.17.1 (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  1.1.0 (OK)
parso =0.7.0                   :  0.7.0 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.2 (OK)
pygments >=2.0                 :  2.6.1 (OK)
pylint >=1.0                   :  2.5.3 (OK)
pyls >=0.34.0;<1.0.0           :  0.34.1 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  0.7.2 (OK)
qtconsole >=4.6.0              :  4.7.5 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
sphinx >=0.6.6                 :  3.1.2 (OK)
spyder_kernels >=1.9.2;<1.10.0 :  1.9.2 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  19.0.1 (OK)

# Optional:
cython >=0.21                  :  None (OK)
matplotlib >=2.0.0             :  None (OK)
numpy >=1.7                    :  1.19.0 (OK)
pandas >=0.13.1                :  1.0.5 (OK)
scipy >=0.17.0                 :  1.5.1 (OK)
sympy >=0.7.3                  :  None (OK)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
steff456commented, Sep 23, 2020

@ccordoba12 if I have my spyder environment with pandas 1.1.1 and connect it to a kernel with pandas 1.0.5 it works as expected and the error doesn’t exist. I think we need to bump our version of pandas for avoiding this error and we can report this problem to pandas so they can be aware of this behavior.

1reaction
steff456commented, Sep 9, 2020

@ccordoba12 I was able to reproduce this error by creating a new environment with the latest version of pandas and connecting this one as python interpreter. My base environment has pandas 1.0.5 and the new environment has pandas 1.1.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Loading dataframe from 1.1.5 fails on pandas 1.0.1
It was saved when using pandas version 1.1.5. I'm trying to open it with version 1.0.1 but get the following error. File "<stdin>",...
Read more >
Installation — pandas 1.5.2 documentation
Installation#. The easiest way to install pandas is to install it as part of the Anaconda distribution, a cross platform distribution for data...
Read more >
What's new in 1.2.1 (January 20, 2021) - Pandas
Fixed regression in DataFrame.__setitem__ raising ValueError when expanding DataFrame and new column is from type "0 - name" (GH39010).
Read more >
What's new in 1.3.0 (July 2, 2021) - Pandas
As a result, the columns will retain the dtype(s) of values , never casting to the dtypes of the existing arrays. >>> In...
Read more >
What's new in 1.2.0 (December 26, 2020) - Pandas
Series and DataFrame can now be created with allows_duplicate_labels=False flag to control whether the index or columns can contain duplicate labels ...
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