a year ago
Dear Railway Support,
I am experiencing an issue with my Django application deployed on Railway. The application fails to start due to an error related to the psycopg2 library. Below is the relevant traceback from the logs. The odd thing is that my app is running find in my prod environment, but is giving me this error in my dev environment. The two environments should be exactly the same.
SystemError: initialization of _psycopg raised unreported exception
Traceback (most recent call last):
File "/app/manage.py", line 22, in
main()
File "/app/manage.py", line 18, in main
executefromcommandline(sys.argv) File "/opt/venv/lib/python3.11/site-packages/django/core/management/init.py", line 446, in executefromcommandline
utility.execute()
File "/opt/venv/lib/python3.11/site-packages/django/core/management/init.py", line 420, in execute
django.setup()
File "/opt/venv/lib/python3.11/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLEDAPPS) File "/opt/venv/lib/python3.11/site-packages/django/apps/registry.py", line 116, in populate appconfig.importmodels() File "/opt/venv/lib/python3.11/site-packages/django/apps/config.py", line 304, in importmodels
self.modelsmodule = importmodule(modelsmodulename)
File "/root/.nix-profile/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap.gcdimport(name[level:], package, level)
File "/opt/venv/lib/python3.11/site-packages/django/db/backends/postgresql/base.py", line 24, in
import psycopg2 as Database
File "/opt/venv/lib/python3.11/site-packages/psycopg2/init.py", line 51, in
from psycopg2._psycopg import ( # noqa
This error seems to be related to the initialization of the _psycopg module within the psycopg2 package. Could you please assist in resolving this issue?
Thanks!
Eric
2 Replies
a year ago
Hi. This appears to be an issue with your project, and unfortunately we're unable to help with that as it is unrelated to the Railway product/platform.
I'd recommend Googling around for answers, asking your question in a forum geared towards those sort of help (e.g. StackOverflow), or waiting for a community member to chip in here.
a year ago
Hi - for anyone that finds this thread, upgrading pyscopg2 fixed the issue. I'm not sure why it worked, and then didn't, but the upgrade fixed the problem.
Status changed to Solved railway[bot] • 11 months ago