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

parse error on magic statement on ipython mode. #5808

Open
ZJDATY opened this issue Apr 26, 2024 · 9 comments
Open

parse error on magic statement on ipython mode. #5808

ZJDATY opened this issue Apr 26, 2024 · 9 comments
Assignees
Labels
bug Something isn't working user responded Was "waiting for user response" and they responded

Comments

@ZJDATY
Copy link

ZJDATY commented Apr 26, 2024

When I open an. ipynb file using vscode, it always generates strange errors. Clearly able to operate normally.
image
image
The meaning of this error is "should be an expression".

image
Unable to import 'requests' from source parsing

I am using the latest version of VScode that comes with Pylance.

Pylance version:v2024.4.1

vscode version: 1.88.1 (user setup)
提交: e170252f762678dec6ca2cc69aba1570769a5d39
日期: 2024-04-10T17:41:02.734Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Windows_NT x64 10.0.22631

image

@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Apr 26, 2024
@heejaechang
Copy link
Contributor

sounds like our tokenzier/parser is not ignoring % statement properly in ipython mode.

for requests, it is complaining that you didn't install requests packages in the openvino env.

@ZJDATY
Copy link
Author

ZJDATY commented Apr 26, 2024

sounds like our tokenzier/parser is not ignoring % statement properly in ipython mode.

for requests, it is complaining that you didn't install requests packages in the openvino env.

I have install requests and it can running success.

@heejaechang
Copy link
Contributor

I have install requests and it can running success.

how about providing us a log to see what python paths (libraries) we got? if you are using latest pylance (104), then there should be Pylance: start logging/stop logging command.

can you provide us the log produced by the command to us?

@rchiodo
Copy link
Contributor

rchiodo commented Apr 26, 2024

The requests problem might be a dupe of this issue:
microsoft/vscode#199800

Meaning we don't know which kernel is selected.

The log should show that though.

@ZJDATY
Copy link
Author

ZJDATY commented Apr 26, 2024

sounds like our tokenzier/parser is not ignoring % statement properly in ipython mode.

for requests, it is complaining that you didn't install requests packages in the openvino env.

It seems to be that it doesn't detect my openvino environment correctly. I'm using a virtual python environment under conda.

@heejaechang
Copy link
Contributor

so, it probably is the dup of the bug Rich linked, then.

@debonte debonte added the waiting for user response Requires more information from user label Apr 27, 2024
@ZJDATY
Copy link
Author

ZJDATY commented Apr 27, 2024

@heejaechang @rchiodo After reading your reply, it may have been caused by a kernel link error, so I tried switching the kernel multiple times and restarted VSCode and Windows 11. The error regarding import has disappeared now, it seems that the link is correct. But the first mistake still exists.
image
image

pyright-18848-KKlrxNNpgVLY.zip

@github-actions github-actions bot added user responded Was "waiting for user response" and they responded and removed waiting for user response Requires more information from user labels Apr 27, 2024
@ZJDATY
Copy link
Author

ZJDATY commented Apr 27, 2024

I put %pip install -q "matplotlib>=3.4" outside and it won't report any errors.

image

@heejaechang heejaechang changed the title Using the vscode plugin, false alarms occur in Jupyter. parse error on magic statement on ipython mode. Apr 29, 2024
@heejaechang
Copy link
Contributor

ya, first issue looks like this

sounds like our tokenzier/parser is not ignoring % statement properly in ipython mode.

looks like there is a bug around this - https://github.com/microsoft/pyright/blob/main/packages/pyright-internal/src/parser/tokenizer.ts#L450

@heejaechang heejaechang added bug Something isn't working and removed needs repro Issue has not been reproduced yet labels Apr 29, 2024
@debonte debonte assigned heejaechang and rchiodo and unassigned debonte Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working user responded Was "waiting for user response" and they responded
Projects
None yet
Development

No branches or pull requests

4 participants