atom-community / ide-python

Python language support for Atom-IDE :atom: :snake:
https://atom.io/packages/ide-python
Other
236 stars 39 forks source link

Linting stops working or displaying in Atom with pyls > 0.31.2 #191

Open hermidalc opened 4 years ago

hermidalc commented 4 years ago

After upgrading pyls on conda-forge from 0.31.2 -> 0.31.3 or 0.31.4 then ide-python suddenly stops showing any lint comments/warnings/errors. When I downgrade back to 0.31.2 then everything shows up again.

Atom 1.42 (on linux) ide-python 1.5.0

timmy61109 commented 4 years ago

Me too, I can help the pack?

fangzhou-xie commented 4 years ago

I also have this problem but I still didn't get the linting after downgrading pyls to 0.31.2. I wonder if anyone has a solution for this?

timmy61109 commented 4 years ago

But my Windows system works fine, which is quite strange.

However, this kit is also dependent on Facebook's Atom IDE UI, and Facebook also stopped maintaining this kit. Maybe we should find a way to move to other UI interfaces, or whether we can make improvements in the dependent Atom IDE UI.

hermidalc commented 4 years ago

I also have this problem but I still didn't get the linting after downgrading pyls to 0.31.2. I wonder if anyone has a solution for this?

Not sure how you had linting working with 0.31.2, then upgraded to 0.31.3 or 0.31.4 and lost it, then downgraded back to 0.31.2 and linting doesn't come back. I performed the upgrade and downgrade a few times to make sure it was the version upgrade causing the problem and with each downgrade to 0.31.2 linting worked again. I would check there isn't something else you've done that is causing your problem.

fangzhou-xie commented 4 years ago

I also have this problem but I still didn't get the linting after downgrading pyls to 0.31.2. I wonder if anyone has a solution for this?

Not sure how you had linting working with 0.31.2, then upgraded to 0.31.3 or 0.31.4 and lost it, then downgraded back to 0.31.2 and linting doesn't come back. I performed the upgrade and downgrade a few times to make sure it was the version upgrade causing the problem and with each downgrade to 0.31.2 linting worked again. I would check there isn't something else you've done that is causing your problem.

Thank you! I have typed the command python -m pip install 'python-language-server[all]' again and nothing was installed (because version 0.31.2 has been installed already). Weird though, I got the linting back in my Atom now!

I have no idea why did that happen but I am glad the linting is back! I love this feature and thank you!

Faldrian commented 4 years ago

I installed ide-python for the first time and it does not work. I always get the message that pyls should be installed, but it is. I followed the instruction, even did the specific install of "0.31.2", as it seems to be the version that works for you. :)

When i to the command to check if it is installed (python -m pyls --help), I get:

usage: __main__.py [-h] [--tcp] [--host HOST] [--port PORT] [--check-parent-process] [--log-config LOG_CONFIG | --log-file LOG_FILE] [-v]

In the example in the README is says: usage: pyls instead of usage: __main__.py ... is there a problem and how do I fix it?

hermidalc commented 4 years ago

I installed ide-python for the first time and it does not work. I always get the message that pyls should be installed, but it is. I followed the instruction, even did the specific install of "0.31.2", as it seems to be the version that works for you. :)

When i to the command to check if it is installed (python -m pyls --help), I get:

usage: __main__.py [-h] [--tcp] [--host HOST] [--port PORT] [--check-parent-process] [--log-config LOG_CONFIG | --log-file LOG_FILE] [-v]

In the example in the README is says: usage: pyls instead of usage: __main__.py ... is there a problem and how do I fix it?

I’m pretty sure your problem is different than what is described in this issue. Not even certain it’s ide-python could be pyls or something else in your local setup or install.

Faldrian commented 4 years ago

I installed ide-python for the first time and it does not work. I always get the message that pyls should be installed, but it is. I followed the instruction, even did the specific install of "0.31.2", as it seems to be the version that works for you. :) When i to the command to check if it is installed (python -m pyls --help), I get: usage: __main__.py [-h] [--tcp] [--host HOST] [--port PORT] [--check-parent-process] [--log-config LOG_CONFIG | --log-file LOG_FILE] [-v] In the example in the README is says: usage: pyls instead of usage: __main__.py ... is there a problem and how do I fix it?

I’m pretty sure your problem is different than what is described in this issue. Not even certain it’s ide-python could be pyls or something else in your local setup or install.

crazy... I had to set the "Python Executable" to "/usr/bin/python" ... which is my default python which is called when you type "python". Thanks for the reply :)

vepain commented 4 years ago

Same problem for me:

Global versions

Tests

Thank you for your work

EDIT: It seems that pyflakes is broken with python 3.8 ... Associated log error: Python (pyls) stderr AttributeError: 'Checker' object has no attribute 'NAMEDEXPR'

https://github.com/PyCQA/pyflakes/pull/457

TEMPORARY SOLUTION: python3.8 -m pip uninstall pyflakes python3.8 -m pip install git+https://github.com/pycqa/pyflakes

hermidalc commented 4 years ago

@lgeiger no pressure, just wondering out of interest, are you not going to maintain ide-python anymore given that atom-ide-ui isn't developed and maintained by Facebook anymore?

I think atom-ide-ui, the language server protocol, and packages for each language based off it were some of the best things about Atom, including ide-python. I only had to install one conda package and one Atom package for each language I use and it came loaded with everything you need. Before that I had to install and set up a pair of packages for each individual programming tool I wanted. I guess I could go back to that.

lgeiger commented 4 years ago

@lgeiger no pressure, just wondering out of interest, are you not going to maintain ide-python anymore given that atom-ide-ui isn't developed and maintained by Facebook anymore?

@hermidalc Thanks for asking. I agree ide-python hasn't received enough attention from my side lately. Largely due to the fact that I now have a full time job instead of being a lazy student, I no longer have so much time and energy to maintain ide-python and answer issues. However this doesn't mean the project is abandoned. I still use it on a daily basis and will provide critical fixes, merge PRs or add support for new features from the language server. I really encourage everyone who is interested in seeing this project evolve further, to keep answering questions and help to improve the documentation and user experience of ide-python. I am more than happy to give commit access too people interested in helping maintain ide-python.

As a replacement for atom-ide-ui, I can highly recommend the community supported IDE packages which provide 80% of the functionality and are maintained by the Atom IDE community.

hermidalc commented 4 years ago

@hermidalc Thanks for asking. I agree ide-python hasn't received enough attention from my side lately. Largely due to the fact that I now have a full time job instead of being a lazy student, I no longer have so much time and energy to maintain ide-python and answer issues. However this doesn't mean the project is abandoned. I still use it on a daily basis and will provide critical fixes, merge PRs or add support for new features from the language server.

@lgeiger thanks for the response. The most pressing thing right now regarding this issue is that ide-python does not work anymore with newer versions of pyls, so would consider this a semi-critical issue.

I use ide-python every day like you for a long time and think it’s really great.

hermidalc commented 4 years ago

As a replacement for atom-ide-ui, I can highly recommend the community supported IDE packages which provide 80% of the functionality and are maintained by the Atom IDE community.

Thanks for pointing me to this page, I thought all the ide-* language packages needed atom-ide-ui so glad to hear there are some workarounds.

lgeiger commented 4 years ago

The most pressing thing right now regarding this issue is that ide-python does not work anymore with newer versions of pyls, so would consider this a semi-critical issue.

I am currently using pyls==0.31.8 and the latest versions of https://atom-ide-community.github.io/ instead of atom-ide-ui with Python 3.7.7 on macOS and I haven't run into any issues so far. So unfortunately I am not in a good place to debug those issues.

hermidalc commented 4 years ago

The most pressing thing right now regarding this issue is that ide-python does not work anymore with newer versions of pyls, so would consider this a semi-critical issue.

I am currently using pyls==0.31.8 and the latest versions of https://atom-ide-community.github.io/ instead of atom-ide-ui with Python 3.7.7 on macOS and I haven't run into any issues so far. So unfortunately I am not in a good place to debug those issues.

It might be that many of us are still using atom-ide-ui based Atom IDE and it’s the root cause of the problem. I will do the Atom IDE Community workaround to packages and will report back if all fixed then close this issue if all is ok.

timmy61109 commented 4 years ago

I like this kit myself, and it is relatively stable compared to Linter related kits. Currently I still use Linter, because the error problem persists and cannot help me check it.

Has anyone continued to improve the atom-ide-ui suite that has been stopped? If atom-ide-ui is improved and pretty good, can I use the improved kit? How can I help if I want to help this project?

okaminoseishin commented 4 years ago

@hermidalc I already checked this few hours ago. No, with atom-ide-community issue still the same, it's not atom-ide-ui-related. Not all pyls versions was checked in between 0.31.2-0.31.9, but, as @ProfesseurChep noted above, works with 0.31.2, does not work with latter.

apm list --installed --enabled Community Packages (15) /home/\/.atom/packages ├── atom-ide-datatip@0.11.2 ├── atom-ide-definitions@0.3.3 ├── atom-ide-markdown-service@1.2.3 ├── atom-ide-outline@1.1.1 ├── atom-ide-signature-help@0.7.1 ├── atom-python-virtualenv@1.0.4 ├── busy-signal@2.0.1 ├── docblock-python@0.17.4 ├── file-icons@2.1.39 ├── hey-pane@1.2.0 ├── hyperclick@0.1.5 ├── ide-python@1.5.0 ├── intentions@1.1.5 ├── linter@2.3.1 └── linter-ui-default@1.8.1
hermidalc commented 4 years ago

@hermidalc I already checked this few hours ago. No, with atom-ide-community issue still the same, it's not atom-ide-ui-related. Not all pyls versions was checked in between 0.31.2-0.31.9, but, as @ProfesseurChep noted above, works with 0.31.2, does not work with latter.

apm list --installed --enabled Community Packages (15) /home//.atom/packages ├── atom-ide-datatip@0.11.2 ├── atom-ide-definitions@0.3.3 ├── atom-ide-markdown-service@1.2.3 ├── atom-ide-outline@1.1.1 ├── atom-ide-signature-help@0.7.1 ├── atom-python-virtualenv@1.0.4 ├── busy-signal@2.0.1 ├── docblock-python@0.17.4 ├── file-icons@2.1.39 ├── hey-pane@1.2.0 ├── hyperclick@0.1.5 ├── ide-python@1.5.0 ├── intentions@1.1.5 ├── linter@2.3.1 └── linter-ui-default@1.8.1

@lgeiger @okaminoseishin what versions of Atom are you using? @okaminoseishin what OS are you using?

okaminoseishin commented 4 years ago

OS: Arch Linux

atom --version Atom: 1.45.0 Node: 10.11.0 Electron: 4.2.7 Chrome: 69.0.3497.128

EDIT: all checks was done inside clean virtualenv, pointing atom to it's interpreter.

hermidalc commented 4 years ago

OS: Arch Linux atom --version

EDIT: all checks was done inside clean virtualenv, pointing atom to it's interpreter.

I also am using (Fedora) Linux. Sorry that I haven't had a chance to also set up a test with the Atom IDE Community packages and I appreciate it. Could you report (for @lgeiger) what errors you are seeing in the Atom Developer Tools Console? If ide-python isn't working you typically should see errors there. Since he isn't having a problem with his setup and versions on Mac, this would be helpful.

hermidalc commented 4 years ago

OS: Arch Linux atom --version EDIT: all checks was done inside clean virtualenv, pointing atom to it's interpreter.

I also am using (Fedora) Linux. Sorry that I haven't had a chance to also set up a test with the Atom IDE Community packages and I appreciate it. Could you report (for @lgeiger) what errors you are seeing in the Atom Developer Tools Console? If ide-python isn't working you typically should see errors there. Since he isn't having a problem with his setup and versions on Mac, this would be helpful.

Actually sorry I don't see any errors in the Developer Tools Console pyls looks to be working fine but it doesn't display any lint anything.

okaminoseishin commented 4 years ago

@hermidalc try to close all opened files, restart editor, activate virtualenv if applicable, open console and select file from tree view.

@lgeiger console.log

gachteme commented 4 years ago

pip install 'python-language-server[all]'==0.31.2 and restart of Atom did it for me. MacOS Catalina 10.15.4, python 3.6.4, Atom 1.45.0 with atom-ide-ui Have we verified that these newer pyls versions are working at all?

hermidalc commented 4 years ago

I've done a fresh install of latest Atom 1.45 (on Linux), latest Atom IDE Community packages and requirements, and new conda environment with:

python                    3.8.2           h8356626_5_cpython    conda-forge
python-jsonrpc-server     0.3.4                      py_0    conda-forge
python-language-server    0.31.9           py38h32f6830_0    conda-forge

I tested individually turning on/off ide-python modules, mccabe, pycodestyle, pydocstyle, and pylint all appear to work.

But both flake8 and PyFlakes do not work and they give many pyls stderr yellow colored warnings (which look like errors) and occassionally red color errors like:

/home/hermidalc/.atom/packages/ide-python/node_modules/atom-languageclient/build/lib/logger.js:12 Python (pyls) rpc.sendRequest textDocument/hover threw ResponseError: TypeError: 'NoneType' object is not callable
    at handleResponse (/home/hermidalc/.atom/packages/ide-python/node_modules/vscode-jsonrpc/lib/main.js:436:48)
    at processMessageQueue (/home/hermidalc/.atom/packages/ide-python/node_modules/vscode-jsonrpc/lib/main.js:263:17)
    at Immediate.setImmediate (/home/hermidalc/.atom/packages/ide-python/node_modules/vscode-jsonrpc/lib/main.js:247:13)
    at runCallback (timers.js:694:18)
    at tryOnImmediate (timers.js:665:5)
    at processImmediate (timers.js:647:5)
error @ /home/hermidalc/.atom/packages/ide-python/node_modules/atom-languageclient/build/lib/logger.js:12
/home/hermidalc/.atom/packages/atom-ide-datatip/lib/datatip-manager.js:342 ResponseError: TypeError: 'NoneType' object is not callable
    at handleResponse (/home/hermidalc/.atom/packages/ide-python/node_modules/vscode-jsonrpc/lib/main.js:436:48)
    at processMessageQueue (/home/hermidalc/.atom/packages/ide-python/node_modules/vscode-jsonrpc/lib/main.js:263:17)
    at Immediate.setImmediate (/home/hermidalc/.atom/packages/ide-python/node_modules/vscode-jsonrpc/lib/main.js:247:13)
    at runCallback (timers.js:694:18)
    at tryOnImmediate (timers.js:665:5)
    at processImmediate (timers.js:647:5)

The many pyls errors are the same as what @okaminoseishin showed in the attached console.log.

So there is clearly something going wrong and it's with flake8 and PyFlakes modules and how they are working with pyls and ide-python.

hermidalc commented 4 years ago

What's even worse is that python-language-server=0.31.2 is not installable from conda-forge anymore, because for some reason it and certain other 0.31.x versions are labeled broken. So if you have conda-forge based envs (which I think most do) then it's not possible to get a working ide-python and atom-ide-* environment, at least on Linux, anymore.

So for now I'm saying goodbye ide-python and atom-ide-* and going to linter based Atom packages as these all work.

hermidalc commented 4 years ago

Maybe this is a bug with pyls on Linux and not ide-python???

hermidalc commented 4 years ago

Actually I found with PyFlakes and pylint I do not get linting displayed if the source code file is too many lines? No console warnings or errors. I have an example script that is over 1900 lines long. If I cut out lines to <1900 then suddenly the PyFlakes and pylint linting starts working, and the moment I paste the lines back then suddenly linting disappears! @lgeiger do you think this is actually an issue with ide-python or with pyls?

hermidalc commented 4 years ago

What's even worse is that python-language-server=0.31.2 is not installable from conda-forge anymore, because for some reason it and certain other 0.31.x versions are labeled broken. So if you have conda-forge based envs (which I think most do) then it's not possible to get a working ide-python and atom-ide-* environment, at least on Linux, anymore.

I could actually get python-language-server=0.31.2 reinstalled with atom-ide-* and ide-python. Looks like the potential issue(s) on Linux with flake8 and possibly PyFlakes are due to pyls. Will hope to see what they say in the issue.

hermidalc commented 4 years ago

@timmy61109 @mark-fangzhou-xie @vepain @okaminoseishin @gachteme could you please also comment that pyls >0.31.2 flak38 and pyflakes plugins are also not working for you in the pyls issue I opened https://github.com/palantir/python-language-server/issues/769?

It would help get the ball rolling over there. I've tested as of 0.31.10 it doesn't work. Same pyls errors in Atom dev console when flake8 or pyflakes plugins are enabled. If you disable them other plugins worked at least for me.

timmy61109 commented 4 years ago

@hermidalc Ok.

hermidalc commented 4 years ago

@lgeiger et al. Does anyone know how to get more extensive Atom debug logging of it's interactions with pyls? (referring to @ccordoba12 says he needs in https://github.com/palantir/python-language-server/issues/769#issuecomment-616573010).

In the Atom dev console I've tried config.set('core.debugLSP', true) but that doesn't give me more logging of the problem than what I've already attached to the OP in #769.

You will see the only error you see when running python-language-server>0.31.2 with ide-python flake8 or pyflakes plugins turned on is

Python (pyls) stderr TypeError: expected str, bytes or os.PathLike object, not NoneType

Without more logging and better stack trace of what's going on it will be hard to figure out what the source of the issue is, whether its from pyls or Atom itself.

hermidalc commented 4 years ago

Thanks to @okaminoseishin ++ for seeing that the log posted on palantir/python-language-server#769 does indeed show the stack trace all the way down to pyls... into the pyls flake8 plugin code and the subprocess calling code where the error is generated.

Now we are being told in that issue that you get this error if flake8 isn't installed, but my OP shows I clearly have it installed in the conda env (with conda create -c conda-forge -n pyls-test python-language-server and it installs flake8 and all the other dependencies into the env) and that I'm running Atom from a shell with that env activated.

I also mentioned that it really cannot be that it isn't installed, because if you downgrade to pyls 0.31.2 in that same env it only changes that conda package and then you restart Atom and everything works. So culprit looks like pyls? I also said that a bunch of us are getting the same issue and the likelihood that something as obvious as not having flake8 installed is basically zero.

@timmy61109 @mark-fangzhou-xie @vepain @gachteme if you want to also give your feedback in palantir/python-language-server#769 would be helpful. As you can see in thread there everything I mentioned simply gets shot down as if I'm simply wrong and cannot be helped. I've been through these situations before, we are wrong until we finally prove that we are right and then we don't get any apology...

vepain commented 4 years ago

Hello @hermidalc and everyone,

Very sorry for not responding you, but I am currently very busy I have tested linter packages in atom, not uid I used :

- linter
- linter-ui-default
- linter-flake8

And disabled (to make sure to have no corruptions with linters) :

- atom-ide-ui (uninstalled as recommanded by @lgeiger)
- ide-python

Versions :

python3.8 (/usr/local/bin/python3.8)
pycodestyle==2.5.0
pydocstyle==5.0.2
pyflakes==2.1.1
flake8==3.7.9
python-language-server==0.31.9

And it works for linter (at the exception that some errors with flake8 are not shown https://github.com/AtomLinter/linter-flake8/issues/720, but I think it is due to linter-flake8 package's output parser)

I have noted that I cannot change in ide-python the path of flake8 or pycodestyle in the section Pyls Configuration Sources, I think it should be fixed because the Pyls error is concerning an ask for a PathLike object (str, pathlib.Path ...) and not None type

EDIT : Because it is an enumerate section in the package.json, you should allow putting absolute path maybe, but normally, it should work with commands (if, of course, the commands flake8 or pycodstyle are pointing to the correct respected versions)

micahg commented 3 years ago

Hi,

I was able to work around this problem... my stack:

I had to uninstall some default packages with pip, but I did get it working after running:

python3.8 -m pip install python-language-server[all]==0.29.0

And then pointing ide-python at /usr/bin/python3.8 (not sure if this bit was actually necessary).

Thanks everyone!

edit I have better luck with 1.6.2 of ide-python -- specifically, if I correct a linted warning it goes away with 1.6.2 whereas with 1.7.1 it does not.

codecypher commented 2 years ago

I was getting "Provider is unavailable" message in Outline pane. I tried previous versions of pyls but it did not work. I decided to rename the atom packages directory and reinstall the packages given above by @okaminoseishin and all is working now. Then I installed some of the packages (not all) that I had before and it works great now. I assume there was some kind of package version conflicts.