anaconda / nb_conda_kernels

Package for managing conda environment-based kernels inside of Jupyter
BSD 3-Clause "New" or "Revised" License
601 stars 70 forks source link

Failed to change to virtual environment kernel with [Python conda envs: xxx] prefix #212

Closed Beliefuture closed 8 months ago

Beliefuture commented 3 years ago

When I want to change the kernel into a virtual environment through the panel and choose the prefix Python: [conda envs:xxx] one, it just can't work and print the following error message.

image

'"C:\Users\Z�-LE~1\AppData\Local\TEMP_~1\tmp6dbccs_p.bat"' is not recognized as an internal or external command,
operable program or batch file.
Could Not Find C:\Users\Z�-LE~1\AppData\Local\TEMP_~1\tmp6dbccs_p.bat
Traceback (most recent call last):
  File "E:\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "E:\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\Anaconda3\lib\site-packages\nb_conda_kernels\runner.py", line 72, in <module>
    exec_in_env(*(sys.argv[1:]))
  File "E:\Anaconda3\lib\site-packages\nb_conda_kernels\runner.py", line 40, in exec_in_env
    env = check_output(ecomm, shell=is_win).decode(encoding)
UnicodeDecodeError: 'gbk' codec can't decode byte 0x9c in position 77: illegal multibyte sequence
[I 14:09:09.917 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
The system cannot find the path specified.
'"C:\Users\Z�-LE~1\AppData\Local\TEMP_~1\tmpbpt0puxm.bat"' is not recognized as an internal or external command,
operable program or batch file.
Could Not Find C:\Users\Z�-LE~1\AppData\Local\TEMP_~1\tmpbpt0puxm.bat
Traceback (most recent call last):
  File "E:\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "E:\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\Anaconda3\lib\site-packages\nb_conda_kernels\runner.py", line 72, in <module>
    exec_in_env(*(sys.argv[1:]))
  File "E:\Anaconda3\lib\site-packages\nb_conda_kernels\runner.py", line 40, in exec_in_env
    env = check_output(ecomm, shell=is_win).decode(encoding)
UnicodeDecodeError: 'gbk' codec can't decode byte 0x9c in position 77: illegal multibyte sequence
[I 14:09:12.946 NotebookApp] KernelRestarter: restarting kernel (2/5), keep random ports
The system cannot find the path specified.
'"C:\Users\Z�-LE~1\AppData\Local\TEMP_~1\tmpxrqt2bbb.bat"' is not recognized as an internal or external command,
operable program or batch file.
Could Not Find C:\Users\Z�-LE~1\AppData\Local\TEMP_~1\tmpxrqt2bbb.bat
Traceback (most recent call last):
  File "E:\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "E:\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\Anaconda3\lib\site-packages\nb_conda_kernels\runner.py", line 72, in <module>
    exec_in_env(*(sys.argv[1:]))
  File "E:\Anaconda3\lib\site-packages\nb_conda_kernels\runner.py", line 40, in exec_in_env
    env = check_output(ecomm, shell=is_win).decode(encoding)
UnicodeDecodeError: 'gbk' codec can't decode byte 0x9c in position 77: illegal multibyte sequence
[I 14:09:15.976 NotebookApp] KernelRestarter: restarting kernel (3/5), keep random ports
The system cannot find the path specified.
'"C:\Users\Z�-LE~1\AppData\Local\TEMP_~1\tmpkxkxs0gz.bat"' is not recognized as an internal or external command,
operable program or batch file.
Could Not Find C:\Users\Z�-LE~1\AppData\Local\TEMP_~1\tmpkxkxs0gz.bat
Traceback (most recent call last):
  File "E:\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "E:\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\Anaconda3\lib\site-packages\nb_conda_kernels\runner.py", line 72, in <module>
    exec_in_env(*(sys.argv[1:]))
  File "E:\Anaconda3\lib\site-packages\nb_conda_kernels\runner.py", line 40, in exec_in_env
    env = check_output(ecomm, shell=is_win).decode(encoding)
UnicodeDecodeError: 'gbk' codec can't decode byte 0x9c in position 77: illegal multibyte sequence
But when I choose the not Python: [conda envs:xxx] prefix that points out to the same environment which I rename, it can find the kernel. The two red blocks point to the same virtual environment py36.

Desktop (please complete the following information):

OS: windows 10 Browser: Edge

mcg1969 commented 8 months ago

I'm sorry we didn't get to this way back when. I'm closing this as stale but if you can offer a modern reproduction (new versions of conda, jupyter, nb_conda_kernels, etc.) please feel free to re-open or create a new issue