---
title: "How to host a Python Discord bot"
url: https://help.endercloud.in/docs/host-a-python-discord-bot
category: "Bot Hosting"
type: Guide
tags: ["bots", "discord", "python"]
keywords: "discord.py hosting, host python bot 24/7, requirements.txt, main.py, bot.py, modulenotfounderror, no module named, python version, pip install, nextcord, pycord, telegram bot python, host python bot, python bot hosting, discord.py bot, upload python bot, pip requirements, bot not starting python, telegram bot hosting, change python version, pyton bot"
difficulty: beginner
time: "10 minutes"
updated: 2026-11-14
source: Endercloud Knowledge Base (official)
---

# How to host a Python Discord bot

> Upload your bot files with a requirements.txt, set your main .py file and Python version in the Startup tab, then click Start and check the console.

To run a Python bot (discord.py, Pycord, nextcord, a Telegram bot and so on) on Endercloud, upload your code with a `requirements.txt` file, choose your main `.py` file and Python version in **Startup**, and click **Start**.

## Step 1: Create requirements.txt

`requirements.txt` is a plain text file that lists the packages your bot needs, one per line. The server installs everything in it when the bot starts. Example for a discord.py bot:

```
discord.py
python-dotenv
```

You can pin versions if you want the same versions every time, for example `discord.py==2.4.0`. Use the package names as they appear on PyPI, the name you would type after `pip install`.

> **Warning:**
> Don't upload a virtual environment folder such as `venv` or `.venv`, or `__pycache__`. They are large and don't work on the server.

## Step 2: Upload your files

1.  Open your bot in the [Game Panel](https://panel.endercloud.in) and go to **Files**.
    
2.  Upload your `.py` files and `requirements.txt` into the main folder, not inside an extra sub-folder.
    
3.  For many files, upload a `.zip` and unarchive it, or use SFTP. See [Using the file manager](/docs/using-the-file-manager).
    
4.  Store your token in a `.env` file, not in the code. See [Keep your bot token safe](/docs/keep-your-bot-token-safe-with-environment-variables).
    

## Step 3: Set the main file and Python version

All of the bot's start settings are in the **Startup** tab. The exact variable names depend on the bot language, so read the description under each one:

-   Find the variable for the file that starts your bot and enter your file name, for example `main.py` or `bot.py`. The name must match exactly, including capital letters.
    
-   If there is a variable for the requirements file, leave it as `requirements.txt` unless your file has another name.
    
-   Pick the Python version in the **Docker Image** list. Use a version your libraries support; a recent Python 3 release is a safe default for discord.py.
    

Can't tell which variable is which? Open a ticket and we will point you to the right one.

## Step 4: Start and check the console

1.  Click **Start** and open **Console**.
    
2.  The first start installs your packages with pip, which can take a minute. Watch the console to confirm the packages from `requirements.txt` are installed.
    
3.  Wait for your bot's "logged in" message and check that it is online in Discord.
    

## Common console errors

| Error | What to do |
| --- | --- |
| `ModuleNotFoundError: No module named 'x'` | Add the package to `requirements.txt` and restart. The import name and the PyPI name can differ (for example you import `dotenv` but install `python-dotenv`). |
| `can't open file '/home/container/main.py'` | The main file setting doesn't match your file name, or the file is in a sub-folder. |
| `LoginFailure: Improper token has been passed` | The token is wrong or was reset. Copy a new one from the Discord Developer Portal. |
| `PrivilegedIntentsRequired` | Enable the intent your code uses (often Message Content) in the Developer Portal under **Bot → Privileged Gateway Intents**. |
| Syntax errors after changing version | Your code or a package needs a different Python version. Change the **Docker Image** in **Startup** and restart. |

If the bot goes offline after running for a while, see [My bot keeps going offline](/docs/bot-keeps-going-offline).

## Frequently asked questions

**Q: Do I need to run pip install myself?**

Normally no. Packages listed in `requirements.txt` are installed when the bot starts, so keep the file up to date and restart after changing it. If the console doesn't show pip installing them, check the requirements setting in **Startup** or open a ticket.

**Q: My bot reads messages but the content is empty**

Turn on the **Message Content** intent in the Developer Portal and enable it in your code, for example with `intents.message_content = True` in discord.py.

**Q: Can I switch my bot from Python to Node.js later?**

Yes. See [Change your bot's language or version](/docs/change-your-bot-language-or-version).
