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.

Variable explorer does not show variables, if Python interpreter from virtual environment

See original GitHub issue

Problem Description

The variable explorer does not show variables anymore if I use a virtual environment in Spyder. The variable explorer works fine (shows all variables) if I run the standard conda environment.

Problem more generally: I don’t know the best way to link a virtualenv or conda env to spyder in 2020.

What steps reproduce the problem?

  1. Create virtual environment as explained here: https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/
  2. Link the Python interpreter in Spyder as explained here (" The modular approach"): https://github.com/spyder-ide/spyder/wiki/Working-with-packages-and-environments-in-Spyder#the-modular-approach
  3. Launch Spyder via Anaconda. When the Python interpreter is linked to the virtual environment, variables don’t how up in the variable viewer anymore. When the interpreter set back to “Default (i.e. the same as Spyder’s)” and the kernel is restarted then the variables show up again.

I first tried this with virtualenv. Then I tried resetting Spyder and tried it with a conda env and different versions of conda install spyder-kernels=0.* or conda install spyder-kernels=1.* ; which lead to different problems. (I have the impression that “The modular approach” is outdated and doesn’t work anymore.

=> I suppose that general question is: what is the best way to link a conda env / virtualenv to spyder in 2020?

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

Variables should show in the variable viewer, but don’t. It’s just empty, whatever variable I create. (Or more generally: Link a conda env to spyder)

Versions

  • Spyder version: 4.1.2
  • Python version: 3.7.3
  • Operating System name/version: macOS Catalania 10.15.3

Dependencies

# Mandatory:
applaunchservices >=0.1.7      :  0.2.1 (OK)
atomicwrites >=1.2.0           :  1.3.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.3.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)
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.4.4 (OK)
pyls >=0.31.9;<0.32.0          :  0.31.9 (OK)
qdarkstyle >=2.8               :  2.8 (OK)
qtawesome >=0.5.7              :  0.7.0 (OK)
qtconsole >=4.6.0              :  4.7.2 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.3 (OK)
sphinx >=0.6.6                 :  2.4.4 (OK)
spyder_kernels >=1.9.0;<1.10.0 :  1.9.0 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  18.1.1 (OK)

# Optional:
cython >=0.21                  :  0.29.15 (OK)
matplotlib >=2.0.0             :  3.1.3 (OK)
numpy >=1.7                    :  1.18.1 (OK)
pandas >=0.13.1                :  1.0.3 (OK)
scipy >=0.17.0                 :  1.4.1 (OK)
sympy >=0.7.3                  :  1.5.1 (OK)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ShaswatLenkacommented, Jun 17, 2022

Hey @dalthviz, I should create a new issue for this. I am unable to use the import data button becaues that was my usecase as I was working with spydata files. I have still not checked with python code. I can gather all these observations and raise a detailed issue. Thanks!

1reaction
russell94paulcommented, Oct 28, 2020

I am also having this issue. Is there any resolution for this yet?

Thanks in advance. 👍

I navigated to the project root folder in the spider file explorer. and ran each line of code in my script with F9. (Instead of right-click -> run cell

This is what worked for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Newly-assignmed variables not showing up in Spyder's ...
Go to Variable explorer window. Then you have options button right hand side. Click on it,Untick the option Exclude all uppercase preferences as...
Read more >
venv — Creation of virtual environments — Python 3.11.1 ...
When a virtual environment has been activated, the VIRTUAL_ENV environment variable is set to the path of the environment. Since explicitly activating a...
Read more >
Manage Python environments and interpreters - Visual Studio ...
Use the Python Environments window to manage global, virtual, and conda environments. Install Python interpreters and packages and assign ...
Read more >
MATLAB vs Python: Why and How to Make the Switch
Evaluate the differences of using MATLAB vs Python; Set up an environment for ... Variables created in the console are not saved if...
Read more >
VSCode's Python Interactive mode is AMAZING! - YouTube
I've gone from serial Jupyter Notebook user to someone that almost never uses them and it's all thanks to VSCode's interactive mode for ......
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