6 months ago
Hello Railway Team,
I am facing a persistent deployment error with my Discord bot where the logs show:
textModuleNotFoundError: No module named 'discord'
Here are the key details:
My project includes a
requirements.txtwith:textpy-cord==2.3.2 flask werkzeug gunicornThe
requirements.txtis at the root of my repository.I have a
Procfilewithworker: python main.py.Locally, the bot installs dependencies and runs perfectly.
However, Railway deployment logs do not show any installation of the Discord-related dependencies.
The build uses the Railpack system but seems to skip installing my Python dependencies, leading to this module error.
I’ve tried cache clearing and redeploying without success.
Could you please guide me on how to ensure Railway installs the Discord package (py-cord) properly during build? Is there a special config or file Railway expects for dependency installs?
Thank you for your help!
Deploy logs in my case:
2025-09-13T18:25:16.000000000Z [inf] Starting Container 2025-09-13T18:25:16.574749232Z [err] Traceback (most recent call last): 2025-09-13T18:25:16.574753762Z [err] File "/app/main.py", line 7, in <module> 2025-09-13T18:25:16.574758644Z [err] import discord 2025-09-13T18:25:16.574763812Z [err] ModuleNotFoundError: No module named 'discord' 2025-09-13T18:25:17.758810638Z [err] Traceback (most recent call last): 2025-09-13T18:25:17.758819630Z [err] File "/app/main.py", line 7, in <module> 2025-09-13T18:25:17.758827328Z [err] import discord 2025-09-13T18:25:17.758834501Z [err] ModuleNotFoundError: No module named 'discord' 2025-09-13T18:25:19.271197892Z [err] Traceback (most recent call last): 2025-09-13T18:25:19.271207580Z [err] File "/app/main.py", line 7, in <module> 2025-09-13T18:25:19.271214177Z [err] import discord 2025-09-13T18:25:19.271220430Z [err] ModuleNotFoundError: No module named 'discord' 2025-09-13T18:25:21.014067085Z [err] Traceback (most recent call last): 2025-09-13T18:25:21.014076246Z [err] File "/app/main.py", line 7, in <module> 2025-09-13T18:25:21.014083001Z [err] import discord 2025-09-13T18:25:21.014090081Z [err] ModuleNotFoundError: No module named 'discord' 2025-09-13T18:25:22.483340748Z [err] Traceback (most recent call last): 2025-09-13T18:25:22.483346308Z [err] File "/app/main.py", line 7, in <module> 2025-09-13T18:25:22.483357250Z [err] import discord 2025-09-13T18:25:22.483362521Z [err] ModuleNotFoundError: No module named 'discord' 2025-09-13T18:25:23.926805719Z [err] Traceback (most recent call last): 2025-09-13T18:25:23.926811579Z [err] File "/app/main.py", line 7, in <module> 2025-09-13T18:25:23.926818348Z [err] import discord 2025-09-13T18:25:23.926825063Z [err] ModuleNotFoundError: No module named 'discord' 2025-09-13T18:25:25.200395163Z [err] Traceback (most recent call last): 2025-09-13T18:25:25.200399699Z [err] File "/app/main.py", line 7, in <module> 2025-09-13T18:25:25.200403206Z [err] import discord 2025-09-13T18:25:25.200406975Z [err] ModuleNotFoundError: No module named 'discord' 2025-09-13T18:25:26.728724874Z [err] Traceback (most recent call last): 2025-09-13T18:25:26.728733904Z [err] File "/app/main.py", line 7, in <module> 2025-09-13T18:25:26.728740713Z [err] import discord 2025-09-13T18:25:26.728746766Z [err] ModuleNotFoundError: No module named 'discord' 2025-09-13T18:25:28.194739784Z [err] Traceback (most recent call last): 2025-09-13T18:25:28.194743755Z [err] File "/app/main.py", line 7, in <module> 2025-09-13T18:25:28.194748365Z [err] import discord 2025-09-13T18:25:28.194752899Z [err] ModuleNotFoundError: No module named 'discord' 2025-09-13T18:25:29.645766470Z [err] Traceback (most recent call last): 2025-09-13T18:25:29.645776946Z [err] File "/app/main.py", line 7, in <module> 2025-09-13T18:25:29.645784768Z [err] import discord 2025-09-13T18:25:29.645792148Z [err] ModuleNotFoundError: No module named 'discord' 2025-09-13T18:25:31.124233001Z [err] Traceback (most recent call last): 2025-09-13T18:25:31.124240245Z [err] File "/app/main.py", line 7, in <module> 2025-09-13T18:25:31.124245869Z [err] import discord 2025-09-13T18:25:31.124251746Z [err] ModuleNotFoundError: No module named 'discord'
Github repo link in my case:
https://github.com/tayyab-ai/DFD_D.git
3 Replies
6 months ago
Hey there! We've found the following might help you get unblocked faster:
🧵 Issue with Deploying Discord Bot on Railway – ModuleNotFoundError: No module named 'discord'
🧵 Application Crashes on Deployment - ModuleNotFoundError for MySQLdb
🧵 Deployment Failure – “ModuleNotFoundError: No module named ‘pydantic_settings
If you find the answer from one of these, please let us know by solving the thread!
6 months ago
Apologies but this looks like an issue with the application level code. Due to volume, we can only answer platform level issues.
Status changed to Awaiting User Response Railway • 6 months ago
6 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open brody • 6 months ago
6 months ago
Since your main.py runs both Flask and Discord bot, change your Procfile to:
web: python main.py