Pylance - Unresolved import warnings

125 views Asked by At

I'm using VSCode. Although my code runs as expected, I'm getting linting errors.

The code:

import tensorflow.keras as keras

The error: Import "tensorflow.keras" could not be resolved.

I've looked at other questions like this and this. Followed the answers carefully, they did not help.

I've tired to follow the official troubleshhoting guide. Based on that I updated my .vscode/settings.json:

{
    "python.analysis.extraPaths": [
        "/usr/lib/python3.11/site-packages/keras/api/_v2/keras"
    ]
}

I got this directory from the following code:

import tensorflow.keras as keras
print(keras.__file__)

Output: /usr/lib/python3.11/site-packages/keras/api/_v2/keras/__init__.py

At this point I'm completely stuck.

  • I've tried to user parent folders, nothing happened.
  • Restarted everything, still nothing.
0

There are 0 answers