What else can I try?
Context:
-
Mac/Terminal
-
Pandas is installed, and the script runs, but something doesn’t feel right about the yellow line
-
I am using a VENV. Within this VENV I have installed Pandas.
-
When I type in terminal
which python3
, it returns the version under my VENV -
Hover over the yellow underline shows: Import “pandas” could not be resolved from sourcePylancereportMissingModuleSource)
-
When I run the script with python3 s.py, it runs. BUT when I run it with the Play button (Run Python File), it returns this
(venv)x@x-MBP simple_api_etl % /usr/local/bin/python3 /Users/x/Desktop/python_projects/private_python_projects/simple_a
pi_etl/s.py
Traceback (most recent call last):
File “/Users/x/Desktop/python_projects/private_python_projects/simple_api_etl/s.py”, line 1, in
import pandas as pd
ModuleNotFoundError: No module named ‘pandas’
Solution I tried so far:
Cmd
+shft
+p
to change python interpreter –> Enter interpreter path –> Search for the python3.12 version on the VENV/Bin folder and select that.
- When I do this, yellow underline remains AND now my GLOABL python interpreter is the one selected
- I don’t think this is desired, so I go back to choosing the recommended one which is usr/local/bin/python3, and I’m back in square one
1
I am not sure why you get this yellow line, I can see that you have everything in place but try this:
CMD
+shift
+p
- Click on “+ Create Virtual Environment”
- Terminal -> New Terminal or
ctrl
+shift
+ ` - Then from the terminal run
pip install pandas
to install Pandas
I am not sure if this is the optimal solution but this is what I normally do and I don’t see any yellow lines after.