Hello everyone !

Do anyone one know how i can Push the code in Streamlit with Library Sklearn cause im getting error that streamlit cloud doesn’t support sklearn lib. Kindly Help :slight_smile:

Hey there, thanks for reaching out to the Streamlit community! :blush: This is a super common issue, and the good news is it’s easy to fix. The error happens because the package name for scikit-learn is scikit-learn, not sklearn, in your requirements.txt file. Streamlit Cloud installs dependencies based on that file, so you need to add scikit-learn (not sklearn) to it.

Here’s what you should do:

  1. Open your requirements.txt file.
  2. Add this line (or update it if it says sklearn):
    scikit-learn
    
  3. Save the file, commit, and push it to your GitHub repo.
  4. Reboot or redeploy your app on Streamlit Cloud.

If you still see errors, double-check for typos (like requirements.txt vs. requirement.txt) and make sure the file is in the root of your repo. For more details, see the official docs and community solutions: ModuleNotFoundError No module named - Streamlit Docs, App dependencies - Streamlit Docs, and Forum example.

Sources:

what is the error you are facing while deploying it on Streamlit Cloud? You will find the logs in Manage app. And keep it named as requirements.txt instead of Requirements.txt

1 Like

Hi Still Getting the same error while deploying

check my Requirement File

Hi, it looks that you are installing both scikit-learn AND sklearn but…

“sklearn” is the deprecated version of the scikit-learn package and since it is listed AFTER the correct one, it overwrites the previous installation.

Please change your requirements.txt to (remove the “sklearn” line):

streamlit
pandas
numpy
plotly
scikit-learn

Also, note that it’s a good practise to pin your requirements instead of leaving them free to change version at each deploy: for example, I strongly encourage you to improve your requirements.txt to something like:

streamlit==1.53.0
pandas==2.3.3
numpy==2.4.1
plotly==6.5.2
scikit-learn==1.8.0

(or similar depending on the compatibilty of each library with all the others).

Also, I noticed that your file is named “Requirements.txt” but I suggest you to rename it lowercase (so “requirements.txt”)


Finally, please change the discussion title with something more specific (“Scikit-learn requirements errors” for example)