Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linting for certain pytorch classes missing #5635

Closed
Genius1237 opened this issue May 15, 2019 · 3 comments
Closed

Linting for certain pytorch classes missing #5635

Genius1237 opened this issue May 15, 2019 · 3 comments
Assignees

Comments

@Genius1237
Copy link

Genius1237 commented May 15, 2019

Environment data

  • VS Code version: 1.33.1
  • Extension version (available under the Extensions sidebar): 2019.4.12954
  • OS and version: Ubuntu 18.04
  • Python version (& distribution if applicable, e.g. Anaconda): python 3.6 from Ubuntu 18.04 repo
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions: pytorch 1.1.0, pylint

Expected behaviour

Linting should work for pytorch classes like torch.tensor,torch.float, torch.ones, torch.zeros and torch.zeros

Actual behaviour

Linting does not work. Shows a red line under torch.
image

Steps to reproduce:

  1. Write any code calling the aforementioned pytorch classes.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Starting Jedi Python language engine.
##########Linting Output - pylint##########
************* Module rl
75,18,error,not-callable:torch.tensor is not callable
75,57,error,no-member:Module 'torch' has no 'float' member
96,34,error,no-member:Module 'torch' has no 'log' member
130,18,error,not-callable:torch.tensor is not callable
130,57,error,no-member:Module 'torch' has no 'float' member
150,12,error,not-callable:torch.tensor is not callable
151,17,error,no-member:Module 'torch' has no 'cat' member
160,38,error,no-member:Module 'torch' has no 'log' member

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

This issue pytorch/pytorch#16996 (comment) has been fixed by pytorch on their end and the errors are with VS code. Another user pytorch/pytorch#16996 (comment) has reported that the error does not appear with pycharm, but only with VS Code

@ghost ghost added the triage-needed Needs assignment to the proper sub-team label May 15, 2019
@karrtikr
Copy link

karrtikr commented May 15, 2019

##########Linting Output - pylint##########

@Genius1237 You are using pylint as your linter, and it seems like pylint does not work well with pytorch (See this). Please open this issue on their repository.

As a temporary fix, I suggest you to choose another suitable linter which supports pytorch (flake8 seems to work fine). To do that,
Go to command palette Ctrl + Shift + P -> Select linter -> flake8

@karrtikr karrtikr self-assigned this May 15, 2019
@karrtikr karrtikr added info-needed Issue requires more information from poster triage labels May 15, 2019
@ghost ghost removed triage-needed Needs assignment to the proper sub-team labels May 15, 2019
@Genius1237
Copy link
Author

Genius1237 commented May 15, 2019

Looking at this, I would say that pycharm uses their own custom linter. So it is possible that the error is not on VS Code's end.

flake8 does work. It did also remind me how terrible my code is...

Is it possible to do a comparison of every linting feature here and in pycharm before closing this, just to be sure that there is feature parity?

@karrtikr
Copy link

karrtikr commented May 15, 2019

So it is possible that the error is not on VS Code's end.

This is for sure not a BUG on vscode's end, which is why I have to close this issue. The linting features here directly come from linters, so it's not a pycharm vs vscode thing.

Also unfortunately, I do know much about the pycharm linter (or pylint). So I recommend you to please find other platforms to discuss the pros and cons of the pycharm linter and other linters. Hope you understand, closing this.

@ghost ghost removed info-needed Issue requires more information from poster triage labels May 15, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants