Selecting Python interpreter in conda environment has no effect
See original GitHub issueEnvironment data
- VS Code version: 1.52.1 (user setup) Commit: ea3859d4ba2f3e577a159bc91e3074c5d85c0523
- Jupyter Extension version: v2020.12.414227025
- Python Extension version: v2020.12.424452561
- OS: Windows 10, Version 10.0.17763 Build 17763
- Anaconda 3.7.7 vs. 3.9.1
- Type of virtual environment used: conda
- Jupyter server running: Local
Version: 1.52.1 (user setup) Commit: ea3859d4ba2f3e577a159bc91e3074c5d85c0523 Date: 2020-12-16T16:34:46.910Z Electron: 9.3.5 Chrome: 83.0.4103.122 Node.js: 12.14.1 V8: 8.3.110.13-electron.0 OS: Windows_NT x64 10.0.17763
Expected behaviour
Selecting a Python interpreter in the Jupyter extension’s interpreter drop-down menu (or using command palette) should result in that interpreter being used in the Jupyter notebook.
Actual behaviour
Selecting the Python 3.9.1 interpreter in a conda environment from the drop-down menu (or using command palette) seems to have no effect. It is stuck on the one in the base conda environment (3.7.7 in my case).
Steps to reproduce:
Open an .ipynb file as Jupyter notebook, switch Python interpreters.
Print sys.version
import sys
print(sys.version)
Wrong version displayed, as shown in this screenshot:
Logs
Output for Jupyter
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Jupyter
)
> ~\Anaconda3\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import jupyter"
> ~\Anaconda3\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import notebook"
> ~\Anaconda3\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py jupyter kernelspec --version
> ~\Anaconda3\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> ~\Anaconda3\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> ~\Anaconda3\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> ~\Anaconda3\envs\sutokura\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> ~\Anaconda3\envs\sutokura\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
> ~\Anaconda3\envs\sutokura\python.exe -c "import os;print(os.path.realpath("C:\\Users\\jeaco\\AppData\\Roaming\\jupyter\\kernels"))"
> ~\Anaconda3\envs\sutokura\python.exe -c "import os;print(os.path.realpath("C:\\Users\\jeaco\\AppData\\Roaming\\jupyter\\kernels"))"
> ~\Anaconda3\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> ~\Anaconda3\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
Started kernel Python 3
> ~\Anaconda3\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
> ~\Anaconda3\envs\sutokura\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> ~\Anaconda3\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> ~\Anaconda3\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
Started kernel Python 3
> ~\Anaconda3\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
> ~\Anaconda3\envs\sutokura\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> ~\Anaconda3\envs\pdtable-dev\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> ~\Anaconda3\envs\e2d\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> ~\Anaconda3\envs\sutokura\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> ~\Anaconda3\envs\sutokura\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
Error 2021-01-04 14:03:00: Install Missing Dependencies, Class name = f, completed in 867ms, has a falsy return value, Return Value: undefined [Error: Command failed: C:/Users/jeaco/Anaconda3/Scripts/activate && conda activate dash && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:\Users\jeaco\.vscode\extensions\ms-python.python-2020.12.424452561\pythonFiles\pyvsc-run-isolated.py c:/Users/jeaco/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/printEnvVariables.py
Traceback (most recent call last):
File "c:\Users\jeaco\.vscode\extensions\ms-python.python-2020.12.424452561\pythonFiles\pyvsc-run-isolated.py", line 30, in <module>
runpy.run_path(module, run_name="__main__")
File "C:\Users\jeaco\Anaconda3\envs\dash\lib\runpy.py", line 252, in run_path
return _run_module_code(code, init_globals, run_name, path_name)
File "C:\Users\jeaco\Anaconda3\envs\dash\lib\runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "C:\Users\jeaco\Anaconda3\envs\dash\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "c:/Users/jeaco/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/printEnvVariables.py", line 7, in <module>
print(json.dumps(dict(os.environ)))
File "C:\Users\jeaco\Anaconda3\envs\dash\lib\json\__init__.py", line 244, in dumps
return _default_encoder.encode(obj)
File "C:\Users\jeaco\Anaconda3\envs\dash\lib\json\encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Users\jeaco\Anaconda3\envs\dash\lib\json\encoder.py", line 270, in iterencode
return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xd8 in position 26: invalid continuation byte
at ChildProcess.exithandler (child_process.js:304:12)
at ChildProcess.emit (events.js:223:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)] {
killed: false,
code: 1,
signal: null,
cmd: "C:/Users/jeaco/Anaconda3/Scripts/activate && conda activate dash && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:\\Users\\jeaco\\.vscode\\extensions\\ms-python.python-2020.12.424452561\\pythonFiles\\pyvsc-run-isolated.py c:/Users/jeaco/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/printEnvVariables.py",
vslsStack: [ CallSite {}, CallSite {}, CallSite {}, CallSite {} ]
}
Error 2021-01-04 14:03:05: Install Missing Dependencies, Class name = f, completed in 859ms, has a falsy return value, Return Value: undefined [Error: Command failed: C:/Users/jeaco/Anaconda3/Scripts/activate && conda activate dash && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:\Users\jeaco\.vscode\extensions\ms-python.python-2020.12.424452561\pythonFiles\pyvsc-run-isolated.py c:/Users/jeaco/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/printEnvVariables.py
Traceback (most recent call last):
File "c:\Users\jeaco\.vscode\extensions\ms-python.python-2020.12.424452561\pythonFiles\pyvsc-run-isolated.py", line 30, in <module>
runpy.run_path(module, run_name="__main__")
File "C:\Users\jeaco\Anaconda3\envs\dash\lib\runpy.py", line 252, in run_path
return _run_module_code(code, init_globals, run_name, path_name)
File "C:\Users\jeaco\Anaconda3\envs\dash\lib\runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "C:\Users\jeaco\Anaconda3\envs\dash\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "c:/Users/jeaco/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/printEnvVariables.py", line 7, in <module>
print(json.dumps(dict(os.environ)))
File "C:\Users\jeaco\Anaconda3\envs\dash\lib\json\__init__.py", line 244, in dumps
return _default_encoder.encode(obj)
File "C:\Users\jeaco\Anaconda3\envs\dash\lib\json\encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Users\jeaco\Anaconda3\envs\dash\lib\json\encoder.py", line 270, in iterencode
return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xd8 in position 26: invalid continuation byte
at ChildProcess.exithandler (child_process.js:304:12)
at ChildProcess.emit (events.js:223:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)] {
killed: false,
code: 1,
signal: null,
cmd: "C:/Users/jeaco/Anaconda3/Scripts/activate && conda activate dash && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:\\Users\\jeaco\\.vscode\\extensions\\ms-python.python-2020.12.424452561\\pythonFiles\\pyvsc-run-isolated.py c:/Users/jeaco/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/printEnvVariables.py",
vslsStack: [ CallSite {}, CallSite {}, CallSite {}, CallSite {} ]
}
> ~\Anaconda3\envs\e2d\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> ~\Anaconda3\envs\sutokura\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> ~\Anaconda3\envs\e2d\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> ~\Anaconda3\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> ~\Anaconda3\envs\sutokura\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> ~\Anaconda3\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> ~\Anaconda3\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
Started kernel Python 3
> ~\Anaconda3\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
> ~\Anaconda3\envs\sutokura\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> ~\Anaconda3\envs\sutokura\python.exe c:\Users\jeaco\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:14 (6 by maintainers)
Top GitHub Comments
We have been making changes in both the python extension and the jupyter extension to fix this sort of thing lately. It all depends upon what version you had before I guess. I’ll close this issue since it seems like it resolved itself.
What version is the Jupyter extension?
Additionally we’d need the ‘Jupyter’ output tab data. It should list what the command was that we ran to start the kernel.
My guess is that
Python 3.9.2 64-bit (sutokora: conda)
shares a kernelspec with something else and when we launch the kernel it’s finding the something else instead.For example the kernelspec might look like this:
The ‘python’ argument is ambiguous.
But we’d need the output to determine if that’s the case.
The jupyter extension version would be helpful too. We’ve made some fixes around this lately.