I had same problem with Import "numpy" could not be resolved Pylance with numpy
, pandas
and mlflow
. Here is how I resolved it.
My environment is Windows 10 and I have install python3
on path c:\python\python.exe
.
When I run:
which python
in my WSL2 it show c:\python\python.exe
So I studied mlflow
then I have install Anaconda
from here and installed pyenv
then pip install numpy
.
Everything work well now and when I run which python
in my WSL2 again it shows /home/sutee/.local/bin/anaconda3/bin/python
.
I now have python
on anaconda3
and python
on my Windows 10.
The solution for clear warning:
- I try to change "Python Select Interpreter" but can have only see the one from
C:\python\python.exe
and can't enter path from WSL.
- I install
numpy
, pandas
and mlflow
from Windows environments by using Windows PowerShell in admin and running pip3.exe
.
Example:
C:\python\Scripts\pip3.exe install numpy
C:\python\Scripts\pip3.exe install pandas
C:\python\Scripts\pip3.exe install mlflow
After installing each package, the warning is gone.
pip install numpy
. If this does not work try this "Import could not be resolved" reported by Pyright – Bounden