KeyError: 'PATH' on import in interactive window
See original GitHub issueTrying
import xgboost
in the interactive window throws
/usr/local/Caskroom/miniconda/base/envs/thermo/lib/python3.6/site-packages/xgboost/__init__.py in
9 import os
10
---> 11 from .core import DMatrix, Booster
12 from .training import train, cv
13 from . import rabit # noqa
/usr/local/Caskroom/miniconda/base/envs/thermo/lib/python3.6/site-packages/xgboost/core.py in
134
135 # load the XGBoost library globally
--> 136 _LIB = _load_lib()
137
138
/usr/local/Caskroom/miniconda/base/envs/thermo/lib/python3.6/site-packages/xgboost/core.py in _load_lib()
118 if len(lib_paths) == 0:
119 return None
--> 120 pathBackup = os.environ['PATH']
121 for lib_path in lib_paths:
122 try:
/usr/local/Caskroom/miniconda/base/envs/thermo/lib/python3.6/os.py in __getitem__(self, key)
667 except KeyError:
668 # raise KeyError with the original key value
--> 669 raise KeyError(key) from None
670 return self.decodevalue(value)
671
KeyError: 'PATH'
but works fine in terminal.
As suggested by @bbcCorp in microsoft/vscode-python#436, I tried creating a .env
file with
echo "PATH=\$PATH" >> .env
but the issue persists. I’m running the latest VS Code and insider’s build of the Python extension.
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
KeyError: 'PATH' on import in interactive window #2589 - GitHub
I'm running the latest VS Code and insider's build of the Python extension. Python Ext Version: 2019.12.53195-dev. VS Code Version: 1.40.2 ...
Read more >KeyError 'PATH' on numpy Import - python - Stack Overflow
It seems that this is an issue which is already fixed but the fix is not released yet: Issue in numpy github repo...
Read more >How to fix Python KeyError Exceptions in simple steps?
Whenever an exception is raised in Python, it is done using traceback, as you can see in the example code above.
Read more >Key Error: os.environ["HOME"] - Python Forum
I run the python script in python3.8 and this return an key error. Error: ... Windows doesn't have HOME ... import os. print...
Read more >What's New In Python 3.8 — Python 3.11.1 documentation
When the Python interpreter is interrupted by Ctrl-C (SIGINT) and the resulting KeyboardInterrupt exception is not caught, the Python process now exits via...
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
@DonJayamanne Just tested this again and all is back to working now with the insider’s. Thanks a lot! 👍
@janosh thanks for testing the insiders and getting back.