ModuleNotFoundError: No module named 'joblib'

I’m not able to deploy my app on streamlit share. It is not able to find joblib. Please help me.
my github repo: Eclipse/streamlit_app at master · ArshKaushik/Eclipse · GitHub

1 Like

Please paste the logs.

Hi @ArshKaushik, welcome to the Streamlit community!

This is a subtle misfeature we’re working to solve…your requirements.txt file needs to be at the top-level of your repo; in your repo, the requirements.txt file is a streamlit_app/requirements.txt. So Streamlit sharing isn’t installing your dependencies, and thus, it can’t find joblib (or anything else).

Best,
Randy

2 Likes

I am facing the same issue. Found no way to move the requirements file up the stack as the files are automatically arranged in ascending order.

Hi @GTK-ARJUN -

This isn’t a recommendation to change the sorting order of files, as that is likely operating system dependent. Rather, the recommendation is to have the file at the top-level of the file directory. Meaning, not having requirements.txt inside of a nested folder, but rather inside the repo without any other nesting.

Best,
Randy

1 Like

Is there any update to resolve this issue or would you like to suggest an alternative to joblib.

Can you post a link to your code?

I have the same issue - even though streamlit says that it is installing joblib:

Collecting joblib==1.0.1
Downloading joblib-1.0.1-py3-none-any.whl (303 kB)

when building the app, it always runs into the error
ModuleNotFoundError: No module named 'joblib'

Link to Repo: GitHub - jonas-nothnagel/NLP-Project-Documents: Working Repo for building a set of models to automate the classification of project log-frames to a comprehensive taxonomy. Data can not be pushed yet.

Hi @jonas-nothnagel -

In Streamlit sharing, it seems like it works (meaning, it doesn’t throw an error message), but locally I get the following:

(nlptest) rzwitch@threadripper:~/github_work/NLP-Project-Documents$ pip install -r requirements.txt 
Collecting en_core_web_sm
  Using cached en_core_web_sm-2.3.1-py3-none-any.whl
ERROR: Cannot install -r requirements.txt (line 16) and spacy==3.0.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested spacy==3.0.1
    en-core-web-sm 2.3.1 depends on spacy<2.4.0 and >=2.3.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

Are you sure your dependencies are correct? I’ll also forward this on to our cloud team to see if they have any ideas.

Best,
Randy

This is a mistake indeed. It is weird that I did not get this error when deploying the app then.

It works perfectly locally, but when trying to share I always run into the joblib error as if the requirements are not even installed at all…

@randyzwitch on a personal note, would you mind to “unfork” my repo - not sure if I should share it yet, I just wanted to be ready for deployment :slight_smile:

Sure, but note that once your code is “in the wild”, it’s kinda too late. Keep that in mind if you share things on GitHub :slight_smile:

Hi @randyzwitch. You’re of course right, I was just waiting for the final approval (Which is there now) :slight_smile:
Anyhow, now the app was running once, but otherwise I always get the error:

ModuleNotFoundError: No module named 'joblib'

Traceback:
File "/usr/local/lib/python3.7/site-packages/streamlit/script_runner.py", line 332, in _run_script
    exec(code, module.__dict__)File "/app/nlp-project-documents/streamlit/main.py", line 4, in <module>
    import joblib

Obviously this is not about joblib, it seems it simply does not install any of the libraries. If I uncomment
joblib at line 4, then it does not find pickle5 at line5 and so on. Again, it runs absolutely perfectly locally, but I would really like to share it now with others.

Any ideas what the issue could be if it works for you on streamlit share?

The last logs are:

[manager] Processed dependencies!
  You can now view your Streamlit app in your browser.
  Network URL: http://10.12.69.77:8501

  External URL: http://35.230.58.211:8501
[client] Connecting....

Hello, I am facing the same issue.
It fails when I run the import statement for joblib and my requirement file is on top in the main branch.

It shows its downloading: Downloading joblib-0.16.0-py3-none-any.whl (300 kB)

ModuleNotFoundError: No module named ‘joblib’

Traceback:

File "/usr/local/lib/python3.7/site-packages/streamlit/script_runner.py", line 333, in _run_script
    exec(code, module.__dict__)File "/app/capstone_592_project/Final_App.py", line 7, in <module>
    import joblib
1 Like

Can you post the contexts of your requirements.txt file?

@randyzwitch
Thanks for responding. I found a solution to this problem.
I have created a packages.txt with the below lines in it and it worked.
freeglut3-dev
libgtk2.0-dev

1 Like