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.

Improve error message when trying to view a dataframe and Pandas is not installed next to Spyder

See original GitHub issue

Issue Report Checklist

  • [ yes] Searched the issues page for similar reports
  • [ yes] Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • Could not reproduce inside jupyter qtconsole (if console-related)
  • Tried basic troubleshooting (if a bug/error)
    • Restarted Spyder
    • Reset preferences with spyder --reset
    • Reinstalled the latest version of Anaconda
    • Tried the other applicable steps from the Troubleshooting Guide
  • Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

After opening spyder in virtualenv, checked pip freeze and lists pandas , numpy , sklearn everything needed for data analysis the i wrote a code and ran it. it worked well., but when i am trying to open same variable in variable explorer window, it showing error

image

What steps reproduce the problem?

  1. install spyder using pip
  2. open spyder in virtualenv
  3. ran the code and check in variable explorer

What is the expected output? What do you see instead?

IPython console is working fine and giving perferct results, only variable explorer is not able to open variables that are coming form using pandas library i tired defining numpy array and list , i could able to open them as below image

but when i am trying open pandas dataframe variable , variable explorer is throwing below error image

Paste Traceback/Error Below (if applicable)


PASTE TRACEBACK HERE

Versions

  • Spyder version: 4.1.2
  • Python version: 3.8
  • Qt version:
  • PyQt version:
  • Operating System name/version: Windows 10

Dependencies


# Mandatory:
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.4.0 (OK)
diff_match_patch >=20181111    :  20181111 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.13.0 (OK)
jedi =0.15.2                   :  0.15.2 (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  0.9.2 (OK)
paramiko >=2.4.0               :  2.7.1 (OK)
parso =0.5.2                   :  0.5.2 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.0 (OK)
pygments >=2.0                 :  2.6.1 (OK)
pylint >=0.25                  :  2.5.0 (OK)
pyls >=0.31.9;<0.32.0          :  0.31.10 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  0.7.1 (OK)
qtconsole >=4.6.0              :  4.7.3 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
sphinx >=0.6.6                 :  3.0.3 (OK)
spyder_kernels >=1.9.0;<1.10.0 :  1.9.0 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  19.0.0 (OK)

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (16 by maintainers)

github_iconTop GitHub Comments

5reactions
bcolsencommented, May 4, 2020

I think the error message should explain the situation. Something like optional dependency <package> not found in spyder environment

I would also be ok with them being mandatory.

2reactions
maximltcommented, May 9, 2020

I encountered the same bug and it took me a while before I understood what went wrong and to find this issue eventually. I use the Variable Explorer mostly to explore DataFrames so I would expect this feature to work out-of-the-box, thus I’m +1 on having Pandas (hence Numpy) as a hard dependency here.

Note that even if pandas isn’t installed the DataFrame shows up in the Variable Explorer, it’s even able to parse it somehow without pandas as the column names are displayed. image

Are there other types of object that could lead to the same error besides the Numpy and Pandas ones?

I’ll update the wiki (see #12107) according to your decision here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Getting ImportError on spyder when trying to open a ...
Show activity on this post. I had the same problem. I solved it installing the pandas version 0.24.2. pip install pandas==0.24.2.
Read more >
KeyError Pandas – How To Fix - Data Independent
Pandas KeyError - This annoying error means that Pandas can not find your column name in your dataframe. Here's how to fix this...
Read more >
How to Fix: No module named pandas - GeeksforGeeks
In this article, we will discuss how to fix the No module named pandas error. The error “No module named pandas ” will...
Read more >
Can't open spatial dataframe in Spyder 4.2.1 Variable Explorer
Solved: I upgraded to Spyder 4.2.1 from 3.6, and now when I run my ... Instead it gives a message stating 'The variable...
Read more >
Installation — pandas 1.5.2 documentation
One way you could be encountering this error is if you have multiple Python installations on your system and you don't have pandas...
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