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

Intellisense doesn't support types and var provided from a call to "%run <notebook.ipynb>" (was makes mistakes every 2-3 lines of my code in Jupyter Notebook #6987

Closed
sindzicat opened this issue Aug 6, 2021 · 8 comments
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster notebook-intellisense Intellisense & other language features in notebook cells for any language

Comments

@sindzicat
Copy link

sindzicat commented Aug 6, 2021

Environment data

  • VS Code version: 1.59.0 (system setup)
  • Jupyter Extension version (available under the Extensions sidebar): v2021.8.1195043623
  • Python Extension version (available under the Extensions sidebar): v2021.8.1102490946
  • Pylance Extension version (available under the Extensions sidebar): v2021.8.0
  • OS (Windows | Mac | Linux distro) and version: Windows 7
  • Python and/or Anaconda version: Python 3.8.9 64-bit
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Jupyter server running: Local

Expected behaviour

Correct code is detected as corrected one by Pylance

Actual behaviour

Let's look this cell in Notebook:

image

Code in this cell is correct. I'm sure about this, because I run it, and it worked as expected. But Pylance disagree with me:

image

"PrettyTable" is not defined, but it's defined...

image

"table" is not defined, but it's defined in current code cell...

image

"apdtable" is not defined, but I even didn't typed such word. Anyway, there is no such word in my code.

image

"dot_align" is not defined, but it's defined...

And this is only ONE code cell! It's very annoying and makes impossible and very hard to works with notebooks.

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. XXX

Logs

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

XXX

@sindzicat sindzicat added the bug Issue identified by VS Code Team member as probable bug label Aug 6, 2021
@sindzicat
Copy link
Author

I need to add, that I use

%run mynotebook.ipynb

in the first code cell. So, PrettyTable, numpy as np and some other variables are defined in extra notebook.

@sindzicat
Copy link
Author

I «fixed» my problem, using this comment at the top of notebook:

#type: ignore

It seems for me, that using %run notebook.ipynb is the main source of Pylance problems. I splitted my big notebook into several small parts and load previous part via %run. So, Python knows about variables from other Notebooks, but Pylance not.

@greazer greazer added this to the August 2021 milestone Aug 6, 2021
@greazer greazer added notebook-intellisense Intellisense & other language features in notebook cells for any language bug Issue identified by VS Code Team member as probable bug and removed bug Issue identified by VS Code Team member as probable bug needs-triage labels Aug 6, 2021
@greazer greazer removed this from the August 2021 milestone Aug 9, 2021
@greazer greazer changed the title Pylance makes mistakes every 2-3 lines of my code in Jupyter Notebook Pylance doesn't support %run <notebook.ipynb> (was makes mistakes every 2-3 lines of my code in Jupyter Notebook Aug 9, 2021
@greazer greazer changed the title Pylance doesn't support %run <notebook.ipynb> (was makes mistakes every 2-3 lines of my code in Jupyter Notebook Intellisense doesn't support types and var provided from a call to "%run <notebook.ipynb>" (was makes mistakes every 2-3 lines of my code in Jupyter Notebook Aug 9, 2021
@greazer greazer added this to the October 2021 milestone Oct 10, 2021
@greazer greazer removed this from the Long Discussions milestone May 16, 2022
@IanMatthewHuff IanMatthewHuff removed their assignment Nov 10, 2022
@stevenlis
Copy link

I'm having this issue:
CS-9PcmOrQE
Does it relate to this issue as well?

@DonJayamanne
Copy link
Contributor

@StevenLi-DS @sindzicat
This should now work with the latest release bits.

Please could you install the latest version of VS Code 1.74 and the latest versions of Jupyter, Python and Pylance extensions and let me know whether this has been resoved.

@DonJayamanne DonJayamanne added the info-needed Issue requires more information from poster label Dec 8, 2022
@stevenlis
Copy link

@DonJayamanne Indeed, the problem is solved with the latest versions, thanks!

@sindzicat
Copy link
Author

@DonJayamanne, yes it's fixed! Many thanks! 👍

@rogerlga
Copy link

rogerlga commented Mar 4, 2023

I can still reproduce the error reported by @StevenLi-DS #6987 (comment):

image

Imported modules are not recognized either:

image

All related extensions are up-to-date at the time I'm writing this:

image

Is this somehow related to microsoft/vscode#154983?
Please check if you can also reproduce it to reopen this issue or if it's just with me.

@stevenlis
Copy link

@rogerlga Might be a Pylance issue here #13018

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster notebook-intellisense Intellisense & other language features in notebook cells for any language
Projects
None yet
Development

No branches or pull requests

8 participants