ModuleNotFoundError: No module named 'sklearn' and 'matplotlib'

Hello! Here are the exact messages that appeared in the log.

ERROR: Could not find a version that satisfies the requirement twint==2.1.21
ERROR: No matching distribution found for twint==2.1.21
ModuleNotFoundError: No module named ‘twint’

I tried to uninstall my current twint package to reinstall the 2.1.20 version but it still did not work. :((

What is the error message in the log during deployment?

Here.

ERROR: Could not find a version that satisfies the requirement twint==2.1.21
ERROR: No matching distribution found for twint==2.1.21
[manager] Python dependencies were installed from requirements.txt using pip.
[client] Spinning up manager process...
[manager] Processed dependencies!
2021-04-08 13:15:51.032 An update to the [server] config option section was detected. To have these changes be reflected, please restart streamlit.
2021-04-08 13:15:51.170 Uncaught app exception
Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/script_runner.py", line 333, in _run_script
    exec(code, module.__dict__)
  File "/app/twitter-wordcloud-generator-using-streamlit/app.py", line 4, in <module>
    import twint as tw
ModuleNotFoundError: No module named 'twint'

As i already said, the twint version 2.1.21 ist not in the PyPI repository, therefore pip installation fails.
Try either version 2.1.20 in your requirements.txt file or omit the version number altogether.
But be aware, in the end, only version 2.1.20 is installed nonetheless.

1 Like

Hi! Both removing the version and specifying version 2.1.20 did not work for me. However, I was able to finally resolve it, by replacing the entire line in my requirements.txt file with the following:
git+https://github.com/twintproject/twint.git@origin/master#egg=twint
Thank you for your help! Next time, I’ll be more careful with the versions that I will specify.

2 Likes
File "/app/iris_dataset_streamlit/final_session.py", line 6, in <module>
    from sklearn.model_selection import train_test_split
ModuleNotFoundError: No module named 'sklearn'

I don’t know why I am getting this error.
I followed the same following steps:
1.Creating a folder
2.Creating thee python file
3.Creating a requirements.txt

Please someone help me out

Hi @Ravikumar10593-hub, welcome to the Streamlit community!! :wave: :partying_face:

It looks like none of the Python dependencies in your requirements file were installed due to a typo in the file extension. To resolve this ModuleNotFoundError:

Happy Streamlit’ing! :balloon:
Snehan

3 Likes

Sorry to say you that I have used requirements.txt only , still it is showing me the same thing that ModuleNotFoundError.

Plz can u suggest me some other way to solve it.

Hi @Ravikumar10593-hub,

Have you pushed your local changes to your GitHub repo? The file name still appears to be requirements.text instead of requirement.txt here:

Best, :balloon:
Snehan

3 Likes

@snehankekre Tqsm it worked

@Marisa_Smith Hi! im having the same problem… but i do need torch, what can i do?

I’m also getting the same error please do some help for deploying my app I will send my repo link

Hi @vinod_kumar, welcome to the community! :wave: :partying_face:

Your Python dependency file should be named requirements.txt, not requirements.text.

Hope that helps! :balloon:

When I ran code in the local host I received output but after deploying the app in streamlit I got the error “dtype=‘numeric’ is not compatible with arrays of bytes/strings. Convert your data to numeric values explicitly instead.”


sir i got an error like this what should i do

You need to install scikit-learn on your local machine.


i already installed but not coming

It looks like an environment issue. Have you tried running your app with:

python.exe -m streamlit <yourapp>.py?

If the above doesn’t work, I’d recommend doing a clean installation of Streamlit using the officially-supported environment manager for Windows:

If you install Streamlit using Anaconda, you should also install scikit-learn using Anaconda within the same environment as your Streamlit installation.


when i uploading a video file after deployment its come like that what will i do?