Streamlit VS Code setup

Hi, I created a virtual environment “stream” and installed streamlit using “pip install streamlit”. But when I created a file named app.py and imported “import streamlit as st”, I get the following error
" Import “streamlit” could not be resolvedPylance[reportMissingImports]" Can anybody help please

Hi @Siddharth_Gupta, and welcome to the Streamlit community! :balloon::raised_hands:

This seems to be related to the PyLance module.

Can you please disable it in VSCode, then check if the issue persists?

Best,
Charly

I have the same issue and disabling PyLance did not seem to fix the issue

Was this ever solved?

Do you have the interpreter set correctly in VS Code to point to the environment with Streamlit installed? I have a conda environment named streamlitenv and this is what the lower right corner looks like in VS code with it selected as my interpreter:

image

1 Like

Thank you, this solves my problem very well

having issues with the exact same, and ‘resolved’ by using python 3.11 (was prev using 3.12)

not ideal, would be handy if it ran with 3.12, but working is better than not

I’m experiencing the same exception in version 3.10. But upgrading to 3.11 automatically normalizes.
Does the official website indicate the specific version of Python dependencies?