skip to Main Content

I am using import_ipynb module in VS Code to use variables defined in another Jupyter notebook. However, when using the names of these files to import them, they become underlined with yellow color and with error messages: "Import "filename" could not be resolved". Everything seems to work fine, except for these underlines. Here is an example of how it goes:

import import_ipynb
import VsS_30

"VsS_30" is underlined with yellow.

Is there any way to solve this minor issue?

I have no clue on what to try in this matter, I don’t have deep knowledge of visual studio code mechanics.

2

Answers


  1. You can disable/suppress the warnings for imports as suggested in this answer: How to disable pylint warnings and messages on Visual Studio Code?

    Use --disable=reportMissingImports to disable only this kind of warnings. You can find the list of Warnings here.

    This comes with the downside that VS Code won’t underline other packages (e.g. pandas) if it’s not installed in the environment.

    Login or Signup to reply.
  2. First, you have to check whether you have selected the correct interpreter.(Ctrl+Shift+P then type Python:Select Interpreter).

    When you confirm that there is no problem, but there are still errors. If you want to disable the reminder, you can add the following codes to your settings.json:

      "python.analysis.diagnosticSeverityOverrides": {
        "reportMissingImports": "none"
      },
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search