tomv564 / pyls-mypy

Mypy plugin for the Python Language Server
MIT License
110 stars 62 forks source link

Language server error when pyls-mypy is installed #14

Closed dpkatz closed 5 years ago

dpkatz commented 5 years ago

Hi -

when I use pyls and pyls-mypy on a python file in Emacs everything works fine for a while. Documentation pops up, function signatures are shown inline, etc. Then, after perhaps a few dozen interactions I get the following (repeatable) error:

Error from the Language Server: jedi.api.environment.InvalidPythonEnvironment: Could not get version information for ’/Users/dkatz/.local/share/virtualenvs/lsp_example_project-cOuqdw3J/bin/python3.7’: OSError(24, ’Too many open files’) (Invalid Parameters) [16 times]

Once that error is raised, I see it every time the cursor hits any interesting piece of code.

If I uninstall pyls-mypy from my python environment, the problem goes away.

I can trigger this behavior even with a completely trivial file like this:

import sys

by just moving the cursor on and off of sys several times (which I assume triggers communication with the server each time as it pops up the module information).

If I watch the number of python processes as a function of how I interact with the server I see something like this (taken from moving the cursor on and off of sys in the trivial file mentioned above):

event effect python processes
Open python file in Emacs 5
Put cursor on sys pop up module info 13
Move cursor off sys module info popup goes away 13
Put cursor back on sys pop up module info 18
Move cursor off sys module info goes away 19
Put cursor back on sys pop up module info 23
Move cursor off sys module info goes away 24
Put cursor back on sys pop up module info 28
Move cursor off sys module info goes away 29
Put cursor back on sys pop up module info 34
Move cursor off sys module info goes away 35
Put cursor back on sys pop up module info 39
Move cursor off sys module info goes away 40
Put cursor back on sys pop up module info 44
Move cursor off sys module info goes away 45
Put cursor back on sys pop up module info 49
Move cursor off sys module info goes away 50

and so on until I got the error with 81 python processes running. The number 81 seems to be pretty consistent for me - I get that number of processes with different files and different interactions (e.g. module info, function info, displaying function signatures, etc.)

Any ideas?

Thanks.

Dan

\ \

Setup:

OS: macOS 10.13.6

Python: 3.7.0 Python package installer: pipenv Python packages:

dpkatz commented 5 years ago

Actually, it looks like this is really an issue in pyls that is just exacerbated by pyls-mypy. The relevant issue for pyls is palantir/python-language-server#431.

Closing this since the issue is elsewhere.

tomv564 commented 5 years ago

Thanks for updating this issue, I'll keep an eye on your report to the language server!