(ModuleNotFoundError) Deploy error

I’m getting ModuleNotFoundError for gtts when I try to deploy which is weird. How can I fix please

here’s a link to the repo GitHub - ifeomaaaa/easy-edit-app: This is an app to make editing easier by listening to chapters. I’ve added requirements.txt file

Hi @ifeomaaaa :wave:

Thanks for sharing your question with the community! Check out our guidelines on how to post an effective question here and please include links to your app, repo, and share the contents of your requirements file.

Thanks :balloon:

You have gTTs in the requirements file. Try replacing it by gTTS (python is case-sensitive)

Thanks i just did that and am still getting error

Your repo can only contain one requirements file:

Streamlit looks at your requirements file’s filename to determine which Python dependency manager to use in the order described in App dependencies. Streamlit will stop and install the first requirements file found, which in your case is the Pipfile.

If you want the dependencies within requirements.txt to get installed, you have to delete Pipfile and reboot the app.

You also have a Pipfile which does not have gTTS as a requirement. To streamlit, that one takes precedence over requirements.txt (Check App dependencies - Streamlit Docs). What if you delete Pipfile from the repo and leave only requirements.txt?

I deleted the file and it didn’t work. Now I get this error from “manage app”

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pandas

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
WARNING: You are using pip version 22.0.3; however, version 22.3 is available.
You should consider upgrading via the '/home/appuser/venv/bin/python -m pip install --upgrade pip' command.
Checking if Streamlit is installed

────────────────────────────────────────────────────────────────────────────────────────

[12:30:22] ❗️ installer returned a non-zero exit code
[12:30:22] ❗️ Error during processing dependencies! Please fix the error and push an update, or try restarting the app.

do I have more than one requirements file?

The version of pandas in your requirements file is ancient. Installation wheels for the default version of Python on Community Cloud (3.9) do not exist:

You need to either unpin the version of pandas, or pin a more recent version that has a Python 3.9 installation candidate.

can I delete it? I don’t even think I used it in my code. I think I just copied that from somewhere

That’s entirely up to your discretion. As a general best practice, only include dependencies that your app actually uses. If your app or your app’s dependencies don’t use pandas, you could remove it.

ugh I’m still getting this error:

ModuleNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

Traceback:

File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 562, in _run_script
    exec(code, module.__dict__)File "/app/easy-edit-app/main.py", line 6, in <module>
    from gtts import gTTS

I don’t know what to do anymore

As I’ve stated previously, you can’t have both Pipfile and requirements.txt in the same repo. You need to delete Pipfile, and reboot your app… Once you do that, your app should deploy without the ModuleNotFoundError:

yay it worked! thank you soo much!! :heart:

1 Like