Solve the error of jupyter labextension install

Jupyter Lab plug-in installation

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# Query the installed extension
jupyter labextension list
# Install the corresponding extension from the command line jupyter labextension install @jupyterlab/git
jupyter labextension install @jupyterlab/github
jupyter labextension install @jupyterlab/debugger
jupyter labextension install @krassowski/jupyterlab-lsp
jupyter labextension install @lckr /jupyterlab_variableinspector
# Or directly install through the jupyter lab plug-in management # Enter the jupyter interface and click the plug-in icon # Search the corresponding plug-in name in the search bar, such as jupytext, you can install the plug-in directly # Delete the extension jupyter labextension uninstall my-extension
# Query the installed extension jupyter labextension list # Install the corresponding extension from the command line jupyter labextension install @jupyterlab/git jupyter labextension install @jupyterlab/github jupyter labextension install @jupyterlab/debugger jupyter labextension install @krassowski/jupyterlab-lsp jupyter labextension install @lckr /jupyterlab_variableinspector # Or directly install through the jupyter lab plug-in management # Enter the jupyter interface and click the plug-in icon # Search the corresponding plug-in name in the search bar, such as jupytext, you can install the plug-in directly # Delete the extension jupyter labextension uninstall my-extension
# Query the installed extension
 jupyter labextension list
 # Install the corresponding extension from the command line jupyter labextension install @jupyterlab/git
 jupyter labextension install @jupyterlab/github
 jupyter labextension install @jupyterlab/debugger
 jupyter labextension install @krassowski/jupyterlab-lsp
 jupyter labextension install @lckr /jupyterlab_variableinspector
 # Or directly install through the jupyter lab plug-in management # Enter the jupyter interface and click the plug-in icon # Search the corresponding plug-in name in the search bar, such as jupytext, you can install the plug-in directly # Delete the extension jupyter labextension uninstall my-extension






 

Plug-in recommendation

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
jupyterlab_code_formatter automatic formatting code
jupytext ipynb\py\md file conversion
jupyterlab_spellchecker markdown spelling check
@krassowski/jupyterlab-lsp automatic completion and jump definition
@jupyterlab/github
@jupyterlab/git
jupyterlab_code_formatter automatic formatting code jupytext ipynb\py\md file conversion jupyterlab_spellchecker markdown spelling check @krassowski/jupyterlab-lsp automatic completion and jump definition @jupyterlab/github @jupyterlab/git
jupyterlab_code_formatter automatic formatting code   
 jupytext ipynb\py\md file conversion
 jupyterlab_spellchecker markdown spelling check
 @krassowski/jupyterlab-lsp automatic completion and jump definition
 @jupyterlab/github         
 @jupyterlab/git

 

Error message during installation

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
λ jupyter labextension install @jupyterlab/toc
Building jupyterlab assets (build:prod:minimize)
|Exception in thread Thread-10:
Traceback (most recent call last):
File "e:\python\python36\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "e:\python\python36\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "e:\python\python36\lib\subprocess.py", line 1083, in _readerthread
buffer.append(fh.read())
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 281: illegal multibyte sequence
An error occured.
IndexError: list index out of range
See the log file for details: C:\Users\*****\AppData\Local\Temp\jupyterlab-debug-kx1tois9.log
λ jupyter labextension install @jupyterlab/toc Building jupyterlab assets (build:prod:minimize) |Exception in thread Thread-10: Traceback (most recent call last): File "e:\python\python36\lib\threading.py", line 916, in _bootstrap_inner self.run() File "e:\python\python36\lib\threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "e:\python\python36\lib\subprocess.py", line 1083, in _readerthread buffer.append(fh.read()) UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 281: illegal multibyte sequence An error occured. IndexError: list index out of range See the log file for details: C:\Users\*****\AppData\Local\Temp\jupyterlab-debug-kx1tois9.log
λ jupyter labextension install @jupyterlab/toc
Building jupyterlab assets (build:prod:minimize)
|Exception in thread Thread-10:
Traceback (most recent call last):
  File "e:\python\python36\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "e:\python\python36\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "e:\python\python36\lib\subprocess.py", line 1083, in _readerthread
    buffer.append(fh.read())
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 281: illegal multibyte sequence

An error occured.
IndexError: list index out of range
See the log file for details:  C:\Users\*****\AppData\Local\Temp\jupyterlab-debug-kx1tois9.log

Mainly this sentence:UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 281: illegal multibyte sequence

Solution

Find the lib\site-packages\jupyterlab\commands.py file in
the python installation directory, line 83:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
self.proc = self._create_process(
cwd=cwd,
env=env,
stderr=subprocess.STDOUT,
stdout=subprocess.PIPE,
universal_newlines=True
)
self.proc = self._create_process( cwd=cwd, env=env, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, universal_newlines=True )
   self.proc = self._create_process(
        cwd=cwd,
        env=env,
        stderr=subprocess.STDOUT,
        stdout=subprocess.PIPE,
        universal_newlines=True
    )

change into:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
self.proc = self._create_process(
cwd=cwd,
env=env,
stderr=subprocess.STDOUT,
stdout=subprocess.PIPE,
universal_newlines=True,
encoding="UTF-8"
)
self.proc = self._create_process( cwd=cwd, env=env, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, universal_newlines=True, encoding="UTF-8" )
    self.proc = self._create_process(
        cwd=cwd,
        env=env,
        stderr=subprocess.STDOUT,
        stdout=subprocess.PIPE,
        universal_newlines=True,
        encoding="UTF-8"
    )

That is, add a parameter encoding=”UTF-8″, and that’s it.

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *