axil / import-ipynb

import an ipynb into an ipynb (or into just a py)
BSD 3-Clause "New" or "Revised" License
27 stars 12 forks source link

Doesn't work using Gunicorn on Heroku #4

Open pieroliviermarquis opened 1 year ago

pieroliviermarquis commented 1 year ago

I am using import-ipynb locally and it works perfectly fine, but I can't get it to work with Gunicorn on Heroku (Ubuntu 20.04).

2022-12-03T14:41:37.471070+00:00 app[web.1]: Traceback (most recent call last):
2022-12-03T14:41:37.471071+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2022-12-03T14:41:37.471071+00:00 app[web.1]: worker.init_process()
2022-12-03T14:41:37.471071+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py", line 134, in init_process
2022-12-03T14:41:37.471072+00:00 app[web.1]: self.load_wsgi()
2022-12-03T14:41:37.471072+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2022-12-03T14:41:37.471072+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2022-12-03T14:41:37.471074+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2022-12-03T14:41:37.471074+00:00 app[web.1]: self.callable = self.load()
2022-12-03T14:41:37.471074+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2022-12-03T14:41:37.471075+00:00 app[web.1]: return self.load_wsgiapp()
2022-12-03T14:41:37.471075+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2022-12-03T14:41:37.471075+00:00 app[web.1]: return util.import_app(self.app_uri)
2022-12-03T14:41:37.471076+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/util.py", line 359, in import_app
2022-12-03T14:41:37.471076+00:00 app[web.1]: mod = importlib.import_module(module)
2022-12-03T14:41:37.471076+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/importlib/__init__.py", line 127, in import_module
2022-12-03T14:41:37.471078+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-12-03T14:41:37.471078+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
2022-12-03T14:41:37.471078+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 983, in _find_and_load
2022-12-03T14:41:37.471079+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
2022-12-03T14:41:37.471079+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
2022-12-03T14:41:37.471079+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 728, in exec_module
2022-12-03T14:41:37.471079+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2022-12-03T14:41:37.471080+00:00 app[web.1]: File "/app/app.py", line 49, in <module>
2022-12-03T14:41:37.471080+00:00 app[web.1]: notebooks.run_breadth()
2022-12-03T14:41:37.471080+00:00 app[web.1]: File "/app/notebooks.py", line 4, in run_breadth
2022-12-03T14:41:37.471080+00:00 app[web.1]: from breadth import breadth
2022-12-03T14:41:37.471080+00:00 app[web.1]: ImportError: cannot import name 'breadth' from 'breadth' (/app/breadth/__init__.py)
axil commented 1 year ago

Hi. I would look into sys.path

axil commented 1 month ago

Try it again with the new 0.2 version (pip install -U import-ipynb), please.