Skip to content

Fixed cairo and gi module issue #541

Closed
gitSouvik wants to merge 8 commits intocheran-senthil:masterfrom
gitSouvik:master
Closed

Fixed cairo and gi module issue #541
gitSouvik wants to merge 8 commits intocheran-senthil:masterfrom
gitSouvik:master

Conversation

@gitSouvik
Copy link

While deploying this bot to my Discord server, I ran into multiple runtime issues related to missing gi / cairo dependencies when running inside a Docker environment (especially with minimal base images).

These issues caused the bot to crash during startup due to incomplete system-level bindings required by PyGObject and Cairo.

I’m requesting that this PR be merged to prevent other users from running into the same deployment issues.


Changes Made

  • Updated the Dockerfile to install required system dependencies for gi / cairo
  • Updated pyproject.toml to ensure correct Python dependency resolution
  • Improved Docker build reliability for production deployments (e.g. Railway)

After these changes:

  • The bot starts successfully without import errors
  • Cogs load correctly without gi / cairo failures
  • The bot runs stably for long periods inside Docker containers

Note

  • Tested in a clean Docker environment
  • No functional behavior of the bot was changed outside of fixing deployment stability

@gitSouvik
Copy link
Author

Thanks for this bot. Its very useful. Working great in our college Discord community.

Comment on lines +17 to +19
"pycairo",
"legacy-cgi",
"PyGObject",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, I thought this was already fixed with how we installed it. I don't really want dependencies here and that's why we moved it all to the Dockerfile.

Python is just terrible at handling dependencies.

Copy link
Author

@gitSouvik gitSouvik Jan 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, Docker (was) still giving those errors. You can check it yourself if you don’t believe me.

About the .env file stuff — I had actually hosted the bot on a free platform and set the environment variables directly on that platform. Later, I forgot about that and assumed the variables were being read from the .env file (instead of .env.example), so I changed them here. (I was wrong — those variables were changed globally)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cheran-senthil Should I change change .env to .env.example and send and new PR ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused what the change you are talking about is. .env.example is an example, and .env is what is actually used. The instructions say to make a copy of the file and to update the needed values inside it.

pyproject.toml Outdated
# Images
"pillow",
"pycairo",
"legacy-cgi",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? We're not using cgi at all, are we?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late reply — I was not well recently.
I reviewed the legacy-cgi information and realized that I had incorrectly used it as a workaround for the gi module error.

Removed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I was facing issue on those fonts. It was giving 403 error while requesting the NotoSansCJK-Bold.ttc and NotoSansCJK-Regular.ttc fonts, so added them manually.

@algmyr
Copy link
Collaborator

algmyr commented Jan 31, 2026

Fixed separately in #539. Font issues will be fixed in #543.

@algmyr algmyr closed this Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants