If you are running a Jupyter notebook as a batch job, and it contains a long-running cell, you may encounter the following error:
[NbConvertApp] ERROR | Timeout waiting for execute reply (30s). If your cell should take longer than this, you can increase the timeout with: c.ExecutePreprocessor.timeout = SECONDS in jupyter_nbconvert_config.py
This indicates that the cell caused Jupyter to timeout. You can avoid this by configuring a longer timeout. Here's how to do it in the pre-setup script of a custom environment definition:
echo "c.ExecutePreprocessor.timeout = $SECONDS" >> /home/ubuntu/.ipython/profile_default/ipython_nbconvert_config.py
chown ubuntu:ubuntu /home/ubuntu/.ipython/profile_default/ipython_nbconvert_config.py
Substitute an appropriate value for $SECONDS. Note the chown command - this is needed because the pre-setup script runs as the root user, so the file ownership must be changed back to the ubuntu user in order to avoid a permissions error during your run. Keep in mind this is for batch runs.
Note: later versions of Jupyter require you to modify a different config file (/home/ubuntu/.jupyter/jupyter_nbconvert_config.py
instead of /home/ubuntu/.ipython/profile_default/ipython_nbconvert_config.py
). If you are running a recent Jupyter version and the above commands do not work, use this instead:
echo "c.ExecutePreprocessor.timeout = $SECONDS" >> /home/ubuntu/.jupyter/jupyter_nbconvert_config.py chown ubuntu:ubuntu /home/ubuntu/.jupyter/jupyter_nbconvert_config.py
Comments
0 comments
Please sign in to leave a comment.