Skip to content

KeyError: 'PATH' on import in interactive window #2589

@janosh

Description

@janosh

Trying

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions