I made a drowsiness detector for driving using django. I tried deploying it on heroku and everything seems to be working fine except as soon as I try to open the camera, I get the error:
Exception Value:
Failed loading libasound.so.2: libasound.so.2: cannot open shared object file: No such file or directory
All the other pages are working fine, you can try it out here (login credentials username: temp password: Temp@123). As soon as you click on Start Driving it throws this exception. The app is working fine in localhost. Please help!
Log after git push heroku master
:
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 12 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 288 bytes | 288.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/python
remote: -----> Python app detected
remote: -----> Using Python version specified in runtime.txt
remote: -----> No change in requirements detected, installing from cache
remote: -----> Using cached install of python-3.8.12
remote: -----> Installing pip 21.3.1, setuptools 57.5.0 and wheel 0.37.0
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: -----> $ python manage.py collectstatic --noinput
remote: 130 static files copied to '/tmp/build_fa3901e7/staticfiles'.
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 319.5M
remote: -----> Launching...
remote: ! Warning: Your slug size (319 MB) exceeds our soft limit (300 MB) which may affect boot time.
remote: Released v13
remote: https://dontsleepapp.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/dontsleepapp.git
After heroku logs --tail
2021-11-26T06:07:53.697167 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
2021-11-26T06:07:53.697168 00:00 app[web.1]: response = wrapped_callback(request, *callback_args, **callback_kwargs)
2021-11-26T06:07:53.697169 00:00 app[web.1]: File "/app/myapp/views.py", line 126, in StartDrive
2021-11-26T06:07:53.697169 00:00 app[web.1]: pygame.mixer.init()
2021-11-26T06:07:53.697169 00:00 app[web.1]: pygame.error: Failed loading libasound.so.2: libasound.so.2: cannot open shared object file: No such file or directory
2021-11-26T06:07:53.697834 00:00 app[web.1]: 10.1.4.217 - - [25/Nov/2021:22:07:53 -0800] "GET /myapp/drive/ HTTP/1.1" 500 55987 "https://dontsleepapp.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
2021-11-26T06:07:53.701240 00:00 heroku[router]: at=info method=GET path="/myapp/drive/" host=dontsleepapp.herokuapp.com request_id=4f1d6ac0-8d16-4bd0-8ac9-381ed4758b91 fwd="73.93.42.18" dyno=web.1 connect=0ms service=66ms status=500 bytes=56254 protocol=https
CodePudding user response:
Your machine is missing libasound, install it with: sudo apt-get install libasound2