Description
I am copying my question posted on Stackoverflow since I may get a better answer here
My heroku app makes use of the enchant
library. When I go to deploy, I get this log from heroku logs
:
2022-01-14T16:12:34.373982+00:00 heroku[web.1]: Starting process with command `python main.py`
2022-01-14T16:12:36.222280+00:00 app[web.1]: Traceback (most recent call last):
2022-01-14T16:12:36.222301+00:00 app[web.1]: File "/app/main.py", line 3, in <module>
2022-01-14T16:12:36.222404+00:00 app[web.1]: import commands as c
2022-01-14T16:12:36.222406+00:00 app[web.1]: File "/app/commands.py", line 2, in <module>
2022-01-14T16:12:36.222484+00:00 app[web.1]: import enchant
2022-01-14T16:12:36.222485+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/enchant/__init__.py", line 81, in <module>
2022-01-14T16:12:36.222593+00:00 app[web.1]: from enchant import _enchant as _e
2022-01-14T16:12:36.222594+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/enchant/_enchant.py", line 157, in <module>
2022-01-14T16:12:36.222682+00:00 app[web.1]: raise ImportError(msg)
2022-01-14T16:12:36.222708+00:00 app[web.1]: ImportError: The 'enchant' C library was not found and maybe needs to be installed.
2022-01-14T16:12:36.222708+00:00 app[web.1]: See https://pyenchant.github.io/pyenchant/install.html
2022-01-14T16:12:36.222709+00:00 app[web.1]: for details
2022-01-14T16:12:36.222711+00:00 app[web.1]:
2022-01-14T16:12:36.396316+00:00 heroku[web.1]: Process exited with status 1
So doing a little research I find that the enchant library makes use of the underlying Enchant C
library which is an apt-based dependency. So the proper way to handle this problem in heroku is to use heroku-buildpack-apt. I use the Ubuntu Packages Search to find the proper name for the Enchant C library. In particular, I try "enchant-2", "libenchant-2-2", "python3-enchant" by adding them to the Aptfile. When I push the changes to heroku, I get logs assuring me that it is using the heroku-community/apt
buildpack and is installing the enchant library that I specified in the Aptfile. However, the same above error always occurs.
It seems that this issue has popped up a couple times on the internet but has gone unresolved with most people just opting to not use the enchant library entirely which I may concede to doing as well.
Anyone know how to solve this problem?