Starting a new console loses `PYTHONPATH` in Spyder 5.3.2
See original GitHub issueProblem 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
The same issue does NOT exist in 5.3.1 (see screenshot)
What steps reproduce the problem?
- start spyder 5.3.2
- import os; os.environ[‘PYTHONPATH’] # this works
- open another console with default settings
- 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:
- Created a year ago
- Comments:7 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you!
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 havePYTHONPATH
defined inos.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.