Open impact27 opened 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.
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.
@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.
So @dalthviz, does this mean that the error appears only when Spyder is installed in development mode?
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
Checking with the latest steps @impact27 posted Ctrl +Click
worked for mypackage
on my setup. Just in case the result env spec:
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?
pip list
conda list
@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?
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.
@impact27 @dalthviz, could #16429 or #16488 have a positive impact on this issue?
Issue Report Checklist
conda update spyder
(orpip
, if not using Anaconda)jupyter qtconsole
(if console-related)spyder --reset
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:
my package
mypackage
my package/setup.py
with:setup(name='mypackage', version='0.0', packages=['mypackage'], )
def a(): print(0)
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)