Open jorge0136 opened 4 years ago
The more I look at this error the less it seems to have anything to do with jupyter_on_rails
and more likely my container networking config is to blame. Do you have any suggestions on how to handle the use case where one might want to pass flags to the jupyter
command?
I haven't ever found a smooth and easy way to pass flags through rake without making each of them explicit.
$ rake jupyter:notebook --port 8888
invalid option: --port
For a local development workaround, I was able to reconstruct the command the rake task is executing.
First I evaluated ENV['IPYTHONDIR'] || Rails.root / '.ipython'
in the rails console. I set the JUPYTER_DATA_DIR
env to the output of the command. Finally, I added my required flags. In my case that all shook out to be JUPYTER_DATA_DIR=/app/.ipython jupyter notebook --ip=0.0.0.0 --port 8888
.
While this feels like progress, I still haven't solved my root issue. I still get an error when attempting to require 'iruby/rails'
. Other ruby gems will load but not this one.
Do you have any suggestions on how to handle the use case where one might want to pass flags to the jupyter command?
I think if we are to do this, an cli command implementation of this jupyter_on_rails
would be needed, such that bundle exec juptyer_on_rails notebook --ip=0.0.0.0 --port 8888
which includes the current functionality of rake jupyter:notebook
.
Doing that is simply a matter of development; if anyone can implement it, I'd be happy to merge; if I can spare time, I'll probably implement this feature, but for now I'm a bit occupied.
I came across this project. Thanks for the life saver.
you can use ssh forwarding for this. If you are using terminal of VSCode remote. It will forward 8888 to you automatically.
@jorge0136 @Yuki-Inoue
Jupyter notebooks allow you to set various configuration options using jupyter_notebook_config.py
.
This file can be located in the Jupyter configuration directory, which is usually ~/.jupyter/
.
By setting the options in the jupyter_notebook_config.py
file, you do not need to pass flags when starting the Jupyter notebook server from the command line. The options set in the configuration file will be applied every time the Jupyter notebook server is started. This can be particularly useful if you have a set of options that you always want to use, or if you want to make changes to the default behavior of Jupyter notebooks.
For example, you can set the IP and port like this:
# Set the IP address for Jupyter to listen on
c.NotebookApp.ip = '0.0.0.0'
# Set the port for Jupyter to listen on
c.NotebookApp.port = 8888
This is how I use jupyter_on_rails
with a rails application running in docker.
I hope it helps
I am attempting to add
jupyter_on_rails
to an existing rails application in a docker container. When I executerake jupyter:notebook
from within my container I get the following error. It appears that it is an instance of this issue and may well be an issue with the way I have my container configured.Running jupyter via
iruby notebook --port 8888 --ip=0.0.0.0
starts the server ok but I am unable torequire 'iruby/rails'
within a notebook. Do you have any suggestions for how to pipe flags into the rake task or otherwise troubleshoot this issue?