Issue
I want to achieve a deployment of a jupyter notebook project on heroku. It is basically an interactive notebook what I want to deploy. However, during deployment, I face two errors when I trace the log file.
First one is ModuleNotFoundError: No module named 'matplotlib'.
Second one is "IPython is needed to transform IPython syntax to pure Python. Install ipython if you need this functionality."
I have both ipython and matplotlib in my system. I checked the versions of both via pip freeze
.
ipython==7.12.0
matplotlib==3.1.3
I do not understand why I get those errors. Any help is highly appreciated!
Here is the full log file from Heroku.
(base) MacBook-Pro:minimal-heroku-demo earik$ heroku logs --tail
2020-08-06T18:44:46.883080+00:00 app[web.1]:
2020-08-06T18:44:46.901384+00:00 heroku[router]: at=info method=GET path="/vis_ultrafast_data" host=visud.herokuapp.com request_id=ca273d7c-546b-4f7e-b7c2-87816e7ac86e fwd="31.151.169.49" dyno=web.1 connect=0ms service=40ms status=200 bytes=27101 protocol=https
2020-08-06T18:44:47.667700+00:00 app[web.1]: 2020-08-06 18:44:47,667 WebSocket connection opened
2020-08-06T18:44:47.668508+00:00 app[web.1]: 2020-08-06 18:44:47,668 ServerConnection created
2020-08-06T18:45:24.533104+00:00 heroku[router]: at=info method=GET path="/vis_ultrafast_data/ws" host=visud.herokuapp.com request_id=c13c0bf8-5db0-4616-b07c-b98fcf919bb4 fwd="31.151.169.49" dyno=web.1 connect=1ms service=36872ms status=101 bytes=477 protocol=https
2020-08-06T18:45:24.533488+00:00 app[web.1]: 2020-08-06 18:45:24,533 WebSocket connection closed: code=1001, reason=None
2020-08-06T18:48:37.151660+00:00 heroku[router]: at=info method=GET path="/" host=visud.herokuapp.com request_id=4a9d3492-d274-48cc-93c8-da21141013b3 fwd="31.151.169.49" dyno=web.1 connect=0ms service=4ms status=302 bytes=197 protocol=https
2020-08-06T18:48:37.308781+00:00 app[web.1]: 2020-08-06 18:48:37,308 Error running application handler <bokeh.application.handlers.notebook.NotebookHandler object at 0x7f1836ed4710>: No module named 'matplotlib'
2020-08-06T18:48:37.308790+00:00 app[web.1]: File "vis_ultrafast_data.ipynb", line 14, in <module>:
2020-08-06T18:48:37.308792+00:00 app[web.1]: "Lets first import our transient absorption data. In this case, data file is tab delimited. First row is pixel (wavelength) axis (in nanometer), the first column is time axis (in seconds). Following code creates an interactive figure for time-traces. " Traceback (most recent call last):
2020-08-06T18:48:37.308793+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/bokeh/application/handlers/code_runner.py", line 197, in run
2020-08-06T18:48:37.308794+00:00 app[web.1]: exec(self._code, module.__dict__)
2020-08-06T18:48:37.308794+00:00 app[web.1]: File "/app/vis_ultrafast_data.ipynb", line 14, in <module>
2020-08-06T18:48:37.308795+00:00 app[web.1]: "Lets first import our transient absorption data. In this case, data file is tab delimited. First row is pixel (wavelength) axis (in nanometer), the first column is time axis (in seconds). Following code creates an interactive figure for time-traces. "
2020-08-06T18:48:37.308795+00:00 app[web.1]: ModuleNotFoundError: No module named 'matplotlib'
2020-08-06T18:48:37.309124+00:00 app[web.1]:
2020-08-06T18:48:37.326437+00:00 heroku[router]: at=info method=GET path="/vis_ultrafast_data" host=visud.herokuapp.com request_id=54338a39-dab0-463b-9519-91b53ffd86e1 fwd="31.151.169.49" dyno=web.1 connect=1ms service=26ms status=200 bytes=27101 protocol=https
2020-08-06T18:48:38.160103+00:00 app[web.1]: 2020-08-06 18:48:38,159 WebSocket connection opened
2020-08-06T18:48:38.160675+00:00 app[web.1]: 2020-08-06 18:48:38,160 ServerConnection created
2020-08-06T18:48:48.443288+00:00 app[web.1]: 2020-08-06 18:48:48,443 Error running application handler <bokeh.application.handlers.notebook.NotebookHandler object at 0x7f1836ed4710>: No module named 'matplotlib'
2020-08-06T18:48:48.443304+00:00 app[web.1]: File "vis_ultrafast_data.ipynb", line 14, in <module>:
2020-08-06T18:48:48.443305+00:00 app[web.1]: "Lets first import our transient absorption data. In this case, data file is tab delimited. First row is pixel (wavelength) axis (in nanometer), the first column is time axis (in seconds). Following code creates an interactive figure for time-traces. " Traceback (most recent call last):
2020-08-06T18:48:48.443306+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/bokeh/application/handlers/code_runner.py", line 197, in run
2020-08-06T18:48:48.443306+00:00 app[web.1]: exec(self._code, module.__dict__)
2020-08-06T18:48:48.443307+00:00 app[web.1]: File "/app/vis_ultrafast_data.ipynb", line 14, in <module>
2020-08-06T18:48:48.443307+00:00 app[web.1]: "Lets first import our transient absorption data. In this case, data file is tab delimited. First row is pixel (wavelength) axis (in nanometer), the first column is time axis (in seconds). Following code creates an interactive figure for time-traces. "
2020-08-06T18:48:48.443308+00:00 app[web.1]: ModuleNotFoundError: No module named 'matplotlib'
2020-08-06T18:48:48.443314+00:00 app[web.1]:
2020-08-06T18:48:48.453408+00:00 heroku[router]: at=info method=GET path="/vis_ultrafast_data" host=visud.herokuapp.com request_id=cda49257-07b5-471b-98ac-21121ead102e fwd="31.151.169.49" dyno=web.1 connect=1ms service=13ms status=200 bytes=27141 protocol=https
2020-08-06T18:48:48.588733+00:00 heroku[router]: at=info method=GET path="/vis_ultrafast_data/ws" host=visud.herokuapp.com request_id=bcf674eb-4aa4-40f9-bdcc-ee73d956f61b fwd="31.151.169.49" dyno=web.1 connect=1ms service=10430ms status=101 bytes=474 protocol=https
2020-08-06T18:48:48.589089+00:00 app[web.1]: 2020-08-06 18:48:48,588 WebSocket connection closed: code=1001, reason=None
2020-08-06T18:48:48.969487+00:00 app[web.1]: 2020-08-06 18:48:48,969 WebSocket connection opened
2020-08-06T18:48:48.970460+00:00 app[web.1]: 2020-08-06 18:48:48,970 ServerConnection created
2020-08-06T18:49:13.401206+00:00 heroku[web.1]: Restarting
2020-08-06T18:49:13.415818+00:00 heroku[web.1]: State changed from up to starting
2020-08-06T18:49:14.564555+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2020-08-06T18:49:14.603078+00:00 app[web.1]: Received signal 15, shutting down
2020-08-06T18:49:14.826506+00:00 heroku[router]: at=info method=GET path="/vis_ultrafast_data/ws" host=visud.herokuapp.com request_id=a36193de-8d01-4cf8-8eb5-f318c50f9fed fwd="31.151.169.49" dyno=web.1 connect=0ms service=25856ms status=101 bytes=226 protocol=https
2020-08-06T18:49:14.889499+00:00 heroku[web.1]: Process exited with status 0
2020-08-06T18:49:23.764286+00:00 heroku[web.1]: Starting process with command `panel serve --address="0.0.0.0" --port=16711 vis_ultrafast_data.ipynb --allow-websocket-origin=visud.herokuapp.com`
2020-08-06T18:49:31.255019+00:00 app[web.1]: /app/.heroku/python/lib/python3.6/site-packages/nbconvert/filters/strings.py:214: UserWarning: IPython is needed to transform IPython syntax to pure Python. Install ipython if you need this functionality.
2020-08-06T18:49:31.255085+00:00 app[web.1]: "IPython is needed to transform IPython syntax to pure Python."
2020-08-06T18:49:31.263965+00:00 app[web.1]: 2020-08-06 18:49:31,263 Starting Bokeh server version 2.1.1 (running on Tornado 6.0.4)
2020-08-06T18:49:31.266846+00:00 app[web.1]: 2020-08-06 18:49:31,266 User authentication hooks NOT provided (default user enabled)
2020-08-06T18:49:31.277717+00:00 app[web.1]: 2020-08-06 18:49:31,277 Bokeh app running at: http://0.0.0.0:16711/vis_ultrafast_data
2020-08-06T18:49:31.277927+00:00 app[web.1]: 2020-08-06 18:49:31,277 Starting Bokeh server with process id: 4
2020-08-06T18:49:31.525669+00:00 heroku[web.1]: State changed from starting to up
2020-08-06T18:49:32.538309+00:00 heroku[router]: at=info method=GET path="/" host=visud.herokuapp.com request_id=76019c13-478d-4c32-8c4f-3b41eef167bd fwd="31.151.169.49" dyno=web.1 connect=0ms service=9ms status=302 bytes=197 protocol=https
2020-08-06T18:49:32.760141+00:00 app[web.1]: 2020-08-06 18:49:32,759 Error running application handler <bokeh.application.handlers.notebook.NotebookHandler object at 0x7f18c81ef710>: No module named 'matplotlib'
2020-08-06T18:49:32.760167+00:00 app[web.1]: File "vis_ultrafast_data.ipynb", line 14, in <module>:
2020-08-06T18:49:32.760177+00:00 app[web.1]: "Lets first import our transient absorption data. In this case, data file is tab delimited. First row is pixel (wavelength) axis (in nanometer), the first column is time axis (in seconds). Following code creates an interactive figure for time-traces. " Traceback (most recent call last):
2020-08-06T18:49:32.760179+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/bokeh/application/handlers/code_runner.py", line 197, in run
2020-08-06T18:49:32.760180+00:00 app[web.1]: exec(self._code, module.__dict__)
2020-08-06T18:49:32.760180+00:00 app[web.1]: File "/app/vis_ultrafast_data.ipynb", line 14, in <module>
2020-08-06T18:49:32.760181+00:00 app[web.1]: "Lets first import our transient absorption data. In this case, data file is tab delimited. First row is pixel (wavelength) axis (in nanometer), the first column is time axis (in seconds). Following code creates an interactive figure for time-traces. "
2020-08-06T18:49:32.760181+00:00 app[web.1]: ModuleNotFoundError: No module named 'matplotlib'
2020-08-06T18:49:32.760182+00:00 app[web.1]:
2020-08-06T18:49:32.772732+00:00 heroku[router]: at=info method=GET path="/vis_ultrafast_data" host=visud.herokuapp.com request_id=96b66b3d-19b4-4f25-868c-530a9e831f76 fwd="31.151.169.49" dyno=web.1 connect=0ms service=28ms status=200 bytes=27101 protocol=https
2020-08-06T18:49:36.494658+00:00 app[web.1]: 2020-08-06 18:49:36,494 WebSocket connection opened
2020-08-06T18:49:36.497244+00:00 app[web.1]: 2020-08-06 18:49:36,497 ServerConnection created
2020-08-06T18:49:39.813220+00:00 app[web.1]: 2020-08-06 18:49:39,812 Error running application handler <bokeh.application.handlers.notebook.NotebookHandler object at 0x7f18c81ef710>: No module named 'matplotlib'
2020-08-06T18:49:39.813231+00:00 app[web.1]: File "vis_ultrafast_data.ipynb", line 14, in <module>:
2020-08-06T18:49:39.813232+00:00 app[web.1]: "Lets first import our transient absorption data. In this case, data file is tab delimited. First row is pixel (wavelength) axis (in nanometer), the first column is time axis (in seconds). Following code creates an interactive figure for time-traces. " Traceback (most recent call last):
2020-08-06T18:49:39.813234+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/bokeh/application/handlers/code_runner.py", line 197, in run
2020-08-06T18:49:39.813234+00:00 app[web.1]: exec(self._code, module.__dict__)
2020-08-06T18:49:39.813235+00:00 app[web.1]: File "/app/vis_ultrafast_data.ipynb", line 14, in <module>
2020-08-06T18:49:39.813235+00:00 app[web.1]: "Lets first import our transient absorption data. In this case, data file is tab delimited. First row is pixel (wavelength) axis (in nanometer), the first column is time axis (in seconds). Following code creates an interactive figure for time-traces. "
2020-08-06T18:49:39.813236+00:00 app[web.1]: ModuleNotFoundError: No module named 'matplotlib'
2020-08-06T18:49:39.813242+00:00 app[web.1]:
2020-08-06T18:49:39.824568+00:00 heroku[router]: at=info method=GET path="/vis_ultrafast_data" host=visud.herokuapp.com request_id=3a133857-df49-4d73-ab6e-db86455744e3 fwd="31.151.169.49" dyno=web.1 connect=1ms service=20ms status=200 bytes=27141 protocol=https
2020-08-06T18:49:39.965345+00:00 app[web.1]: 2020-08-06 18:49:39,965 Error running application handler <bokeh.application.handlers.notebook.NotebookHandler object at 0x7f18c81ef710>: No module named 'matplotlib'
2020-08-06T18:49:39.965347+00:00 app[web.1]: File "vis_ultrafast_data.ipynb", line 14, in <module>:
2020-08-06T18:49:39.965348+00:00 app[web.1]: "Lets first import our transient absorption data. In this case, data file is tab delimited. First row is pixel (wavelength) axis (in nanometer), the first column is time axis (in seconds). Following code creates an interactive figure for time-traces. " Traceback (most recent call last):
2020-08-06T18:49:39.965349+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/bokeh/application/handlers/code_runner.py", line 197, in run
2020-08-06T18:49:39.965349+00:00 app[web.1]: exec(self._code, module.__dict__)
2020-08-06T18:49:39.965350+00:00 app[web.1]: File "/app/vis_ultrafast_data.ipynb", line 14, in <module>
2020-08-06T18:49:39.965350+00:00 app[web.1]: "Lets first import our transient absorption data. In this case, data file is tab delimited. First row is pixel (wavelength) axis (in nanometer), the first column is time axis (in seconds). Following code creates an interactive figure for time-traces. "
2020-08-06T18:49:39.965351+00:00 app[web.1]: ModuleNotFoundError: No module named 'matplotlib'
2020-08-06T18:49:39.965399+00:00 app[web.1]:
2020-08-06T18:49:39.977708+00:00 heroku[router]: at=info method=GET path="/vis_ultrafast_data" host=visud.herokuapp.com request_id=6da0a6ff-711c-4a9e-a284-53da62c40688 fwd="31.151.169.49" dyno=web.1 connect=0ms service=18ms status=200 bytes=27141 protocol=https
2020-08-06T18:49:40.117937+00:00 app[web.1]: 2020-08-06 18:49:40,117 WebSocket connection closed: code=1001, reason=None
2020-08-06T18:49:40.121077+00:00 heroku[router]: at=info method=GET path="/vis_ultrafast_data/ws" host=visud.herokuapp.com request_id=0bfd114d-f5d5-46ad-9db2-ea44b153c9d5 fwd="31.151.169.49" dyno=web.1 connect=1ms service=3629ms status=101 bytes=226 protocol=https
2020-08-06T18:49:40.518095+00:00 app[web.1]: 2020-08-06 18:49:40,517 WebSocket connection opened
2020-08-06T18:49:40.518680+00:00 app[web.1]: 2020-08-06 18:49:40,518 ServerConnection created
2020-08-06T18:49:42.474876+00:00 app[web.1]: 2020-08-06 18:49:42,474 Error running application handler <bokeh.application.handlers.notebook.NotebookHandler object at 0x7f18c81ef710>: No module named 'matplotlib'
2020-08-06T18:49:42.474888+00:00 app[web.1]: File "vis_ultrafast_data.ipynb", line 14, in <module>:
2020-08-06T18:49:42.474893+00:00 app[web.1]: "Lets first import our transient absorption data. In this case, data file is tab delimited. First row is pixel (wavelength) axis (in nanometer), the first column is time axis (in seconds). Following code creates an interactive figure for time-traces. " Traceback (most recent call last):
2020-08-06T18:49:42.474894+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/bokeh/application/handlers/code_runner.py", line 197, in run
2020-08-06T18:49:42.474895+00:00 app[web.1]: exec(self._code, module.__dict__)
2020-08-06T18:49:42.474895+00:00 app[web.1]: File "/app/vis_ultrafast_data.ipynb", line 14, in <module>
2020-08-06T18:49:42.474895+00:00 app[web.1]: "Lets first import our transient absorption data. In this case, data file is tab delimited. First row is pixel (wavelength) axis (in nanometer), the first column is time axis (in seconds). Following code creates an interactive figure for time-traces. "
2020-08-06T18:49:42.474896+00:00 app[web.1]: ModuleNotFoundError: No module named 'matplotlib'
2020-08-06T18:49:42.474904+00:00 app[web.1]:
2020-08-06T18:49:42.484567+00:00 heroku[router]: at=info method=GET path="/vis_ultrafast_data" host=visud.herokuapp.com request_id=b9747cd6-ae2d-4728-a54a-c7ecb3f6042a fwd="31.151.169.49" dyno=web.1 connect=0ms service=13ms status=200 bytes=27141 protocol=https
2020-08-06T18:49:42.609502+00:00 heroku[router]: at=info method=GET path="/vis_ultrafast_data/ws" host=visud.herokuapp.com request_id=7f8d60e5-3c22-4a70-a89d-95beb601c62c fwd="31.151.169.49" dyno=web.1 connect=1ms service=2094ms status=101 bytes=474 protocol=https
2020-08-06T18:49:42.610839+00:00 app[web.1]: 2020-08-06 18:49:42,610 WebSocket connection closed: code=1001, reason=None
2020-08-06T18:49:43.025325+00:00 app[web.1]: 2020-08-06 18:49:43,025 WebSocket connection opened
2020-08-06T18:49:43.025793+00:00 app[web.1]: 2020-08-06 18:49:43,025 ServerConnection created
2020-08-06T18:50:21.476754+00:00 heroku[router]: at=info method=GET path="/vis_ultrafast_data/ws" host=visud.herokuapp.com request_id=53a4cd81-8168-48c7-9d62-c4080a9c3c53 fwd="31.151.169.49" dyno=web.1 connect=0ms service=38452ms status=101 bytes=477 protocol=https
2020-08-06T18:50:21.483175+00:00 app[web.1]: 2020-08-06 18:50:21,482 WebSocket connection closed: code=1001, reason=None
Solution
Finally I made it work. I cleaned up my jupyter notebook code, and noticed that I no longer need to import matplotlib
because I never use it.
Next thing, eventhough I pushed my changes to heroku, it was still complaining about matplotlib. I removed the heroku app and created a new one. Then pushed the changes to heroku master. Voala! It worked!
My requirements file has three components;
panel
hvplot
nbconvert
This github repo also helped me a lot by the way to find my way through.
Answered By - Enis Arik
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.