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.

Starting a new console loses `PYTHONPATH` in Spyder 5.3.2

See original GitHub issue

Problem Description

In 5.3.2, if you open a new Ipython console, it will NOT carry the PYTHONPATH environment variable which we need for custom projects/packages. The environment variables work in the first console that was opened when spyder starts, but it goes missing when you open more console (default setting), see screenshot image

The same issue does NOT exist in 5.3.1 (see screenshot) image

What steps reproduce the problem?

  1. start spyder 5.3.2
  2. import os; os.environ[‘PYTHONPATH’] # this works
  3. open another console with default settings
  4. import os; os.environ[‘PYTHONPATH’] throws KeyError ‘PYTHONPATH’

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

PYTHONPATH variable

Paste Traceback/Error Below (if applicable)


PASTE TRACEBACK HERE

Versions

  • Spyder version:
  • Python version:
  • Qt version:
  • PyQt version:
  • Operating System name/version:

Dependencies

PASTE DEPENDENCIES HERE

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
drlakecodercommented, Aug 6, 2022

Thank you!

0reactions
mrclarycommented, Sep 4, 2022

I cannot reproduce the OP.

In my Windows VM, working from the latest commit (948f2ebf), launching from conda, with PYTHONPATH defined in both “User variables” and “System variables”, I do not have PYTHONPATH defined in os.environ in the first console, or any subsequent consoles. This is consistent with the intended behavior beginning with 5.3.2. PYTHONPATH is importable into the PYTHONPATH Manager, after which it will be injected into all IPython Consoles.

If the issue still persists for @drlakecoder, I suggest renaming Spyder’s configuration directory (.spyder-py3) to see if that resolves the discrepency, or upgrading to 5.3.3 if the issue has inadvertently been fixed.

Nevertheless, I believe that Spyder 5.4.0 (the next release) will restore the previous behavior of automatically importing the user’s PYTHONPATH.

I will close this issue. However, @drlakecoder, if you need further assistance, or have additional information that can help to reproduce the problem, please reopen the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common Illnesses — Spyder 5 documentation
If you receive the message An error occurred while starting the kernel in the IPython Console, Spyder was unable to launch a new...
Read more >
Python Spyder reset - Stack Overflow
Yesterday, Spyder crashed I can't figure it out how to fix it. I uninstalled python(x,y) and reinstalled, still the same problem. If I...
Read more >
spyder-ide/public - Gitter
If there is no entry for Spyder in the Start menu, then you can start Spyder by opening the Anaconda prompt and typing...
Read more >
How to Fix the Spyder IDE "Internal Problem" Issue (ver. 5.1.5)
OverviewIn this video, I'll show you how to fix a common issue with the Spyder IDE for Python programming. The issue “ Spyder...
Read more >
Installation of Python, Spyder, Numpy, Sympy, Scipy, Pytest ...
This can be done either by typing spyder in a terminal or inside the Anaconda Prompt, or by starting Spyder through the Anaconda...
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