jupyter-lsp / jupyterlab-lsp

Coding assistance for JupyterLab (code navigation + hover suggestions + linters + autocompletion + rename) using Language Server Protocol
https://jupyterlab-lsp.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.81k stars 149 forks source link

Auto completion crashes when two python modules are imported using the same name. #729

Closed xenore78 closed 2 years ago

xenore78 commented 2 years ago

Description

Auto completion feature stops working if I import two different python modules as the same name. For example, when I run the following codes in a Jupyter notebook,

> import numpy as n
> a = {'2' : '333'}
> a.items()       # Auto completion works when I type the dot(.)
dict_items([('2', '333')])
> import pandas as n
> a.clear()       # Unless I access the name 'n', auto completion still works when I type the dot
> n.__version__   # Now auto completion stop working!
'1.3.4'

If I try to invoke the auto completion feature by press 'tab' key repeatedly, some error messages saying 'broken pipe' appear in the log of the Jupyter lab.

Restarting the python kernel does not resolve the problem. It never works again unless I refresh the webpage displaying the Jupyter lab. After the refreshing, auto completion works but when I try to access the duplicated name 'n', it stops again. In this case, error messages in the log are just for jedi when I hit the tab key.

Edited: LSP status indicator on the Jupyter Lab screen always remains green(initialized).

lsp_status@jupyterlab
(base) root@fdf3cce460e1:/# conda list |grep lsp
jupyter-lsp               1.5.1              pyhd8ed1ab_0    conda-forge
jupyter-lsp-python        1.5.1              pyhd8ed1ab_0    conda-forge
jupyterlab-lsp            3.9.3              pyhd8ed1ab_0    conda-forge
python-lsp-black          1.0.0              pyhd3eb1b0_0  
python-lsp-jsonrpc        1.0.0              pyhd3eb1b0_0  
python-lsp-server         1.2.4              pyhd3eb1b0_0  

Reproduce

Expected behavior

Context

Edited : language server

(base) root@fdf3cce460e1:/# conda list |grep lsp
jupyter-lsp               1.5.1              pyhd8ed1ab_0    conda-forge
jupyter-lsp-python        1.5.1              pyhd8ed1ab_0    conda-forge
jupyterlab-lsp            3.9.3              pyhd8ed1ab_0    conda-forge
python-lsp-black          1.0.0              pyhd3eb1b0_0  
python-lsp-jsonrpc        1.0.0              pyhd3eb1b0_0  
python-lsp-server         1.2.4              pyhd3eb1b0_0  
Required: installed server extensions
config dir: ...
    jupyter_lsp 1.5.1
    jupyterlab 3.2.1
    jupyterlab_git 0.34.0
    nbdime 3.1.1
Required: installed lab extensions
/root/anaconda3/share/jupyter/labextensions
    jupyterlab-execute-time v2.1.0
    nbdime-jupyterlab v2.1.1
    @jupyter-widgets/jupyterlab-manager v3.0.0
    @krassowski/jupyterlab-lsp v3.9.3
    @jupyterlab/git v0.34.0
Other labextensions (built into JupyterLab)
    @jupyterlab/latex v3.0.0
    @telamonian/theme-darcula v3.1.1
    @yudai-nkt/jupyterlab_city-lights-theme v3.0.0
    jupyterlab-theme-solarized-dark v2.0.1
Troubleshoot Output
Paste the output from running `jupyter troubleshoot` from the command line here.
You may want to sanitize the paths in the output.
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
## output from command line, when the error occurs and I hit 'ctrl-c' to try to stop the server: ``` Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 727, in tree_name_to_values types = context.predefined_names[node][tree_name.value] KeyError: During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/root/anaconda3/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/root/anaconda3/lib/python3.9/site-packages/pylsp/__main__.py", line 120, in main() File "/root/anaconda3/lib/python3.9/site-packages/pylsp/__main__.py", line 77, in main start_io_lang_server(stdin, stdout, args.check_parent_process, File "/root/anaconda3/lib/python3.9/site-packages/pylsp/python_lsp.py", line 91, in start_io_lang_server server.start() File "/root/anaconda3/lib/python3.9/site-packages/pylsp/python_lsp.py", line 118, in start self._jsonrpc_stream_reader.listen(self._endpoint.consume) File "/root/anaconda3/lib/python3.9/site-packages/pylsp_jsonrpc/streams.py", line 40, in listen message_consumer(json.loads(request_str.decode('utf-8'))) File "/root/anaconda3/lib/python3.9/site-packages/pylsp_jsonrpc/endpoint.py", line 116, in consume self._handle_request(message['id'], message['method'], message.get('params')) File "/root/anaconda3/lib/python3.9/site-packages/pylsp_jsonrpc/endpoint.py", line 185, in _handle_request handler_result = handler(params) File "/root/anaconda3/lib/python3.9/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler return method(**(params or {})) File "/root/anaconda3/lib/python3.9/site-packages/pylsp/python_lsp.py", line 356, in m_text_document__document_highlight return self.highlight(textDocument['uri'], position) File "/root/anaconda3/lib/python3.9/site-packages/pylsp/python_lsp.py", line 287, in highlight return flatten(self._hook('pylsp_document_highlight', doc_uri, position=position)) or None File "/root/anaconda3/lib/python3.9/site-packages/pylsp/python_lsp.py", line 156, in _hook return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__ return self._hookexec(self, self.get_hookimpls(), kwargs) File "/root/anaconda3/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec return self._inner_hookexec(hook, methods, kwargs) File "/root/anaconda3/lib/python3.9/site-packages/pluggy/manager.py", line 337, in traced_hookexec return outcome.get_result() File "/root/anaconda3/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result raise ex[1].with_traceback(ex[2]) File "/root/anaconda3/lib/python3.9/site-packages/pluggy/callers.py", line 52, in from_call result = func() File "/root/anaconda3/lib/python3.9/site-packages/pluggy/manager.py", line 335, in outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs)) File "/root/anaconda3/lib/python3.9/site-packages/pluggy/manager.py", line 84, in self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall( File "/root/anaconda3/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall return outcome.get_result() File "/root/anaconda3/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result raise ex[1].with_traceback(ex[2]) File "/root/anaconda3/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall res = hook_impl.function(*args) File "/root/anaconda3/lib/python3.9/site-packages/pylsp/plugins/highlight.py", line 13, in pylsp_document_highlight usages = document.jedi_script().get_references(**code_position) File "/root/anaconda3/lib/python3.9/site-packages/jedi/api/helpers.py", line 488, in wrapper return func(self, line, column, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/api/__init__.py", line 417, in get_references return _references(**kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/api/__init__.py", line 411, in _references names = find_references(self._get_module_context(), tree_name, scope == 'file') File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/references.py", line 147, in find_references new = _dictionarize(_find_names(module_context, name_leaf)) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/references.py", line 74, in _find_names found_names = set(name.goto()) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/names.py", line 205, in goto values = infer_call_of_leaf(context, name, cut_own_trailer=True) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/helpers.py", line 104, in infer_call_of_leaf values = context.infer_node(base) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/context.py", line 222, in infer_node return infer_node(self, node) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 156, in infer_node return _infer_node_if_inferred(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 169, in _infer_node_if_inferred return _infer_node_cached(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/cache.py", line 44, in wrapper rv = function(obj, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 174, in _infer_node_cached return _infer_node(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/debug.py", line 81, in wrapper return func(*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 82, in wrapper return func(context, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 184, in _infer_node return infer_atom(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 304, in infer_atom return context.py__getattribute__(atom, position=position) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/context.py", line 75, in py__getattribute__ values = ValueSet.from_sets(name.infer() for name in names) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 426, in from_sets for set_ in sets: File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/context.py", line 75, in values = ValueSet.from_sets(name.infer() for name in names) File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/__init__.py", line 21, in wrapper return built_functions[public_name](*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/pytest.py", line 62, in wrapper return func(param_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/names.py", line 519, in infer values = dynamic_param_lookup(self.function_value, param.position_index) File "/root/anaconda3/lib/python3.9/site-packages/jedi/debug.py", line 81, in wrapper return func(*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/dynamic_params.py", line 47, in wrapper return func(function_value, param_index) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/dynamic_params.py", line 92, in dynamic_param_lookup values = ValueSet.from_sets( File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 426, in from_sets for set_ in sets: File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/dynamic_params.py", line 93, in get_executed_param_names( File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/param.py", line 28, in infer return self._lazy_value.infer() File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/lazy_value.py", line 48, in infer return self.context.infer_node(self.data) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/context.py", line 222, in infer_node return infer_node(self, node) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 156, in infer_node return _infer_node_if_inferred(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 169, in _infer_node_if_inferred return _infer_node_cached(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/cache.py", line 44, in wrapper rv = function(obj, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 174, in _infer_node_cached return _infer_node(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/debug.py", line 81, in wrapper return func(*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 82, in wrapper return func(context, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 184, in _infer_node return infer_atom(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 304, in infer_atom return context.py__getattribute__(atom, position=position) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/context.py", line 75, in py__getattribute__ values = ValueSet.from_sets(name.infer() for name in names) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 426, in from_sets for set_ in sets: File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/context.py", line 75, in values = ValueSet.from_sets(name.infer() for name in names) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/names.py", line 281, in infer return tree_name_to_values( File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/__init__.py", line 21, in wrapper return built_functions[public_name](*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/stdlib.py", line 867, in wrapper return func(inference_state, context, tree_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/django.py", line 177, in wrapper result = func(inference_state, context, tree_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 738, in tree_name_to_values types = infer_expr_stmt(context, node, tree_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 82, in wrapper return func(context, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 376, in infer_expr_stmt return _infer_expr_stmt(context, stmt, seek_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/debug.py", line 81, in wrapper return func(*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 421, in _infer_expr_stmt left_values = context.py__getattribute__(name, position=stmt.start_pos) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/context.py", line 75, in py__getattribute__ values = ValueSet.from_sets(name.infer() for name in names) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 426, in from_sets for set_ in sets: File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/context.py", line 75, in values = ValueSet.from_sets(name.infer() for name in names) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/names.py", line 281, in infer return tree_name_to_values( File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/__init__.py", line 21, in wrapper return built_functions[public_name](*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/stdlib.py", line 867, in wrapper return func(inference_state, context, tree_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/django.py", line 177, in wrapper result = func(inference_state, context, tree_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 738, in tree_name_to_values types = infer_expr_stmt(context, node, tree_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 82, in wrapper return func(context, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 376, in infer_expr_stmt return _infer_expr_stmt(context, stmt, seek_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/debug.py", line 81, in wrapper return func(*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 409, in _infer_expr_stmt value_set = context.infer_node(rhs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/context.py", line 222, in infer_node return infer_node(self, node) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 156, in infer_node return _infer_node_if_inferred(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 169, in _infer_node_if_inferred return _infer_node_cached(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/cache.py", line 44, in wrapper rv = function(obj, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 174, in _infer_node_cached return _infer_node(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/debug.py", line 81, in wrapper return func(*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 82, in wrapper return func(context, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 254, in _infer_node return infer_or_test(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 478, in infer_or_test context.infer_node(right)) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/context.py", line 222, in infer_node return infer_node(self, node) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 156, in infer_node return _infer_node_if_inferred(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 169, in _infer_node_if_inferred return _infer_node_cached(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/cache.py", line 44, in wrapper rv = function(obj, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 174, in _infer_node_cached return _infer_node(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/debug.py", line 81, in wrapper return func(*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 82, in wrapper return func(context, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 184, in _infer_node return infer_atom(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 304, in infer_atom return context.py__getattribute__(atom, position=position) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/context.py", line 75, in py__getattribute__ values = ValueSet.from_sets(name.infer() for name in names) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 426, in from_sets for set_ in sets: File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/context.py", line 75, in values = ValueSet.from_sets(name.infer() for name in names) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/names.py", line 281, in infer return tree_name_to_values( File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/__init__.py", line 21, in wrapper return built_functions[public_name](*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/stdlib.py", line 867, in wrapper return func(inference_state, context, tree_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/django.py", line 177, in wrapper result = func(inference_state, context, tree_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 730, in tree_name_to_values for_types = iterate_values( File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 308, in iterate_values return ValueSet.from_sets( File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 426, in from_sets for set_ in sets: File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 308, in return ValueSet.from_sets( File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 476, in iterate type_iters = [c.iterate(contextualized_node, is_async=is_async) for c in self._set] File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 476, in type_iters = [c.iterate(contextualized_node, is_async=is_async) for c in self._set] File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 116, in iterate return self.py__iter__(contextualized_node) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/value/instance.py", line 252, in py__iter__ iter_slot_names = self.get_function_slot_names('__iter__') File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/value/instance.py", line 302, in get_function_slot_names for filter in self.get_filters(include_self_names=False): File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/value/instance.py", line 178, in get_filters class_value = self.get_annotated_class_object() File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/value/instance.py", line 352, in get_annotated_class_object return self._get_annotated_class_object() or self.class_value File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/cache.py", line 44, in wrapper rv = function(obj, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/value/instance.py", line 336, in _get_annotated_class_object or not signature.matches_signature(args): File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/signature.py", line 109, in matches_signature matches = all(executed_param_name.matches_signature() File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/signature.py", line 109, in matches = all(executed_param_name.matches_signature() File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/param.py", line 33, in matches_signature argument_values = self.infer().py__class__() File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/param.py", line 28, in infer return self._lazy_value.infer() File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/lazy_value.py", line 48, in infer return self.context.infer_node(self.data) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/context.py", line 222, in infer_node return infer_node(self, node) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 156, in infer_node return _infer_node_if_inferred(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 169, in _infer_node_if_inferred return _infer_node_cached(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/cache.py", line 44, in wrapper rv = function(obj, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 174, in _infer_node_cached return _infer_node(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/debug.py", line 81, in wrapper return func(*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 82, in wrapper return func(context, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 184, in _infer_node return infer_atom(context, element) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 304, in infer_atom return context.py__getattribute__(atom, position=position) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/context.py", line 75, in py__getattribute__ values = ValueSet.from_sets(name.infer() for name in names) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 426, in from_sets for set_ in sets: File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/context.py", line 75, in values = ValueSet.from_sets(name.infer() for name in names) File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/__init__.py", line 21, in wrapper return built_functions[public_name](*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/pytest.py", line 62, in wrapper return func(param_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/names.py", line 519, in infer values = dynamic_param_lookup(self.function_value, param.position_index) File "/root/anaconda3/lib/python3.9/site-packages/jedi/debug.py", line 81, in wrapper return func(*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/dynamic_params.py", line 47, in wrapper return func(function_value, param_index) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/dynamic_params.py", line 91, in dynamic_param_lookup arguments_list = _search_function_arguments(module_context, funcdef, string_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/cache.py", line 44, in wrapper rv = function(obj, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/utils.py", line 16, in wrapper return list(func(*args, **kwargs)) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/dynamic_params.py", line 128, in _search_function_arguments for for_mod_context in module_contexts: File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/references.py", line 273, in get_module_contexts_containing_name yield from search_in_file_ios(inference_state, file_io_iterator, name, File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/references.py", line 283, in search_in_file_ios for file_io in file_io_iterator: File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/references.py", line 246, in _find_python_files_in_sys_path for file_io in recurse_find_python_files(folder_io, except_paths): File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/references.py", line 227, in recurse_find_python_files for folder_io, file_io in recurse_find_python_folders_and_files(folder_io, except_paths): File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/references.py", line 203, in recurse_find_python_folders_and_files for root_folder_io, folder_ios, file_ios in folder_io.walk(): File "/root/anaconda3/lib/python3.9/site-packages/jedi/file_io.py", line 40, in walk for root, dirs, files in os.walk(self.path): File "/root/anaconda3/lib/python3.9/os.py", line 418, in _walk yield from _walk(new_path, topdown, onerror, followlinks) File "/root/anaconda3/lib/python3.9/os.py", line 418, in _walk yield from _walk(new_path, topdown, onerror, followlinks) File "/root/anaconda3/lib/python3.9/os.py", line 418, in _walk yield from _walk(new_path, topdown, onerror, followlinks) [Previous line repeated 6 more times] File "/root/anaconda3/lib/python3.9/os.py", line 367, in _walk entry = next(scandir_it) ``` ## output from command line, when I raise the error intentionally after reloading the webpage: ``` 2021-12-22 00:24:01,327 UTC - ERROR - pylsp_jsonrpc.endpoint - Failed to handle request 20 Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/jedi/api/completion_cache.py", line 21, in _get_from_cache return _cache[module_name][name][number] KeyError: 'read_stata' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/parso/cache.py", line 122, in load_module module_cache_item = parser_cache[hashed_grammar][file_io.path] KeyError: PosixPath('/root/anaconda3/lib/python3.9/site-packages/pandas/io/stata.py') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/pylsp_jsonrpc/endpoint.py", line 116, in consume self._handle_request(message['id'], message['method'], message.get('params')) File "/root/anaconda3/lib/python3.9/site-packages/pylsp_jsonrpc/endpoint.py", line 185, in _handle_request handler_result = handler(params) File "/root/anaconda3/lib/python3.9/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler return method(**(params or {})) File "/root/anaconda3/lib/python3.9/site-packages/pylsp/python_lsp.py", line 350, in m_text_document__completion return self.completions(textDocument['uri'], position) File "/root/anaconda3/lib/python3.9/site-packages/pylsp/python_lsp.py", line 261, in completions completions = self._hook('pylsp_completions', doc_uri, position=position) File "/root/anaconda3/lib/python3.9/site-packages/pylsp/python_lsp.py", line 156, in _hook return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__ return self._hookexec(self, self.get_hookimpls(), kwargs) File "/root/anaconda3/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec return self._inner_hookexec(hook, methods, kwargs) File "/root/anaconda3/lib/python3.9/site-packages/pluggy/manager.py", line 337, in traced_hookexec return outcome.get_result() File "/root/anaconda3/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result raise ex[1].with_traceback(ex[2]) File "/root/anaconda3/lib/python3.9/site-packages/pluggy/callers.py", line 52, in from_call result = func() File "/root/anaconda3/lib/python3.9/site-packages/pluggy/manager.py", line 335, in outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs)) File "/root/anaconda3/lib/python3.9/site-packages/pluggy/manager.py", line 84, in self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall( File "/root/anaconda3/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall return outcome.get_result() File "/root/anaconda3/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result raise ex[1].with_traceback(ex[2]) File "/root/anaconda3/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall res = hook_impl.function(*args) File "/root/anaconda3/lib/python3.9/site-packages/pylsp/plugins/jedi_completion.py", line 68, in pylsp_completions ready_completions = [ File "/root/anaconda3/lib/python3.9/site-packages/pylsp/plugins/jedi_completion.py", line 69, in _format_completion( File "/root/anaconda3/lib/python3.9/site-packages/pylsp/plugins/jedi_completion.py", line 181, in _format_completion 'kind': _TYPE_MAP.get(d.type), File "/root/anaconda3/lib/python3.9/site-packages/jedi/api/classes.py", line 713, in type return completion_cache.get_type( File "/root/anaconda3/lib/python3.9/site-packages/jedi/api/completion_cache.py", line 23, in _get_from_cache v = get_cache_values() File "/root/anaconda3/lib/python3.9/site-packages/jedi/api/classes.py", line 716, in lambda: self._get_cache() File "/root/anaconda3/lib/python3.9/site-packages/jedi/api/classes.py", line 701, in _get_cache super().type, File "/root/anaconda3/lib/python3.9/site-packages/jedi/api/classes.py", line 187, in type for value in self._name.infer(): File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/names.py", line 281, in infer return tree_name_to_values( File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/__init__.py", line 21, in wrapper return built_functions[public_name](*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/stdlib.py", line 867, in wrapper return func(inference_state, context, tree_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/django.py", line 177, in wrapper result = func(inference_state, context, tree_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 744, in tree_name_to_values types = imports.infer_import(context, tree_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/cache.py", line 44, in wrapper rv = function(obj, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/imports.py", line 57, in infer_import values = values.py__getattribute__( File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 492, in py__getattribute__ return ValueSet.from_sets(c.py__getattribute__(*args, **kwargs) for c in self._set) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 426, in from_sets for set_ in sets: File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 492, in return ValueSet.from_sets(c.py__getattribute__(*args, **kwargs) for c in self._set) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 80, in py__getattribute__ values = ValueSet.from_sets(name.infer() for name in names) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 426, in from_sets for set_ in sets: File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 80, in values = ValueSet.from_sets(name.infer() for name in names) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/names.py", line 281, in infer return tree_name_to_values( File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/__init__.py", line 21, in wrapper return built_functions[public_name](*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/stdlib.py", line 867, in wrapper return func(inference_state, context, tree_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/django.py", line 177, in wrapper result = func(inference_state, context, tree_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/syntax_tree.py", line 744, in tree_name_to_values types = imports.infer_import(context, tree_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/cache.py", line 44, in wrapper rv = function(obj, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/imports.py", line 53, in infer_import _prepare_infer_import(module_context, tree_name) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/imports.py", line 116, in _prepare_infer_import return from_import_name, tuple(import_path), import_node.level, importer.follow() File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/imports.py", line 296, in follow return import_module_by_names( File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/imports.py", line 376, in import_module_by_names value_set = ValueSet.from_sets([ File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/imports.py", line 377, in import_module( File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/__init__.py", line 21, in wrapper return built_functions[public_name](*args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/plugins/flask.py", line 20, in wrapper return callback(inference_state, import_names, module_context, *args, **kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/gradual/typeshed.py", line 117, in wrapper python_value_set = ValueSet.from_sets( File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/base_value.py", line 426, in from_sets for set_ in sets: File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/gradual/typeshed.py", line 118, in func(inference_state, import_names, p, sys_path,) File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/imports.py", line 453, in import_module module = _load_python_module( File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/imports.py", line 468, in _load_python_module module_node = inference_state.parse( File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/__init__.py", line 200, in parse return self.parse_and_get_code(*args, **kwargs)[0] File "/root/anaconda3/lib/python3.9/site-packages/jedi/inference/__init__.py", line 197, in parse_and_get_code return grammar.parse(code=code, path=path, file_io=file_io, **kwargs), code File "/root/anaconda3/lib/python3.9/site-packages/parso/grammar.py", line 114, in parse module_node = load_module(self._hashed, file_io, cache_path=cache_path) File "/root/anaconda3/lib/python3.9/site-packages/parso/cache.py", line 127, in load_module return _load_from_file_system( File "/root/anaconda3/lib/python3.9/site-packages/parso/cache.py", line 145, in _load_from_file_system module_cache_item = pickle.load(f) EOFError: Ran out of input ``` ## output from command line (using '--debug' option): - when the auto completion fails for the first time ``` [D 2021-12-22 00:58:39.609 ServerApp] 200 GET /api/sessions?1640134278358 (124.10.100.202) 1.89ms [D 2021-12-22 00:58:40.253 ServerApp] 200 GET /api/kernels?1640134279002 (124.10.100.202) 1.39ms [D 2021-12-22 00:58:40.255 ServerApp] 200 GET /api/terminals?1640134279003 (124.10.100.202) 1.00ms [D 2021-12-22 00:58:41.576 ServerApp] [pylsp] Handling a message [E 2021-12-22 00:58:41.577 ServerApp] )> couldn't write message: Content-Length: 241 {"jsonrpc":"2.0","id":66,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///home/workspace/.virtual_documents/shared@N1/worksheets/2021/PyTorch/2021.12./Untitled1.ipynb"},"position":{"line":12,"character":2}}} Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 193, in write await convert_yielded(self._write_one(response.encode("utf-8"))) File "/root/anaconda3/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 201, in _write_one self.stream.write(message) BrokenPipeError: [Errno 32] Broken pipe [D 2021-12-22 00:58:41.960 ServerApp] [pylsp] Handling a message [E 2021-12-22 00:58:41.962 ServerApp] )> couldn't write message: Content-Length: 241 {"jsonrpc":"2.0","id":67,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///home/workspace/.virtual_documents/shared@N1/worksheets/2021/PyTorch/2021.12./Untitled1.ipynb"},"position":{"line":12,"character":0}}} Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 193, in write await convert_yielded(self._write_one(response.encode("utf-8"))) File "/root/anaconda3/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 201, in _write_one self.stream.write(message) BrokenPipeError: [Errno 32] Broken pipe [D 2021-12-22 00:58:43.020 ServerApp] 200 GET /api/contents/shared%40N1/worksheets/2021/PyTorch/2021.12.?content=1&1640134281750 (124.10.100.202) 20.10ms [D 2021-12-22 00:58:43.259 ServerApp] [pylsp] Handling a message [E 2021-12-22 00:58:43.261 ServerApp] )> couldn't write message: Content-Length: 241 {"jsonrpc":"2.0","id":68,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///home/workspace/.virtual_documents/shared@N1/worksheets/2021/PyTorch/2021.12./Untitled1.ipynb"},"position":{"line":12,"character":2}}} Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 193, in write await convert_yielded(self._write_one(response.encode("utf-8"))) File "/root/anaconda3/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 201, in _write_one self.stream.write(message) BrokenPipeError: [Errno 32] Broken pipe [D 2021-12-22 00:58:43.313 ServerApp] [pylsp] Handling a message [E 2021-12-22 00:58:43.315 ServerApp] )> couldn't write message: Content-Length: 335 {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///home/workspace/.virtual_documents/shared@N1/worksheets/2021/PyTorch/2021.12./Untitled1.ipynb","version":53},"contentChanges":[{"text":"import numpy as n\n\n\na = {'2':'333'}\n\n\na.items()\n\n\nimport pandas as n\n\n\na\n\n\n__version__\n"}]}} Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 193, in write await convert_yielded(self._write_one(response.encode("utf-8"))) File "/root/anaconda3/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 201, in _write_one self.stream.write(message) BrokenPipeError: [Errno 32] Broken pipe [D 2021-12-22 00:58:43.446 ServerApp] [pylsp] Handling a message [E 2021-12-22 00:58:43.448 ServerApp] )> couldn't write message: Content-Length: 334 {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///home/workspace/.virtual_documents/shared@N1/worksheets/2021/PyTorch/2021.12./Untitled1.ipynb","version":54},"contentChanges":[{"text":"import numpy as n\n\n\na = {'2':'333'}\n\n\na.items()\n\n\nimport pandas as n\n\n\n\n\n\n__version__\n"}]}} Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 193, in write await convert_yielded(self._write_one(response.encode("utf-8"))) File "/root/anaconda3/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 201, in _write_one self.stream.write(message) BrokenPipeError: [Errno 32] Broken pipe [D 2021-12-22 00:58:43.596 ServerApp] [pylsp] Handling a message [E 2021-12-22 00:58:43.598 ServerApp] )> couldn't write message: Content-Length: 335 {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///home/workspace/.virtual_documents/shared@N1/worksheets/2021/PyTorch/2021.12./Untitled1.ipynb","version":55},"contentChanges":[{"text":"import numpy as n\n\n\na = {'2':'333'}\n\n\na.items()\n\n\nimport pandas as n\n\n\na\n\n\n__version__\n"}]}} Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 193, in write await convert_yielded(self._write_one(response.encode("utf-8"))) File "/root/anaconda3/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 201, in _write_one self.stream.write(message) BrokenPipeError: [Errno 32] Broken pipe [D 2021-12-22 00:58:43.689 ServerApp] [pylsp] Handling a message [E 2021-12-22 00:58:43.692 ServerApp] )> couldn't write message: Content-Length: 336 {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///home/workspace/.virtual_documents/shared@N1/worksheets/2021/PyTorch/2021.12./Untitled1.ipynb","version":56},"contentChanges":[{"text":"import numpy as n\n\n\na = {'2':'333'}\n\n\na.items()\n\n\nimport pandas as n\n\n\na.\n\n\n__version__\n"}]}} Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 193, in write await convert_yielded(self._write_one(response.encode("utf-8"))) File "/root/anaconda3/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 201, in _write_one self.stream.write(message) BrokenPipeError: [Errno 32] Broken pipe [D 2021-12-22 00:58:43.702 ServerApp] [pylsp] Handling a message [E 2021-12-22 00:58:43.703 ServerApp] )> couldn't write message: Content-Length: 285 {"jsonrpc":"2.0","id":69,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///home/workspace/.virtual_documents/shared@N1/worksheets/2021/PyTorch/2021.12./Untitled1.ipynb"},"position":{"line":12,"character":2},"context":{"triggerKind":2,"triggerCharacter":"."}}} Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 193, in write await convert_yielded(self._write_one(response.encode("utf-8"))) File "/root/anaconda3/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 201, in _write_one self.stream.write(message) BrokenPipeError: [Errno 32] Broken pipe [D 2021-12-22 00:58:43.708 ServerApp] activity on 5ecfa079-0e5f-48a3-908b-69f35ba2b6ad: status (busy) [D 2021-12-22 00:58:43.711 ServerApp] activity on 5ecfa079-0e5f-48a3-908b-69f35ba2b6ad: status (idle) [D 2021-12-22 00:58:43.951 ServerApp] [pylsp] Handling a message [E 2021-12-22 00:58:43.952 ServerApp] )> couldn't write message: Content-Length: 241 {"jsonrpc":"2.0","id":70,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///home/workspace/.virtual_documents/shared@N1/worksheets/2021/PyTorch/2021.12./Untitled1.ipynb"},"position":{"line":12,"character":2}}} Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 193, in write await convert_yielded(self._write_one(response.encode("utf-8"))) File "/root/anaconda3/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 201, in _write_one self.stream.write(message) BrokenPipeError: [Errno 32] Broken pipe [D 2021-12-22 00:58:44.509 ServerApp] [pylsp] Handling a message [E 2021-12-22 00:58:44.511 ServerApp] )> couldn't write message: Content-Length: 241 {"jsonrpc":"2.0","id":71,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///home/workspace/.virtual_documents/shared@N1/worksheets/2021/PyTorch/2021.12./Untitled1.ipynb"},"position":{"line":12,"character":2}}} Traceback (most recent call last): File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 193, in write await convert_yielded(self._write_one(response.encode("utf-8"))) File "/root/anaconda3/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/root/anaconda3/lib/python3.9/site-packages/jupyter_lsp/stdio.py", line 201, in _write_one self.stream.write(message) BrokenPipeError: [Errno 32] Broken pipe ```
Browser Output (recommended for all interface issues)
Paste the output from your browser JavaScript console replacing the text in here.

To learn how to open the developer tools in your browser:
https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools#How_to_open_the_devtools_in_your_browser
If too many messages accumulated after many hours of working in JupyterLab,
consider refreshing the window and then reproducing the bug to reduce the noise in the logs.

krassowski commented 2 years ago

Which language server are you using?

xenore78 commented 2 years ago

It is python-lsp-server 1.2.4.

(base) root@fdf3cce460e1:/# conda list |grep lsp
jupyter-lsp               1.5.1              pyhd8ed1ab_0    conda-forge
jupyter-lsp-python        1.5.1              pyhd8ed1ab_0    conda-forge
jupyterlab-lsp            3.9.3              pyhd8ed1ab_0    conda-forge
python-lsp-black          1.0.0              pyhd3eb1b0_0  
python-lsp-jsonrpc        1.0.0              pyhd3eb1b0_0  
python-lsp-server         1.2.4              pyhd3eb1b0_0  

I edited the original post so now you can see the error messages from the command line.

xenore78 commented 2 years ago

It seems that re-installing jupyter-lsp and installing jedi language server resolve the problem

When I had installed jupyter-lsp before, I did:

conda install -c conda-forge jupyter-lsp-python

But the extension manager of Jupyter lab shows that no jupyter-lsp is installed, so I installed jupyter-lsp again using the manager.

I wondered that this 'unclear' installation made some inconsistency, so I removed all packages related to jupyter-lsp and reinstalled them by following the instruction given in the git page exactly:

conda install -c conda-forge 'jupyterlab>=3.0.0,<4.0.0a0' jupyterlab-lsp

Note: the language server was not removed or reinstalled.

During the removal, the following packages are deleted:

jupyter-lsp-1.5.1-pyhd8ed1ab_0
jupyter-lsp-python-1.5.1-pyhd8ed1ab_0
jupyterlab-lsp-3.9.3-pyhd8ed1ab_0
libgcc-7.2.0-h69d50b8_2
python_abi-3.9-2_cp39

and these are updated

conda-forge::smmap-3.0.5 - 4.0.0

During the reinstallation, the followings are installed

jupyter-lsp-1.5.1
jupyterlab-lsp-3.9.3
python_abi-3.9-2_cp39

After the reinstallation, everything seems working except it is too slow and sometimes stucks. So I installed jedi-language-server using pip. Now jupyter-lsp is running on jedi-language server and no problem until now.

krassowski commented 2 years ago

Thank you for getting back to me. I cannot reproduce the issue with the latest python-lsp-server; it could have been a bug in an old version. In any case it would not be a bug in jupyterlab-lsp, so I will close this issue now.

Again, thank you for the report and following up.