0

I am trying to deploy my Django project that uses React on the frontend inside Django app to railway. The app was deployed on Heroku before but after adding a whisper package from openAI the slug size became too big to use it there so I opted to use railway instead. I have another Django project with React running there so the problem comes from the packages.

The problem comes from package called gpt-index which uses pandas package and that's where the error occurs.

What can I do to fix this?

Nix-packs setup:

[phases.setup]
nixPkgs = ['nodejs-16_x', 'npm-8_x ', 'python310', 'postgresql', 'gcc ']

[phases.install]
cmds = ['npm i ', 'python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt']

[phases.build]
cmds = ['npm run build']

[start]
cmd = '. /opt/venv/bin/activate && python manage.py migrate && gunicorn backend.wsgi'

Full traceback:

Traceback (most recent call last):
File "/app/manage.py", line 22, in <module>
main()
File "/app/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/opt/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/opt/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 420, in execute
django.setup()
File "/opt/venv/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/opt/venv/lib/python3.10/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/opt/venv/lib/python3.10/site-packages/django/apps/config.py", line 193, in create
import_module(entry)
File "/nix/store/al6g1zbk8li6p8mcyp0h60d08jaahf8c-python3-3.10.9/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/opt/venv/lib/python3.10/site-packages/gpt_index/__init__.py", line 18, in <module>
from gpt_index.indices.keyword_table import (
File "/opt/venv/lib/python3.10/site-packages/gpt_index/indices/__init__.py", line 4, in <module>
from gpt_index.indices.keyword_table.base import GPTKeywordTableIndex
File "/opt/venv/lib/python3.10/site-packages/gpt_index/indices/keyword_table/__init__.py", line 4, in <module>
from gpt_index.indices.keyword_table.base import GPTKeywordTableIndex
File "/opt/venv/lib/python3.10/site-packages/gpt_index/indices/keyword_table/base.py", line 16, in <module>
from gpt_index.indices.keyword_table.utils import extract_keywords_given_response
File "/opt/venv/lib/python3.10/site-packages/gpt_index/indices/keyword_table/utils.py", line 7, in <module>
import pandas as pd
File "/opt/venv/lib/python3.10/site-packages/pandas/__init__.py", line 48, in <module>
from pandas.core.api import (
File "/opt/venv/lib/python3.10/site-packages/pandas/core/api.py", line 47, in <module>
from pandas.core.groupby import (
File "/opt/venv/lib/python3.10/site-packages/pandas/core/groupby/__init__.py", line 1, in <module>
from pandas.core.groupby.generic import (
File "/opt/venv/lib/python3.10/site-packages/pandas/core/groupby/generic.py", line 76, in <module>
from pandas.core.frame import DataFrame
File "/opt/venv/lib/python3.10/site-packages/pandas/core/frame.py", line 172, in <module>
from pandas.core.generic import NDFrame
File "/opt/venv/lib/python3.10/site-packages/pandas/core/generic.py", line 169, in <module>
from pandas.core.window import (
File "/opt/venv/lib/python3.10/site-packages/pandas/core/window/__init__.py", line 1, in <module>
from pandas.core.window.ewm import (
File "/opt/venv/lib/python3.10/site-packages/pandas/core/window/ewm.py", line 15, in <module>
import pandas._libs.window.aggregations as window_aggregations
ImportError: libstdc++.so.6: cannot open shared object file: No such file or directory
  • Could be this https://stackoverflow.com/questions/73866575/issue-with-pandas-importerror-libstdc-so-6-inside-a-conda-environment-running – Marcel Preda Feb 11 '23 at 14:19
  • I have seen this thread before I posted mine and meanwhile this could be the solution I do not know how to implement it on railway. If you have any insight on that I would love to hear. @MarcelPreda – IonicEcommerce Feb 11 '23 at 15:13

1 Answers1

0

The libstdc++.so.6 library is missing. You could try to install nixos package gcc-unwrapped or another one that provides that lib. After installing the library, you might still have to set LD_LIBRARY_PATH before running the program, if the library isn't in the default system path