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.8k stars 148 forks source link

Autocompletion stoped working #344

Closed sperezconesa closed 4 years ago

sperezconesa commented 4 years ago

Description

Hello, I have installed jupyterlab-lsp with the instructions of the README and altough I have the most functionalities like code style marking, the tab-autocompletion does not work nor the automatic signature suggestions. I'm really happy with this extension but autocomplete is so crucial that I need to turn it off while coding. Thank you very much for your help! Best, Sergio

Reproduce

I just tab when doing pd.Dat... and nothing appears

Expected behavior

Context

Required: installed server extensions
Paste the output from running `jupyter serverextension list` from the command line here.
You may want to sanitize the paths in the output.
Required: installed lab extensions
config dir: /home/sperez/.jupyter
    jupyterlab_quickopen  enabled 
    - Validating...
Error loading server extension jupyterlab_quickopen
      X is jupyterlab_quickopen importable?
    jupyterlab_code_formatter  enabled 
    - Validating...
Error loading server extension jupyterlab_code_formatter
      X is jupyterlab_code_formatter importable?
    jupyterlab_templates.extension  enabled 
    - Validating...
Error loading server extension jupyterlab_templates.extension
      X is jupyterlab_templates.extension importable?
    nbdime  enabled 
    - Validating...
      nbdime 2.0.0 OK
config dir: /data/sperez/bin2/anaconda3/envs/lab_env/etc/jupyter
    jupyter_lsp  enabled 
    - Validating...
      jupyter_lsp 0.9.2 OK
    jupyter_conda  enabled 
    - Validating...
      jupyter_conda 3.4.1 OK
    jupyterlab  enabled 
    - Validating...
      jupyterlab 2.1.5 OK
    jupyterlab_git  enabled 
    - Validating...
      jupyterlab_git 0.21.1 OK
    nbdime  enabled 
    - Validating...
      nbdime 2.0.0 OK

Troubleshoot Output

$PATH:
        /home/sperez/data_partition/bin2/gromacs-2020.2/gmx_api_no_gpu/bin
        /Users/sperez/bin
        /home/sperez/bin/msms
        /data/sperez/bin2/anaconda3/envs/lab_env/bin
        /data/sperez/bin2/anaconda3/condabin
        /Users/sperez/bin
        /home/sperez/bin/msms
        /usr/local/sbin
        /usr/local/bin
        /usr/sbin
        /usr/bin
        /sbin
        /bin
        /usr/games
        /usr/local/games
        /snap/bin
        /opt/thinlinc/bin
        /home/sperez/bin
        /home/sperez/bin/sparta_plus/SPARTA+
        /home/sperez/bin
        /home/sperez/bin/sparta_plus/SPARTA+

sys.path:
        /data/sperez/bin2/anaconda3/envs/lab_env/bin
        /home/sperez
        /home/sperez/bin/PYTHON_SCRIPTS
        /data/sperez/bin2/anaconda3/envs/lab_env/lib/python38.zip
        /data/sperez/bin2/anaconda3/envs/lab_env/lib/python3.8
        /data/sperez/bin2/anaconda3/envs/lab_env/lib/python3.8/lib-dynload
        /data/sperez/bin2/anaconda3/envs/lab_env/lib/python3.8/site-packages

sys.executable:
        /data/sperez/bin2/anaconda3/envs/lab_env/bin/python

sys.version:
        3.8.5 | packaged by conda-forge | (default, Aug 29 2020, 01:22:49) 
        [GCC 7.5.0]

platform.platform():
        Linux-4.15.0-65-generic-x86_64-with-glibc2.10

which -a jupyter:
        /data/sperez/bin2/anaconda3/envs/lab_env/bin/jupyter

pip list:
        Package                       Version
        ----------------------------- -------------------
        argon2-cffi                   20.1.0
        asciitree                     0.3.3
        astroid                       2.4.2
        attrs                         20.2.0
        autopep8                      1.5.4
        backcall                      0.2.0
        backports.functools-lru-cache 1.6.1
        biopython                     1.78
        bleach                        3.1.5
        brotlipy                      0.7.0
        certifi                       2020.6.20
        cffi                          1.14.1
        cftime                        1.2.1
        chardet                       3.0.4
        colorama                      0.4.3
        cryptography                  3.1
        cycler                        0.10.0
        datreant                      1.0.2
        decorator                     4.4.2
        defusedxml                    0.6.0
        entrypoints                   0.3
        flake8                        3.8.3
        future                        0.18.2
        fuzzywuzzy                    0.18.0
        gitdb                         4.0.5
        GitPython                     3.1.8
        gmxapi                        0.2.0a1
        GridDataFormats               0.5.0
        gsd                           2.2.0
        idna                          2.10
        importlib-metadata            1.7.0
        ipykernel                     5.3.4
        ipympl                        0.5.7
        ipython                       7.18.1
        ipython-genutils              0.2.0
        ipywidgets                    7.5.1
        isort                         5.5.1
        jedi                          0.17.2
        Jinja2                        2.11.2
        joblib                        0.16.0
        json5                         0.9.4
        jsonschema                    3.2.0
        jupyter-client                6.1.7
        jupyter-conda                 3.4.1
        jupyter-core                  4.6.3
        jupyter-lsp                   0.9.2
        jupyterlab                    2.1.5
        jupyterlab-git                0.21.1
        jupyterlab-server             1.2.0
        kiwisolver                    1.2.0
        lazy-object-proxy             1.4.3
        MarkupSafe                    1.1.1
        matplotlib                    3.3.1
        mccabe                        0.6.1
        MDAnalysis                    1.0.0
        mistune                       0.8.4
        mmtf-python                   1.1.2
        msgpack                       1.0.0
        nb-conda-kernels              2.2.4
        nbconvert                     5.6.1
        nbdime                        2.0.0
        nbformat                      5.0.7
        netCDF4                       1.5.4
        networkx                      2.5
        nglview                       2.7.7
        notebook                      6.1.3
        numpy                         1.19.1
        olefile                       0.46
        packaging                     20.4
        pandas                        1.1.1
        pandocfilters                 1.4.2
        parso                         0.7.1
        pathlib2                      2.3.5
        patsy                         0.5.1
        pexpect                       4.8.0
        pickleshare                   0.7.5
        Pillow                        7.2.0
        pip                           20.2.2
        pluggy                        0.13.1
        prometheus-client             0.8.0
        prompt-toolkit                3.0.7
        ptyprocess                    0.6.0
        pycodestyle                   2.6.0
        pycparser                     2.20
        pydocstyle                    5.1.1
        pyflakes                      2.2.0
        Pygments                      2.6.1
        pylint                        2.6.0
        pyOpenSSL                     19.1.0
        pyparsing                     2.4.7
        pyrsistent                    0.16.0
        PySocks                       1.7.1
        python-dateutil               2.8.1
        python-jsonrpc-server         0.3.4
        python-language-server        0.34.1
        python-Levenshtein            0.12.0
        pytz                          2020.1
        pyzmq                         19.0.2
        requests                      2.24.0
        rope                          0.17.0
        scandir                       1.10.0
        scikit-learn                  0.23.2
        scipy                         1.5.2
        seaborn                       0.10.1
        Send2Trash                    1.5.0
        setuptools                    49.6.0.post20200814
        six                           1.15.0
        smmap                         3.0.4
        snowballstemmer               2.0.0
        statsmodels                   0.12.0
        terminado                     0.8.3
        testpath                      0.4.4
        threadpoolctl                 2.1.0
        toml                          0.10.1
        tornado                       6.0.4
        tqdm                          4.48.2
        traitlets                     4.3.3
        ujson                         1.35
        urllib3                       1.25.10
        wcwidth                       0.2.5
        webencodings                  0.5.1
        wheel                         0.35.1
        widgetsnbextension            3.5.1
        wrapt                         1.11.2
        yapf                          0.30.0
        zipp                          3.1.0

conda list:
        # packages in environment at /data/sperez/bin2/anaconda3/envs/lab_env:
        #
        # Name                    Version                   Build  Channel
        _libgcc_mutex             0.1                 conda_forge    conda-forge
        _openmp_mutex             4.5                       1_gnu    conda-forge
        argon2-cffi               20.1.0           py38h1e0a361_1    conda-forge
        asciitree                 0.3.3                    pypi_0    pypi
        astroid                   2.4.2            py38h32f6830_0    conda-forge
        attrs                     20.2.0             pyh9f0ad1d_0    conda-forge
        autopep8                  1.5.4              pyh9f0ad1d_0    conda-forge
        backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
        backports                 1.0                        py_2    conda-forge
        backports.functools_lru_cache 1.6.1                      py_0    conda-forge
        biopython                 1.78             py38h1e0a361_0    conda-forge
        bleach                    3.1.5              pyh9f0ad1d_0    conda-forge
        brotlipy                  0.7.0           py38h1e0a361_1000    conda-forge
        bzip2                     1.0.8                h516909a_3    conda-forge
        c-ares                    1.16.1               h516909a_3    conda-forge
        ca-certificates           2020.7.22                     0  
        certifi                   2020.6.20                py38_0  
        cffi                      1.14.1           py38h5bae8af_0    conda-forge
        cftime                    1.2.1            py38h8790de6_0    conda-forge
        chardet                   3.0.4           py38h32f6830_1006    conda-forge
        colorama                  0.4.3                      py_0    conda-forge
        cryptography              3.1              py38h766eaa4_0    conda-forge
        curl                      7.71.1               he644dc0_5    conda-forge
        cycler                    0.10.0                     py_2    conda-forge
        datreant                  1.0.2                    pypi_0    pypi
        decorator                 4.4.2                      py_0    conda-forge
        defusedxml                0.6.0                      py_0    conda-forge
        entrypoints               0.3             py38h32f6830_1001    conda-forge
        flake8                    3.8.3                      py_0  
        freetype                  2.10.2               he06d7ca_0    conda-forge
        future                    0.18.2           py38h32f6830_1    conda-forge
        fuzzywuzzy                0.18.0                   pypi_0    pypi
        gitdb                     4.0.5                      py_0    conda-forge
        gitpython                 3.1.8                      py_0    conda-forge
        gmxapi                    0.2.0a1                  pypi_0    pypi
        griddataformats           0.5.0                      py_0    conda-forge
        gsd                       2.2.0            py38hab2c0dc_0    conda-forge
        hdf4                      4.2.13            hf30be14_1003    conda-forge
        hdf5                      1.10.6          nompi_h3c11f04_101    conda-forge
        icu                       67.1                 he1b5a44_0    conda-forge
        idna                      2.10               pyh9f0ad1d_0    conda-forge
        importlib-metadata        1.7.0            py38h32f6830_0    conda-forge
        importlib_metadata        1.7.0                         0    conda-forge
        ipykernel                 5.3.4            py38h23f93f0_0    conda-forge
        ipympl                    0.5.7                    pypi_0    pypi
        ipython                   7.18.1           py38h1cdfbd6_0    conda-forge
        ipython_genutils          0.2.0                      py_1    conda-forge
        ipywidgets                7.5.1                      py_0    conda-forge
        isort                     5.5.1            py38h32f6830_0    conda-forge
        jedi                      0.17.2           py38h32f6830_0    conda-forge
        jinja2                    2.11.2             pyh9f0ad1d_0    conda-forge
        joblib                    0.16.0                     py_0    conda-forge
        jpeg                      9d                   h516909a_0    conda-forge
        json5                     0.9.4              pyh9f0ad1d_0    conda-forge
        jsonschema                3.2.0            py38h32f6830_1    conda-forge
        jupyter-lsp               0.9.2                    pypi_0    pypi
        jupyter_client            6.1.7                      py_0    conda-forge
        jupyter_conda             3.4.1              pyh9f0ad1d_0    conda-forge
        jupyter_core              4.6.3            py38h32f6830_1    conda-forge
        jupyterlab                2.1.5                      py_0    conda-forge
        jupyterlab-git            0.21.1                     py_0    conda-forge
        jupyterlab_server         1.2.0                      py_0    conda-forge
        kiwisolver                1.2.0            py38hbf85e49_0    conda-forge
        krb5                      1.17.1               hfafb76e_3    conda-forge
        lazy-object-proxy         1.4.3            py38h1e0a361_2    conda-forge
        lcms2                     2.11                 hbd6801e_0    conda-forge
        ld_impl_linux-64          2.34                 hc38a660_9    conda-forge
        libblas                   3.8.0               17_openblas    conda-forge
        libcblas                  3.8.0               17_openblas    conda-forge
        libcurl                   7.71.1               hcdd3856_5    conda-forge
        libedit                   3.1.20191231         he28a2e2_2    conda-forge
        libev                     4.33                 h516909a_1    conda-forge
        libffi                    3.2.1             he1b5a44_1007    conda-forge
        libgcc-ng                 9.3.0               h24d8f2e_16    conda-forge
        libgfortran-ng            7.5.0               hdf63c60_16    conda-forge
        libgomp                   9.3.0               h24d8f2e_16    conda-forge
        liblapack                 3.8.0               17_openblas    conda-forge
        libnetcdf                 4.7.4           nompi_h84807e1_105    conda-forge
        libnghttp2                1.41.0               h8cfc5f6_2    conda-forge
        libopenblas               0.3.10          pthreads_hb3c22a3_4    conda-forge
        libpng                    1.6.37               hed695b0_2    conda-forge
        libsodium                 1.0.18               h516909a_0    conda-forge
        libssh2                   1.9.0                hab1572f_5    conda-forge
        libstdcxx-ng              9.3.0               hdf63c60_16    conda-forge
        libtiff                   4.1.0                hc7e4089_6    conda-forge
        libuv                     1.39.0               h516909a_0    conda-forge
        libwebp-base              1.1.0                h516909a_3    conda-forge
        lz4-c                     1.9.2                he1b5a44_3    conda-forge
        markupsafe                1.1.1            py38h1e0a361_1    conda-forge
        matplotlib-base           3.3.1            py38h91b0d89_1    conda-forge
        mccabe                    0.6.1                    py38_1  
        mdanalysis                1.0.0            py38h950e882_0    conda-forge
        mistune                   0.8.4           py38h1e0a361_1001    conda-forge
        mmtf-python               1.1.2                      py_0    conda-forge
        msgpack-python            1.0.0            py38hbf85e49_1    conda-forge
        nb_conda_kernels          2.2.4            py38h32f6830_0    conda-forge
        nbconvert                 5.6.1            py38h32f6830_1    conda-forge
        nbdime                    2.0.0                      py_1    conda-forge
        nbformat                  5.0.7                      py_0    conda-forge
        ncurses                   6.2                  he1b5a44_1    conda-forge
        netcdf4                   1.5.4           nompi_py38hec8b9af_102    conda-forge
        networkx                  2.5                        py_0    conda-forge
        nglview                   2.7.7              pyh5ca1d4c_1    conda-forge
        nodejs                    14.9.0               h568c755_0    conda-forge
        notebook                  6.1.3            py38h32f6830_0    conda-forge
        numpy                     1.19.1           py38hbc27379_2    conda-forge
        olefile                   0.46                       py_0    conda-forge
        openssl                   1.1.1g               h7b6447c_0  
        packaging                 20.4               pyh9f0ad1d_0    conda-forge
        pandas                    1.1.1            py38h950e882_0    conda-forge
        pandoc                    2.10.1               h516909a_0    conda-forge
        pandocfilters             1.4.2                      py_1    conda-forge
        parso                     0.7.1              pyh9f0ad1d_0    conda-forge
        pathlib2                  2.3.5                    pypi_0    pypi
        patsy                     0.5.1                      py_0    conda-forge
        pexpect                   4.8.0            py38h32f6830_1    conda-forge
        pickleshare               0.7.5           py38h32f6830_1001    conda-forge
        pillow                    7.2.0            py38h9776b28_1    conda-forge
        pip                       20.2.2                     py_0    conda-forge
        pluggy                    0.13.1           py38h32f6830_2    conda-forge
        prometheus_client         0.8.0              pyh9f0ad1d_0    conda-forge
        prompt-toolkit            3.0.7                      py_0    conda-forge
        ptyprocess                0.6.0                   py_1001    conda-forge
        pycodestyle               2.6.0                      py_0  
        pycparser                 2.20               pyh9f0ad1d_2    conda-forge
        pydocstyle                5.1.1                      py_0    conda-forge
        pyflakes                  2.2.0                      py_0  
        pygments                  2.6.1                      py_0    conda-forge
        pylint                    2.6.0            py38h32f6830_0    conda-forge
        pyopenssl                 19.1.0                     py_1    conda-forge
        pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
        pyrsistent                0.16.0           py38h1e0a361_0    conda-forge
        pysocks                   1.7.1            py38h32f6830_1    conda-forge
        python                    3.8.5           h1103e12_7_cpython    conda-forge
        python-dateutil           2.8.1                      py_0    conda-forge
        python-jsonrpc-server     0.3.4              pyh9f0ad1d_1    conda-forge
        python-language-server    0.34.1           py38h32f6830_0    conda-forge
        python-levenshtein        0.12.0                   pypi_0    pypi
        python_abi                3.8                      1_cp38    conda-forge
        pytz                      2020.1             pyh9f0ad1d_0    conda-forge
        pyzmq                     19.0.2           py38ha71036d_0    conda-forge
        readline                  8.0                  he28a2e2_2    conda-forge
        requests                  2.24.0             pyh9f0ad1d_0    conda-forge
        rope                      0.17.0                     py_0  
        scandir                   1.10.0                   pypi_0    pypi
        scikit-learn              0.23.2           py38hee58b96_0    conda-forge
        scipy                     1.5.2            py38h8c5af15_0    conda-forge
        seaborn                   0.10.1                        1    conda-forge
        seaborn-base              0.10.1                     py_1    conda-forge
        send2trash                1.5.0                      py_0    conda-forge
        setuptools                49.6.0           py38h32f6830_0    conda-forge
        six                       1.15.0             pyh9f0ad1d_0    conda-forge
        smmap                     3.0.4              pyh9f0ad1d_0    conda-forge
        snowballstemmer           2.0.0                      py_0    conda-forge
        sqlite                    3.33.0               h4cf870e_0    conda-forge
        statsmodels               0.12.0           py38h1e0a361_0    conda-forge
        terminado                 0.8.3            py38h32f6830_1    conda-forge
        testpath                  0.4.4                      py_0    conda-forge
        threadpoolctl             2.1.0              pyh5ca1d4c_0    conda-forge
        tk                        8.6.10               hed695b0_0    conda-forge
        toml                      0.10.1             pyh9f0ad1d_0    conda-forge
        tornado                   6.0.4            py38h1e0a361_1    conda-forge
        tqdm                      4.48.2             pyh9f0ad1d_0    conda-forge
        traitlets                 4.3.3            py38h32f6830_1    conda-forge
        ujson                     1.35            py38h950e882_1002    conda-forge
        urllib3                   1.25.10                    py_0    conda-forge
        wcwidth                   0.2.5              pyh9f0ad1d_1    conda-forge
        webencodings              0.5.1                      py_1    conda-forge
        wheel                     0.35.1             pyh9f0ad1d_0    conda-forge
        widgetsnbextension        3.5.1            py38h32f6830_1    conda-forge
        wrapt                     1.11.2           py38h1e0a361_0    conda-forge
        xz                        5.2.5                h516909a_1    conda-forge
        yapf                      0.30.0             pyh9f0ad1d_0    conda-forge
        zeromq                    4.3.2                he1b5a44_3    conda-forge
        zipp                      3.1.0                      py_0    conda-forge
        zlib                      1.2.11            h516909a_1009    conda-forge
        zstd                      1.4.5                h6597ccf_2    conda-forge
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Browser Output
![image](https://user-images.githubusercontent.com/27727343/92454783-3184f280-f1c1-11ea-9272-d525c81d8d32.png)

krassowski commented 4 years ago

Hi @sperezconesa, thank you for your report. Three quick questions:

My first guess would be it might have to do with the performance (from the browser output you show it seem that the completer does work, but it could be just to slow to be useful at all), see #336 - but if you can reproduce it with a small notebook I would start looking elsewhere for the problem.

krassowski commented 4 years ago

Wait, I just saw that you use JupyterLab 2.1.5. The most recent version of this extension (2.0) requires JupyterLab 2.2 because there were breaking changes related to completion in JupyterLab 2.2 release - this is a likely reason why the completer might not be showing up for you. If you are using 2.0, would you be able to upgrade JupyterLab?

sperezconesa commented 4 years ago

Great! now it works.

It is a bit slow... Could it be because I have several:

  "language_servers": {
    "pyls": {
      "serverSettings": {
        "pyls.plugins.pydocstyle.enabled": true,
        "pyls.plugins.pyflakes.enabled": true,
        "pyls.plugins.flake8.enabled": false
      }

Should I just pick one? Are they all similar? There is not a lot of information of this in the documentation and for newbies like me its a bit confusing.

sperezconesa commented 4 years ago

Actually, most of the time it is too slow to work fine... Do I need to have the libraries installed in every kernell?

krassowski commented 4 years ago

Hi @sperezconesa, sorry for the delay in getting back to you. You are doing everything correct with the config (you can chose to have only one or multiple diagnostics sources enabled). In short, flake8, pyflakes and pydocstyle differ in the choices on what is a warning, what is an error and what is not an issue. You can check this Reddit discussion to get a better sense on pyflakes and flake8 differences. If you need further guidance on the configuration of the server, check out the pyls repo, and give them a star to say thank you to the maintainers.

I am sorry that the completion is slow; I feel this pain myself and will be working on it in the coming weeks with a goal to fix it in 2.1 release - subscribes to the releases ("Watch" button on top of the page → "Releases only") to get an update on it. For now I will close this issue as the completion slowness and general slowness are already tracked in #272 and #336.

Please let me know if you have any questions. For very generic questions, you may get a faster response on Stack Overflow, but if you do not get an answer over there, please feel welcome to post a link to a question here.

sperezconesa commented 4 years ago

Thanks a lot! I look forward to ussing it when it is improved!