Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vscode intellisense not working with PyTorch

I'm using a virtual environment and I have selected the right interpreter.

Now even after I cmd + p > reload window and

import torch.nn as nn

I don't get any suggestion righting nn. on vscode 1.31.1

like image 976
ted Avatar asked Mar 12 '19 14:03

ted


2 Answers

I found jedi to be quite slow but the recently released Pylance extension works like a charm: https://github.com/microsoft/pylance-release

and then update your settings

"python.languageServer": "Pylance"
like image 196
ted Avatar answered Oct 17 '22 01:10

ted


Faced the same problem with vscode 1.42. Resolved the problem by going to Settings, Changing Python: Language server from Microsoft to Jedi. Now I can see autocomplete with torch.nn.

like image 35
Umar Karim Avatar answered Oct 17 '22 03:10

Umar Karim