That is a Pylance error.

You can create a pyrightconfig.json file at the root of your workspace and define the files to be exclude-d from analysis or completely ignore-d:

{
    "ignore": [
        "**/*.ipynb",
    ],
}

You can even list up specific filenames:

{
    "ignore": [
        "notimportant.ipynb",
        "test.ipynb",
    ],
}

Historical Notes:

It initially didn't work for Jupyter Notebooks (.ipynb):
https://github.com/microsoft/pylance-release/issues/2135

This happens because pyright doesn't see the file as a "*.ipynb". The file is being preprocessed (to combine all of the cells) in the notebook by the VS Code Python extension, and the resulting combined file is then passed to pyright for analysis.

The pylance team is actively working on changing the way this works. I'm going to transfer this bug to the pylance-release repo so it gets the attention it deserves.

That Github issue has since been resolved the fix was deployed as part of pylance 2022.8.51: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#2022851-31-august-2022-prerelease

Notable changes:

  • ...
  • Bug Fix: Ignoring *.ipynb files does not work (pylance-release#2135)

If it somehow still does not work, check the version of pylance on your VS Code.

Answer from Gino Mempin on Stack Overflow
🌐
GitHub
github.com › microsoft › pylance-release › blob › main › docs › settings › python_analysis_ignore.md
pylance-release/docs/settings/python_analysis_ignore.md at main · microsoft/pylance-release
4 weeks ago - The python.analysis.ignore setting in Pylance allows you to specify paths to files or directories whose diagnostic output (errors and warnings) should be suppressed.
Author   microsoft
Discussions

Disable specific Pylance linting messages in VS Code settings.json like with "python.linting.pylintArgs" - Stack Overflow
When Pylance was introduced, I filed a question on how to generally customize Pylance linting. Here, one can find a few ways to customize Pylance, but there is nothing about how to suppress, mute or More on stackoverflow.com
🌐 stackoverflow.com
Ignore flag for files and folders
It's very common to have a virtualenv folder in a project directory. Python files in a virtualenv should be skipped by Pylance, either by default (.venv, site-packages, etc) or via a configurable ignore/exclude setting. More on github.com
🌐 github.com
19
September 25, 2020
Allow line level suppression of specific errors
When using PyLint i can put a comment after an import to ignore an import failure of that specific import as below: from airflow.models import BaseOperator # pylint: disable=import-error I can't find a way to do the same using PyLance. I... More on github.com
🌐 github.com
37
August 3, 2020
visual studio code - Ignore Pylance missing imports - Stack Overflow
is there a pylance specific ignore? More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitHub
github.com › microsoft › pylance-release › blob › main › docs › settings › python_analysis_exclude.md
pylance-release/docs/settings/python_analysis_exclude.md at main · microsoft/pylance-release
This means you can include broad directories and then fine-tune specific exclusions. The python.analysis.ignore setting specifies paths whose diagnostic output (errors and warnings) should be suppressed, even if they are included in the analysis.
Author   microsoft
🌐
GitHub
github.com › microsoft › pylance-release › issues › 422
Ignore flag for files and folders · Issue #422 · microsoft/pylance-release
September 25, 2020 - It's very common to have a virtualenv folder in a project directory. Python files in a virtualenv should be skipped by Pylance, either by default (.venv, site-packages, etc) or via a configurable ignore/exclude setting.
Author   pikeas
🌐
Microsoft Developer Blogs
devblogs.microsoft.com › dev blogs › microsoft for python developers blog › python in visual studio code – october 2022 release
Python in Visual Studio Code - October 2022 Release - Microsoft for Python Developers Blog
October 13, 2022 - Within each of these settings, you can specify paths of directories or files that should be included, excluded, or ignored for Pylance diagnostic output.
🌐
GitHub
github.com › microsoft › pylance-release › issues › 196
Allow line level suppression of specific errors · Issue #196 · microsoft/pylance-release
August 3, 2020 - When using PyLint i can put a comment after an import to ignore an import failure of that specific import as below: from airflow.models import BaseOperator # pylint: disable=import-error I can't find a way to do the same using PyLance. I...
Author   MrJoosh
Find elsewhere
🌐
GitHub
github.com › microsoft › pylance-release › issues › 5896
Pylance still report problems in excluded or ignored directories, even in a closed file · Issue #5896 · microsoft/pylance-release
May 18, 2024 - Type: Bug Add a directory in "python.analysis.ignore" and "python.analysis.exclude" Leave a problem in the py or ipynb file in this directory Close the file Extension version: 2024.5.1 VS Code version: Code 1.89.1 (dc96b837cf6bb4af9cd736...
Published   May 18, 2024
Author   Saltsmart
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Pylance - Visual Studio Marketplace
2 weeks ago - Extension for Visual Studio Code - A performant, feature-rich language server for Python in VS Code
🌐
GitHub
github.com › microsoft › pylance-release › issues › 642
Allow users to blacklist certain folders · Issue #642 · microsoft/pylance-release
November 23, 2020 - Unfortunately, pylance check that folder and I get 1000+ errors....
Author   ierezell
🌐
GitHub
github.com › microsoft › pylance-release › issues › 929
Is there a setting to turn off specific errors displayed by Pylance? · Issue #929 · microsoft/pylance-release
February 9, 2021 - Is there a setting to turn off specific errors displayed by Pylance? When we use the Pylance language service, sometimes it will display some errors or warnings in the code. Is it possible to turn ...
Author   Jill-Cheng
🌐
GitHub
github.com › microsoft › pylance-release › blob › main › docs › settings › python_analysis_include.md
pylance-release/docs/settings/python_analysis_include.md at main · microsoft/pylance-release
Interaction with exclude: The python.analysis.exclude setting specifies paths to directories or files that Pylance should ignore, even if they are included in include. Paths specified in exclude take precedence over those in include.
Author   microsoft
🌐
Readthedocs
micropython-stubs.readthedocs.io › en › main › 22_vscode.html
Configuring VSCode, Pylance or Pyright — Micropython-Stubs 1.23.0 documentation
With MicroPython these are part of the firmware image, and not directly available as source files. Therefore it makes sense to ignore these warnings. To suppress these warnings add the following to your VSCode configuration. ... Pylance (and Pyright) do not by default allow you to override the stdlib stubs.
🌐
Reddit
reddit.com › r/learnpython › disable python type checking
r/learnpython on Reddit: Disable Python Type Checking
July 8, 2025 -

I coach a robotics team of middle school kids and it is important that all of the laptops are configured the same. When we clone our repo, VS Code will prompt them to enable type checking. I'd rather keep type checking off for now, so I really much prefer the warning to not come up at all. The kids are kind of quick to hit the default "Yes", which enables type checking. I have in my pyproject.toml

```

[tool.pyright]
typeCheckingMode = "off"

```

And that is included in the repo. And even so, I still get the warning/suggestion

"Pylance has detected type annotations in your code and recommends enabling type checking. Would you like to change this setting?"

Sure, I can click "No" at that point, and it seems to keep pylance happy and it doesn't ask again, but I'd rather it not ask at all in the first place. Ideally I'd like to figure out a way to suppress the warning at the project level, so I can push the setting to everyone as part of the repo.