spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.21k stars 1.59k forks source link

PyLSP fails to find package when launched from spyder. #16641

Open impact27 opened 2 years ago

impact27 commented 2 years ago

Issue Report Checklist

Problem Description

Under some conditions, pylsp will not find some library, but only when launched from spyder.

What steps reproduce the problem?

First, let's create a dummy package:

  1. Create a folder called my package
  2. In that folder, create a folder called mypackage
  3. Create my package/setup.py with:
    
    from distutils.core import setup

setup(name='mypackage', version='0.0', packages=['mypackage'], )

 4. Create `my package/mypackage/__init__.py` with:

def a(): print(0)

5. With the anaconda prompt, go to the `my package` folder and install with `pip install --user -e .`
6. Open spyder
7. Create a new file
8. write `import mypackage`
9. ctrl + click on `mypackage` to go to the definition
10. nothing happens

This is annoying. WHat is strange is that if I then:
 11. Open the anaconda prompt, start a new pylsp with: `pylsp --tcp --host 127.0.0.1 --port 2088`
 12. Go to spyder settings > Completion and linting > Advanced 
 13. Enable advanced settings, set the port to 2088, check "This is an external server"
 14. ctrl + click on `mypackage` to go to the definition
 15. It goes to definition

### What is the expected output? What do you see instead?
I would expect pylsp to work even when launched from spyder. Instead it fails.

The failure is quite specific. I think but am not sure that it only happens with the pip `--user` option. 

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 5.x dev
* Python version: 3.8.5
* Qt version: 5.12.10
* PyQt version: 5.12.3
* Operating System name/version: Windows 10 

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

Mandatory:

atomicwrites >=1.2.0 : 1.4.0 (OK) chardet >=2.0.0 : 3.0.4 (OK) cloudpickle >=0.5.0 : 1.6.0 (OK) cookiecutter >=1.6.0 : 1.7.2 (OK) diff_match_patch >=20181111 : 20200713 (OK) intervaltree >=3.0.2 : 3.1.0 (OK) IPython >=7.6.0 : 7.19.0 (OK) jedi >=0.17.2;<0.19.0 : 0.18.0 (OK) jellyfish >=0.7 : None (OK) jsonschema >=3.2.0 : 3.2.0 (OK) keyring >=17.0.0 : 21.4.0 (OK) nbconvert >=4.0 : 6.0.7 (OK) numpydoc >=0.6.0 : 1.1.0 (OK) paramiko >=2.4.0 : 2.7.2 (OK) parso >=0.7.0;<0.9.0 : 0.8.2 (OK) pexpect >=4.4.0 : 4.8.0 (OK) pickleshare >=0.4 : 0.7.5 (OK) psutil >=5.3 : 5.7.2 (OK) pygments >=2.0 : 2.7.2 (OK) pylint >=2.5.0 : 2.6.0 (OK) pyls_spyder >=0.4.0 : 0.4.0 (OK) pylsp >=1.2.2;<1.3.0 : 1.2.3 (OK) pylsp_black >=1.0.0 : None (OK) qdarkstyle =3.0.2 : 3.0.2 (OK) qstylizer >=0.1.10 : 0.2.0 (OK) qtawesome >=1.0.2 : 1.0.2 (OK) qtconsole >=5.1.0 : 5.1.0 (OK) qtpy >=1.5.0 : 1.9.0 (OK) rtree >=0.9.7 : 0.9.7 (OK) setuptools >=49.6.0 : 58.2.0 (OK) sphinx >=0.6.6 : 3.2.1 (OK) spyder_kernels >=2.1.1;<2.2.0 : 2.2.0.dev0 (OK) textdistance >=4.2.0 : 4.2.1 (OK) three_merge >=0.1.1 : 0.1.1 (OK) watchdog >=0.10.3 : 0.10.3 (OK) zmq >=17 : 19.0.2 (OK)

Optional:

cython >=0.21 : 0.29.21 (OK) matplotlib >=2.0.0 : 3.4.2 (OK) numpy >=1.7 : 1.19.2 (OK) pandas >=1.1.1 : 1.1.3 (OK) scipy >=0.17.0 : 1.5.2 (OK) sympy >=0.7.3 : 1.6.2 (OK)

ccordoba12 commented 2 years ago

Hey @impact27, how did you install Spyder and the PyLSP? Please let us know the exact setup and commands you used in each case.

ccordoba12 commented 2 years ago

Sorry, I think that's irrelevant in this case. After reading carefully what you posted, the problem could be due to

The failure is quite specific. I think but am not sure that it only happens with the pip --user option.

although I cannot reproduce it on Linux.

@dalthviz, could you try it on Windows? This is the directory example mentioned by @impact27 above: my package.zip. Also note that this doesn't need to be a Spyder project.

dalthviz commented 2 years ago

@ccordoba12 @impact27 I checked using the Windows installer and it works there (selecting an env with mypackage installed).

However, if I try running with a from source installation (using pip install -e . to install spyder) I'm able to replicate the issue i.e the default run of the PyLSP doesn't detect the mypackage package but if I run from an external server it works.

ccordoba12 commented 2 years ago

So @dalthviz, does this mean that the error appears only when Spyder is installed in development mode?

impact27 commented 2 years ago

I reproduced on my window machine by launching spyder with: conda create -n spyder-env_tmp conda activate spyder-env_tmp conda install -c conda-forge spyder cd "my package" pip install --user -e . spyder

dalthviz commented 2 years ago

Checking with the latest steps @impact27 posted Ctrl +Click worked for mypackage on my setup. Just in case the result env spec:

pip list

``` Package Version Editable project location ----------------------------- ---------- ------------------------------------ alabaster 0.7.12 argh 0.26.2 arrow 1.2.1 astroid 2.5.8 async-generator 1.10 atomicwrites 1.4.0 attrs 21.2.0 autopep8 1.6.0 Babel 2.9.1 backcall 0.2.0 backports.functools-lru-cache 1.6.4 bcrypt 3.2.0 binaryornot 0.4.4 black 21.9b0 bleach 4.1.0 brotlipy 0.7.0 certifi 2021.10.8 cffi 1.14.6 chardet 4.0.0 charset-normalizer 2.0.0 click 8.0.3 cloudpickle 2.0.0 colorama 0.4.4 cookiecutter 1.6.0 cryptography 35.0.0 dataclasses 0.8 debugpy 1.4.1 decorator 5.1.0 defusedxml 0.7.1 diff-match-patch 20200713 docutils 0.15.2 entrypoints 0.3 flake8 3.9.2 future 0.18.2 idna 3.1 imagesize 1.2.0 importlib-metadata 4.8.1 inflection 0.5.1 intervaltree 3.0.2 ipykernel 6.4.2 ipython 7.28.0 ipython-genutils 0.2.0 isort 5.9.3 jedi 0.18.0 Jinja2 3.0.2 jinja2-time 0.2.0 jsonschema 4.1.2 jupyter-client 6.1.12 jupyter-core 4.9.1 jupyterlab-pygments 0.1.2 keyring 23.2.1 lazy-object-proxy 1.6.0 MarkupSafe 2.0.1 matplotlib-inline 0.1.3 mccabe 0.6.1 mistune 0.8.4 mypackage 0.0 d:\acer\documentos\spyder\my package mypy-extensions 0.4.3 nbclient 0.5.4 nbconvert 6.2.0 nbformat 5.1.3 nest-asyncio 1.5.1 numpydoc 1.1.0 packaging 21.0 pandocfilters 1.5.0 paramiko 2.8.0 parso 0.8.2 pathspec 0.9.0 pexpect 4.8.0 pickleshare 0.7.5 pip 21.3.1 platformdirs 2.3.0 pluggy 1.0.0 poyo 0.5.0 prompt-toolkit 3.0.21 psutil 5.8.0 ptyprocess 0.7.0 pycodestyle 2.7.0 pycparser 2.20 pydocstyle 6.1.1 pyflakes 2.3.1 Pygments 2.10.0 pylint 2.7.2 pyls-spyder 0.4.0 PyNaCl 1.4.0 pyOpenSSL 21.0.0 pyparsing 3.0.3 pyrsistent 0.17.3 PySocks 1.7.1 python-dateutil 2.8.2 python-lsp-black 1.0.0 python-lsp-jsonrpc 1.0.0 python-lsp-server 1.2.4 pytz 2021.3 pywin32 301 pywin32-ctypes 0.2.0 PyYAML 3.13 pyzmq 22.3.0 QDarkStyle 3.0.2 qstylizer 0.2.1 QtAwesome 1.0.3 qtconsole 5.1.1 QtPy 1.11.2 regex 2021.10.23 requests 2.26.0 rope 0.21.0 Rtree 0.9.7 setuptools 58.2.0 sip 4.19.25 six 1.16.0 snowballstemmer 2.1.0 sortedcontainers 2.4.0 Sphinx 4.2.0 sphinxcontrib-applehelp 1.0.2 sphinxcontrib-devhelp 1.0.2 sphinxcontrib-htmlhelp 2.0.0 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.3 sphinxcontrib-serializinghtml 1.1.5 spyder 5.1.5 spyder-kernels 2.1.3 testpath 0.5.0 textdistance 4.2.2 three-merge 0.1.1 tinycss2 1.1.0 toml 0.10.2 tomli 1.2.2 tornado 6.1 traitlets 5.1.1 typed-ast 1.4.3 typing-extensions 3.10.0.2 ujson 4.2.0 urllib3 1.26.7 watchdog 2.1.6 wcwidth 0.2.5 webencodings 0.5.1 wheel 0.37.0 whichcraft 0.6.1 win-inet-pton 1.1.0 wrapt 1.12.1 yapf 0.31.0 zipp 3.6.0 ```

conda list

``` # packages in environment at C:\Users\dalth\anaconda3\envs\spyder-env_tmp: # # Name Version Build Channel alabaster 0.7.12 py_0 conda-forge argh 0.26.2 pyh9f0ad1d_1002 conda-forge arrow 1.2.1 pyhd8ed1ab_0 conda-forge astroid 2.5.8 py38haa244fe_0 conda-forge async_generator 1.10 py_0 conda-forge atomicwrites 1.4.0 pyh9f0ad1d_0 conda-forge attrs 21.2.0 pyhd8ed1ab_0 conda-forge autopep8 1.6.0 pyhd8ed1ab_0 conda-forge babel 2.9.1 pyh44b312d_0 conda-forge backcall 0.2.0 pyh9f0ad1d_0 conda-forge backports 1.0 py_2 conda-forge backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge bcrypt 3.2.0 py38h294d835_1 conda-forge binaryornot 0.4.4 py_1 conda-forge black 21.9b0 pyhd8ed1ab_1 conda-forge bleach 4.1.0 pyhd8ed1ab_0 conda-forge brotlipy 0.7.0 py38h294d835_1001 conda-forge ca-certificates 2021.10.8 h5b45459_0 conda-forge certifi 2021.10.8 py38haa244fe_0 conda-forge cffi 1.14.6 py38hd8c33c5_1 conda-forge chardet 4.0.0 py38haa244fe_1 conda-forge charset-normalizer 2.0.0 pyhd8ed1ab_0 conda-forge click 8.0.3 py38haa244fe_0 conda-forge cloudpickle 2.0.0 pyhd8ed1ab_0 conda-forge colorama 0.4.4 pyh9f0ad1d_0 conda-forge cookiecutter 1.6.0 py38_1000 conda-forge cryptography 35.0.0 py38hb7941b4_1 conda-forge dataclasses 0.8 pyhc8e2a94_3 conda-forge debugpy 1.4.1 py38h885f38d_0 conda-forge decorator 5.1.0 pyhd8ed1ab_0 conda-forge defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge diff-match-patch 20200713 pyh9f0ad1d_0 conda-forge docutils 0.15.2 py38haa244fe_2 conda-forge entrypoints 0.3 pyhd8ed1ab_1003 conda-forge flake8 3.9.2 pyhd8ed1ab_0 conda-forge future 0.18.2 py38haa244fe_3 conda-forge icu 58.2 vc14hc45fdbb_0 [vc14] defaults idna 3.1 pyhd3deb0d_0 conda-forge imagesize 1.2.0 py_0 conda-forge importlib-metadata 4.8.1 py38haa244fe_0 conda-forge importlib_metadata 4.8.1 hd8ed1ab_0 conda-forge inflection 0.5.1 pyh9f0ad1d_0 conda-forge intervaltree 3.0.2 py_0 conda-forge ipykernel 6.4.2 py38h595d716_0 conda-forge ipython 7.28.0 py38h595d716_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge isort 5.9.3 pyhd8ed1ab_0 conda-forge jedi 0.18.0 py38haa244fe_2 conda-forge jinja2 3.0.2 pyhd8ed1ab_0 conda-forge jinja2-time 0.2.0 py_2 conda-forge jpeg 9b vc14h4d7706e_1 [vc14] defaults jsonschema 4.1.2 pyhd8ed1ab_0 conda-forge jupyter_client 6.1.12 pyhd8ed1ab_0 conda-forge jupyter_core 4.9.1 py38haa244fe_0 conda-forge jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge keyring 23.2.1 py38haa244fe_0 conda-forge lazy-object-proxy 1.6.0 py38h294d835_0 conda-forge libpng 1.6.37 h1d00b33_2 conda-forge libsodium 1.0.18 h8d14728_1 conda-forge libspatialindex 1.9.3 h39d44d4_4 conda-forge markupsafe 2.0.1 py38h294d835_0 conda-forge matplotlib-inline 0.1.3 pyhd8ed1ab_0 conda-forge mccabe 0.6.1 py_1 conda-forge mistune 0.8.4 py38h294d835_1004 conda-forge mypy_extensions 0.4.3 py38haa244fe_3 conda-forge nbclient 0.5.4 pyhd8ed1ab_0 conda-forge nbconvert 6.2.0 py38haa244fe_0 conda-forge nbformat 5.1.3 pyhd8ed1ab_0 conda-forge nest-asyncio 1.5.1 pyhd8ed1ab_0 conda-forge numpydoc 1.1.0 py_1 conda-forge openssl 1.1.1l h8ffe710_0 conda-forge packaging 21.0 pyhd8ed1ab_0 conda-forge pandoc 2.15 h8ffe710_0 conda-forge pandocfilters 1.5.0 pyhd8ed1ab_0 conda-forge paramiko 2.8.0 pyhd8ed1ab_0 conda-forge parso 0.8.2 pyhd8ed1ab_0 conda-forge pathspec 0.9.0 pyhd8ed1ab_0 conda-forge pexpect 4.8.0 pyh9f0ad1d_2 conda-forge pickleshare 0.7.5 py_1003 conda-forge pip 21.3.1 pyhd8ed1ab_0 conda-forge platformdirs 2.3.0 pyhd8ed1ab_0 conda-forge pluggy 1.0.0 py38haa244fe_1 conda-forge poyo 0.5.0 py_0 conda-forge prompt-toolkit 3.0.21 pyha770c72_0 conda-forge psutil 5.8.0 py38h294d835_1 conda-forge ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge pycodestyle 2.7.0 pyhd8ed1ab_0 conda-forge pycparser 2.20 pyh9f0ad1d_2 conda-forge pydocstyle 6.1.1 pyhd8ed1ab_0 conda-forge pyflakes 2.3.1 pyhd8ed1ab_0 conda-forge pygments 2.10.0 pyhd8ed1ab_0 conda-forge pylint 2.7.2 py38haa244fe_0 conda-forge pyls-spyder 0.4.0 pyhd8ed1ab_0 conda-forge pynacl 1.4.0 py38h31c79cd_2 conda-forge pyopenssl 21.0.0 pyhd8ed1ab_0 conda-forge pyparsing 3.0.3 pyhd8ed1ab_0 conda-forge pyqt 5.9.2 py38ha925a31_4 defaults pyrsistent 0.17.3 py38h294d835_2 conda-forge pysocks 1.7.1 py38haa244fe_3 conda-forge python 3.8.12 h7840368_2_cpython conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python-lsp-black 1.0.0 pyhd8ed1ab_0 conda-forge python-lsp-jsonrpc 1.0.0 pyhd8ed1ab_0 conda-forge python-lsp-server 1.2.4 pyhd8ed1ab_0 conda-forge python_abi 3.8 2_cp38 conda-forge pytz 2021.3 pyhd8ed1ab_0 conda-forge pywin32 301 py38h294d835_0 conda-forge pywin32-ctypes 0.2.0 py38haa244fe_1003 conda-forge pyyaml 3.13 py38hfa6e2cd_0 conda-forge pyzmq 22.3.0 py38h09162b1_0 conda-forge qdarkstyle 3.0.2 pyhd8ed1ab_0 conda-forge qstylizer 0.2.1 pyhd8ed1ab_0 conda-forge qt 5.9.7 vc14h73c81de_0 [vc14] defaults qtawesome 1.0.3 pyhd8ed1ab_0 conda-forge qtconsole 5.1.1 pyhd8ed1ab_0 conda-forge qtpy 1.11.2 pyhd8ed1ab_0 conda-forge regex 2021.10.23 py38h294d835_0 conda-forge requests 2.26.0 pyhd8ed1ab_0 conda-forge rope 0.21.0 pyhd8ed1ab_0 conda-forge rtree 0.9.7 py38h8b54edf_2 conda-forge setuptools 58.2.0 py38haa244fe_0 conda-forge sip 4.19.25 py38h885f38d_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge snowballstemmer 2.1.0 pyhd8ed1ab_0 conda-forge sortedcontainers 2.4.0 pyhd8ed1ab_0 conda-forge sphinx 4.2.0 pyh6c4a22f_0 conda-forge sphinxcontrib-applehelp 1.0.2 py_0 conda-forge sphinxcontrib-devhelp 1.0.2 py_0 conda-forge sphinxcontrib-htmlhelp 2.0.0 pyhd8ed1ab_0 conda-forge sphinxcontrib-jsmath 1.0.1 py_0 conda-forge sphinxcontrib-qthelp 1.0.3 py_0 conda-forge sphinxcontrib-serializinghtml 1.1.5 pyhd8ed1ab_0 conda-forge spyder 5.1.5 py38haa244fe_0 conda-forge spyder-kernels 2.1.3 py38haa244fe_0 conda-forge sqlite 3.36.0 h8ffe710_2 conda-forge testpath 0.5.0 pyhd8ed1ab_0 conda-forge textdistance 4.2.2 pyhd8ed1ab_0 conda-forge three-merge 0.1.1 pyh9f0ad1d_0 conda-forge tinycss2 1.1.0 pyhd8ed1ab_0 conda-forge toml 0.10.2 pyhd8ed1ab_0 conda-forge tomli 1.2.2 pyhd8ed1ab_0 conda-forge tornado 6.1 py38h294d835_1 conda-forge traitlets 5.1.1 pyhd8ed1ab_0 conda-forge typed-ast 1.4.3 py38h294d835_0 conda-forge typing_extensions 3.10.0.2 pyha770c72_0 conda-forge ucrt 10.0.20348.0 h57928b3_0 conda-forge ujson 4.2.0 py38h885f38d_0 conda-forge urllib3 1.26.7 pyhd8ed1ab_0 conda-forge vc 14.2 hb210afc_5 conda-forge vs2015_runtime 14.29.30037 h902a5da_5 conda-forge watchdog 2.1.6 py38haa244fe_0 conda-forge wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge webencodings 0.5.1 py_1 conda-forge wheel 0.37.0 pyhd8ed1ab_1 conda-forge whichcraft 0.6.1 py_0 conda-forge win_inet_pton 1.1.0 py38haa244fe_2 conda-forge wrapt 1.12.1 py38h294d835_3 conda-forge yaml 0.1.7 vc14h4cb57cf_1 [vc14] defaults yapf 0.31.0 pyhd8ed1ab_0 conda-forge zeromq 4.3.4 h0e60522_1 conda-forge zipp 3.6.0 pyhd8ed1ab_0 conda-forge zlib 1.2.11 vc14h1cdd9ab_1 [vc14] defaults ```

Is there any difference between my env and yours @impact27 (besides the path where mypackage is located)?

Edit:

So @dalthviz, does this mean that the error appears only when Spyder is installed in development mode?

At least in my case yes, but maybe there is something else that could be triggering this behavior?

impact27 commented 2 years ago

pip list

``` Package Version Editable project location ----------------------------- ---------- ----------------------------------------- alabaster 0.7.12 argh 0.26.2 arrow 1.2.1 astroid 2.5.8 async-generator 1.10 atomicwrites 1.4.0 attrs 21.2.0 autopep8 1.6.0 Babel 2.9.1 backcall 0.2.0 backports.functools-lru-cache 1.6.4 bcrypt 3.2.0 binaryornot 0.4.4 black 21.9b0 bleach 4.1.0 brotlipy 0.7.0 certifi 2021.10.8 cffi 1.14.6 chardet 4.0.0 charset-normalizer 2.0.0 click 8.0.3 cloudpickle 2.0.0 colorama 0.4.4 cookiecutter 1.6.0 cryptography 35.0.0 dataclasses 0.8 debugpy 1.4.1 decorator 5.1.0 defusedxml 0.7.1 diff-match-patch 20200713 docutils 0.15.2 entrypoints 0.3 flake8 3.9.2 future 0.18.2 idna 3.1 imagesize 1.2.0 importlib-metadata 4.8.1 inflection 0.5.1 intervaltree 3.0.2 ipykernel 6.4.2 ipython 7.28.0 ipython-genutils 0.2.0 isort 5.9.3 jedi 0.18.0 Jinja2 3.0.2 jinja2-time 0.2.0 jsonschema 4.1.2 jupyter-client 6.1.12 jupyter-core 4.9.1 jupyterlab-pygments 0.1.2 keyring 23.2.1 lazy-object-proxy 1.6.0 MarkupSafe 2.0.1 matplotlib-inline 0.1.3 mccabe 0.6.1 mistune 0.8.4 mypackage 0.0 c:\users\quentin.peter\desktop\my package mypy-extensions 0.4.3 nbclient 0.5.4 nbconvert 6.2.0 nbformat 5.1.3 nest-asyncio 1.5.1 numpydoc 1.1.0 packaging 21.0 pandocfilters 1.5.0 paramiko 2.8.0 parso 0.8.2 pathspec 0.9.0 pexpect 4.8.0 pickleshare 0.7.5 pip 21.3.1 platformdirs 2.3.0 pluggy 1.0.0 poyo 0.5.0 prompt-toolkit 3.0.21 psutil 5.8.0 ptyprocess 0.7.0 pycodestyle 2.7.0 pycparser 2.20 pydocstyle 6.1.1 pyflakes 2.3.1 Pygments 2.10.0 pylint 2.7.2 pyls-spyder 0.4.0 PyNaCl 1.4.0 pyOpenSSL 21.0.0 pyparsing 3.0.3 PyQt5 5.12.3 PyQt5_sip 4.19.18 PyQtChart 5.12 PyQtWebEngine 5.12.1 pyrsistent 0.17.3 PySocks 1.7.1 pytest 6.2.5 pytest-qt 4.0.2 python-dateutil 2.8.2 python-lsp-black 1.0.0 python-lsp-jsonrpc 1.0.0 python-lsp-server 1.2.4 pytz 2021.3 pywin32 301 pywin32-ctypes 0.2.0 PyYAML 6.0 pyzmq 22.3.0 QDarkStyle 3.0.2 qstylizer 0.2.1 QtAwesome 1.0.3 qtconsole 5.1.1 QtPy 1.11.2 regex 2021.10.23 requests 2.26.0 rope 0.21.0 Rtree 0.9.7 setuptools 58.2.0 six 1.16.0 snowballstemmer 2.1.0 sortedcontainers 2.4.0 Sphinx 4.2.0 sphinxcontrib-applehelp 1.0.2 sphinxcontrib-devhelp 1.0.2 sphinxcontrib-htmlhelp 2.0.0 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.3 sphinxcontrib-serializinghtml 1.1.5 spyder 5.1.5 spyder-kernels 2.1.3 testpath 0.5.0 textdistance 4.2.2 three-merge 0.1.1 tinycss2 1.1.0 toml 0.10.2 tomli 1.2.2 tornado 6.1 traitlets 5.1.1 typed-ast 1.4.3 typing-extensions 3.10.0.2 ujson 4.2.0 urllib3 1.26.7 watchdog 2.1.6 wcwidth 0.2.5 webencodings 0.5.1 wheel 0.37.0 whichcraft 0.6.1 win-inet-pton 1.1.0 wrapt 1.12.1 yapf 0.31.0 zipp 3.6.0 ```

conda list

``` # packages in environment at C:\Users\quentin.peter\.conda\envs\spyder-env_tmp: # # Name Version Build Channel alabaster 0.7.12 py_0 conda-forge argh 0.26.2 pyh9f0ad1d_1002 conda-forge arrow 1.2.1 pyhd8ed1ab_0 conda-forge astroid 2.5.8 py38haa244fe_0 conda-forge async_generator 1.10 py_0 conda-forge atomicwrites 1.4.0 pyh9f0ad1d_0 conda-forge attrs 21.2.0 pyhd8ed1ab_0 conda-forge autopep8 1.6.0 pyhd8ed1ab_0 conda-forge babel 2.9.1 pyh44b312d_0 conda-forge backcall 0.2.0 pyh9f0ad1d_0 conda-forge backports 1.0 py_2 conda-forge backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge bcrypt 3.2.0 py38h294d835_1 conda-forge binaryornot 0.4.4 py_1 conda-forge black 21.9b0 pyhd8ed1ab_1 conda-forge bleach 4.1.0 pyhd8ed1ab_0 conda-forge brotlipy 0.7.0 py38h294d835_1001 conda-forge ca-certificates 2021.10.8 h5b45459_0 conda-forge certifi 2021.10.8 py38haa244fe_0 conda-forge cffi 1.14.6 py38hd8c33c5_1 conda-forge chardet 4.0.0 py38haa244fe_1 conda-forge charset-normalizer 2.0.0 pyhd8ed1ab_0 conda-forge click 8.0.3 py38haa244fe_0 conda-forge cloudpickle 2.0.0 pyhd8ed1ab_0 conda-forge colorama 0.4.4 pyh9f0ad1d_0 conda-forge cookiecutter 1.6.0 py38_1000 conda-forge cryptography 35.0.0 py38hb7941b4_1 conda-forge dataclasses 0.8 pyhc8e2a94_3 conda-forge debugpy 1.4.1 py38h885f38d_0 conda-forge decorator 5.1.0 pyhd8ed1ab_0 conda-forge defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge diff-match-patch 20200713 pyh9f0ad1d_0 conda-forge docutils 0.15.2 py38haa244fe_2 conda-forge entrypoints 0.3 pyhd8ed1ab_1003 conda-forge flake8 3.9.2 pyhd8ed1ab_0 conda-forge future 0.18.2 py38haa244fe_3 conda-forge icu 68.2 h0e60522_0 conda-forge idna 3.1 pyhd3deb0d_0 conda-forge imagesize 1.2.0 py_0 conda-forge importlib-metadata 4.8.1 py38haa244fe_0 conda-forge importlib_metadata 4.8.1 hd8ed1ab_0 conda-forge inflection 0.5.1 pyh9f0ad1d_0 conda-forge intervaltree 3.0.2 py_0 conda-forge ipykernel 6.4.2 py38h595d716_0 conda-forge ipython 7.28.0 py38h595d716_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge isort 5.9.3 pyhd8ed1ab_0 conda-forge jedi 0.18.0 py38haa244fe_2 conda-forge jinja2 3.0.2 pyhd8ed1ab_0 conda-forge jinja2-time 0.2.0 py_2 conda-forge jpeg 9d h8ffe710_0 conda-forge jsonschema 4.1.2 pyhd8ed1ab_0 conda-forge jupyter_client 6.1.12 pyhd8ed1ab_0 conda-forge jupyter_core 4.9.1 py38haa244fe_0 conda-forge jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge keyring 23.2.1 py38haa244fe_0 conda-forge lazy-object-proxy 1.6.0 py38h294d835_0 conda-forge libclang 11.1.0 default_h5c34c98_1 conda-forge libpng 1.6.37 h1d00b33_2 conda-forge libsodium 1.0.18 h8d14728_1 conda-forge libspatialindex 1.9.3 h39d44d4_4 conda-forge libzlib 1.2.11 h8ffe710_1013 conda-forge markupsafe 2.0.1 py38h294d835_0 conda-forge matplotlib-inline 0.1.3 pyhd8ed1ab_0 conda-forge mccabe 0.6.1 py_1 conda-forge mistune 0.8.4 py38h294d835_1004 conda-forge mypy_extensions 0.4.3 py38haa244fe_3 conda-forge nbclient 0.5.4 pyhd8ed1ab_0 conda-forge nbconvert 6.2.0 py38haa244fe_0 conda-forge nbformat 5.1.3 pyhd8ed1ab_0 conda-forge nest-asyncio 1.5.1 pyhd8ed1ab_0 conda-forge numpydoc 1.1.0 py_1 conda-forge openssl 1.1.1l h8ffe710_0 conda-forge packaging 21.0 pyhd8ed1ab_0 conda-forge pandoc 2.15 h8ffe710_0 conda-forge pandocfilters 1.5.0 pyhd8ed1ab_0 conda-forge paramiko 2.8.0 pyhd8ed1ab_0 conda-forge parso 0.8.2 pyhd8ed1ab_0 conda-forge pathspec 0.9.0 pyhd8ed1ab_0 conda-forge pexpect 4.8.0 pyh9f0ad1d_2 conda-forge pickleshare 0.7.5 py_1003 conda-forge pip 21.3.1 pyhd8ed1ab_0 conda-forge platformdirs 2.3.0 pyhd8ed1ab_0 conda-forge pluggy 1.0.0 py38haa244fe_1 conda-forge poyo 0.5.0 py_0 conda-forge prompt-toolkit 3.0.21 pyha770c72_0 conda-forge psutil 5.8.0 py38h294d835_1 conda-forge ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge pycodestyle 2.7.0 pyhd8ed1ab_0 conda-forge pycparser 2.20 pyh9f0ad1d_2 conda-forge pydocstyle 6.1.1 pyhd8ed1ab_0 conda-forge pyflakes 2.3.1 pyhd8ed1ab_0 conda-forge pygments 2.10.0 pyhd8ed1ab_0 conda-forge pylint 2.7.2 py38haa244fe_0 conda-forge pyls-spyder 0.4.0 pyhd8ed1ab_0 conda-forge pynacl 1.4.0 py38h31c79cd_2 conda-forge pyopenssl 21.0.0 pyhd8ed1ab_0 conda-forge pyparsing 3.0.3 pyhd8ed1ab_0 conda-forge pyqt 5.12.3 py38haa244fe_7 conda-forge pyqt-impl 5.12.3 py38h885f38d_7 conda-forge pyqt5-sip 4.19.18 py38h885f38d_7 conda-forge pyqtchart 5.12 py38h885f38d_7 conda-forge pyqtwebengine 5.12.1 py38h885f38d_7 conda-forge pyrsistent 0.17.3 py38h294d835_2 conda-forge pysocks 1.7.1 py38haa244fe_3 conda-forge python 3.8.12 h7840368_2_cpython conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python-lsp-black 1.0.0 pyhd8ed1ab_0 conda-forge python-lsp-jsonrpc 1.0.0 pyhd8ed1ab_0 conda-forge python-lsp-server 1.2.4 pyhd8ed1ab_0 conda-forge python_abi 3.8 2_cp38 conda-forge pytz 2021.3 pyhd8ed1ab_0 conda-forge pywin32 301 py38h294d835_0 conda-forge pywin32-ctypes 0.2.0 py38haa244fe_1003 conda-forge pyyaml 6.0 py38h294d835_0 conda-forge pyzmq 22.3.0 py38h09162b1_0 conda-forge qdarkstyle 3.0.2 pyhd8ed1ab_0 conda-forge qstylizer 0.2.1 pyhd8ed1ab_0 conda-forge qt 5.12.9 h5909a2a_4 conda-forge qtawesome 1.0.3 pyhd8ed1ab_0 conda-forge qtconsole 5.1.1 pyhd8ed1ab_0 conda-forge qtpy 1.11.2 pyhd8ed1ab_0 conda-forge regex 2021.10.23 py38h294d835_0 conda-forge requests 2.26.0 pyhd8ed1ab_0 conda-forge rope 0.21.0 pyhd8ed1ab_0 conda-forge rtree 0.9.7 py38h8b54edf_2 conda-forge setuptools 58.2.0 py38haa244fe_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge snowballstemmer 2.1.0 pyhd8ed1ab_0 conda-forge sortedcontainers 2.4.0 pyhd8ed1ab_0 conda-forge sphinx 4.2.0 pyh6c4a22f_0 conda-forge sphinxcontrib-applehelp 1.0.2 py_0 conda-forge sphinxcontrib-devhelp 1.0.2 py_0 conda-forge sphinxcontrib-htmlhelp 2.0.0 pyhd8ed1ab_0 conda-forge sphinxcontrib-jsmath 1.0.1 py_0 conda-forge sphinxcontrib-qthelp 1.0.3 py_0 conda-forge sphinxcontrib-serializinghtml 1.1.5 pyhd8ed1ab_0 conda-forge spyder 5.1.5 py38haa244fe_0 conda-forge spyder-kernels 2.1.3 py38haa244fe_0 conda-forge sqlite 3.36.0 h8ffe710_2 conda-forge testpath 0.5.0 pyhd8ed1ab_0 conda-forge textdistance 4.2.2 pyhd8ed1ab_0 conda-forge three-merge 0.1.1 pyh9f0ad1d_0 conda-forge tinycss2 1.1.0 pyhd8ed1ab_0 conda-forge toml 0.10.2 pyhd8ed1ab_0 conda-forge tomli 1.2.2 pyhd8ed1ab_0 conda-forge tornado 6.1 py38h294d835_1 conda-forge traitlets 5.1.1 pyhd8ed1ab_0 conda-forge typed-ast 1.4.3 py38h294d835_0 conda-forge typing_extensions 3.10.0.2 pyha770c72_0 conda-forge ucrt 10.0.20348.0 h57928b3_0 conda-forge ujson 4.2.0 py38h885f38d_0 conda-forge urllib3 1.26.7 pyhd8ed1ab_0 conda-forge vc 14.2 hb210afc_5 conda-forge vs2015_runtime 14.29.30037 h902a5da_5 conda-forge watchdog 2.1.6 py38haa244fe_0 conda-forge wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge webencodings 0.5.1 py_1 conda-forge wheel 0.37.0 pyhd8ed1ab_1 conda-forge whichcraft 0.6.1 py_0 conda-forge win_inet_pton 1.1.0 py38haa244fe_2 conda-forge wrapt 1.12.1 py38h294d835_3 conda-forge yaml 0.2.5 he774522_0 conda-forge yapf 0.31.0 pyhd8ed1ab_0 conda-forge zeromq 4.3.4 h0e60522_1 conda-forge zipp 3.6.0 pyhd8ed1ab_0 conda-forge zlib 1.2.11 h8ffe710_1013 conda-forge ```
dalthviz commented 2 years ago

@ccordoba12 @impact27 after checking the env details and the differences I was able to reproduce this with conda too.I wasn't able to reproduce it in my first attempt since I was using a .condarc that I forgot to remove when testing.

Also, as a workaround for this, I was able to enable the LSP with the package (mypackage) by creating a new env and changing the interpreter preference. This worked for me even when using a Spyder development installed version (Spyder installed in his own env with pip install -e .)

For the mypackage env I used:

conda create -n my-package
conda activate my-package
conda install -c conda-forge spyder-kernels
cd "my package"
pip install --user -e .

So seems like this issue only happens when installing the package in the env that the default interpreter uses?

ccordoba12 commented 2 years ago

So seems like this issue only happens when installing the package in the env that the default interpreter uses?

Ok, that's great info @dalthviz! We'll have to dig into the PyLSP logs to find what could be happening in this case.

mrclary commented 2 years ago

@impact27 @dalthviz, could #16429 or #16488 have a positive impact on this issue?