spyder: Improve error message when trying to view a dataframe and Pandas is not installed next to Spyder
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(orpip, 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

What steps reproduce the problem?
- install spyder using pip
- open spyder in virtualenv
- 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

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

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)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18 (16 by maintainers)
I think the error message should explain the situation. Something like
optional dependency <package> not found in spyder environmentI would also be ok with them being mandatory.
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
pandasisn’t installed the DataFrame shows up in the Variable Explorer, it’s even able to parse it somehow withoutpandasas the column names are displayed.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.
Indeed, we might need better messaging or reconsider moving numpy and pandas from optional to mandatory dependencies?
Thoughts @spyder-ide/core-developers ?
Hey @MiguelonGonzalez , see PR #12902 which closed this issue.
Yeah we actually need to do that to be able to support other objects in other languages in other Kernels, so something we definitely need to address.
It sure would be nice, someday, if its even possible, to provide a way for Spyder to edit Variable Explorer objects without the need for those packages to be installed in Spyder’s runtime environment. In other words, use the iPython Console’s kernel. That would solve these issues and reduce the “required” footprint of Spyder, especially for a standalone application.
@maximlt indeed, the issues is installing pandas means also numpy and scipy which are big libraries, but given the need is the road we will probably need to take.