There should be a command like 'jupyter runkernel' to provide a
uniform interface to start different kernels. I'm actually working on
jupyter_client at the moment, and a command like this is one of my
goals for that work a bit further down the line.
https://github.com/jupyter/jupyter_client/pull/308
In the meantime, you have a few options.
- One is to to run the whole notebook server in the docker container.
This is what services like mybinder.org <http://mybinder.org> and
tmpnb.org <http://tmpnb.org> do, for instance. The notebook server
starts kernels itself inside the container.
- Another is to figure out the commands for the kernels you're using.
You can do this by investigating their kernelspecs (see
http://jupyter-client.readthedocs.io/en/stable/kernels.html#kernel-specs )
- Using kernel_gateway and nb2kg might be another option
- Finally, there's what you were trying. It's not an unreasonable way
to do it, but it does make things like shutting down a kernel
trickier. You can probably trick jupyter-console into running by
launching it with Ptyprocess (
http://ptyprocess.readthedocs.io/en/latest/ ).
Thomas
On 7 December 2017 at 21:01, Xavier Orduña <[email protected]
<mailto:[email protected]>> wrote:
Hi Thomas and Carlos,
Thanks for your ansers, let me clarify a little bit what I am
trying to achieve here.
I have a process that needs to run jupyter notebooks (using
different kernels, python2, python3, R, etc ...) but since I don't
trust those notebooks I want to execute them in a protected
environment. I managed to get this working running ipython kernel
in the docker container. The process uses a KernelClient to run
the notebooks remotely in the container.
This is ok for just one environment, but if want to have many
different kernels and languages, I wanted to get advantage of
wrapping them using jupyter console. Mainly because when properly
installed, jupyter console manages kernel using the --kernel
argument which makes the solution pretty clean. This way, in case
I want to add new kernels, I just need to configure them in the
docker container and launch jupyter console with a different argument.
I know I can run ipython direclty, but it is not clear how to run
other kernels directly (for example R).
Thanks a lot!
Xavi
Xavi
-----------------------------
http://www.alcim.net
On Thu, Dec 7, 2017 at 9:09 PM, Carlos Córdoba
<[email protected] <mailto:[email protected]>> wrote:
Xavier, you could start a kernel and connect to it, instead of
starting a jupyter console. If you're using ipykernel, that
just requires running
ipython kernel
Cheers,
Carlos
El 07/12/17 a las 14:57, Thomas Kluyver escribió:
Why do you want to start a console in the background? A
console is an interactive user interface, so it doesn't
really make sense to run it in the background. We can
probably figure out a way to do it, but there may be a better
way to achieve what you want to do.
On 7 December 2017 at 18:23, Xavier Orduña
<[email protected] <mailto:[email protected]>> wrote:
HI!
I am trying to run jupyter console using docker and
connect to this running console from another client. If I
start the container using interactive mode (-ti) and then
start the jupyter console, everything is fine.
But if i run jupyter console as the entry point, then I
got this exception:
|
Traceback(most recent call last):
File"/usr/local/bin/jupyter-console",line 11,in<module>
sys.exit(main())
File"/usr/local/lib/python3.5/dist-packages/jupyter_core/application.py",line
266,inlaunch_instance
returnsuper(JupyterApp,cls).launch_instance(argv=argv,**kwargs)
File"/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py",line
657,inlaunch_instance
app.initialize(argv)
File"<decorator-gen-116>",line 2,ininitialize
File"/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py",line
87,incatch_config_error
returnmethod(app,*args,**kwargs)
File"/usr/local/lib/python3.5/dist-packages/jupyter_console/app.py",line
141,ininitialize
self.init_shell()
File"/usr/local/lib/python3.5/dist-packages/jupyter_console/app.py",line
114,ininit_shell
client=self.kernel_client,
File"/usr/local/lib/python3.5/dist-packages/traitlets/config/configurable.py",line
412,ininstance
inst =cls(*args,**kwargs)
File"/usr/local/lib/python3.5/dist-packages/jupyter_console/ptshell.py",line
273,in__init__
self.init_prompt_toolkit_cli()
File"/usr/local/lib/python3.5/dist-packages/jupyter_console/ptshell.py",line
435,ininit_prompt_toolkit_cli
output=create_output(true_color=self.true_color),
File"/usr/local/lib/python3.5/dist-packages/prompt_toolkit/shortcuts.py",line
126,increate_output
ansi_colors_only=ansi_colors_only,term=term)
File"/usr/local/lib/python3.5/dist-packages/prompt_toolkit/terminal/vt100_output.py",line
424,infrom_pty
assertstdout.isatty()
AssertionErrorIntroduïu el codi aquí...
|
As far as I understand, the error is caused when the
jupyter console tries to start the interactive terminal ...
Is there any way to launch the console in the background?
without showing the console it self in the terminal.
I checked the options and I am unable to find any of the
that suits my needs.
This is the script that starts the kernel:
|
./push_to_server.sh &
IP=`ifconfig eth0 2>/dev/null|awk '/inet addr:/ {print
$2}'|sed 's/addr://'`
#ipython kernel --control=42005 --shell=42001
--iopub=42002 --hb=42003 --stdin=42004 --ip="$IP" -f
/kernel_config.json
#ipython kernel --ip="$IP" -f /kernel_config.json
--log-level=DEBUG
nohup jupyter console --ip="$IP"-f /kernel_config.json
--log-level=DEBUG --kernel=python3 $*
|
As you can see, i used directly ipython kernel before,
but then to have more than one kernel was complicated.
Thank you very much!
Xavi
--
You received this message because you are subscribed to
the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails
from it, send an email to
[email protected]
<mailto:[email protected]>.
To post to this group, send email to
[email protected] <mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jupyter/f406fc9a-7235-4b7e-91fe-424496d559e5%40googlegroups.com
<https://groups.google.com/d/msgid/jupyter/f406fc9a-7235-4b7e-91fe-424496d559e5%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit
https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the
Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from
it, send an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jupyter/CAOvn4qhTun9SqLbKqa1bJA%2BORVCc1SkoLNawofyV7wrxpEg5gw%40mail.gmail.com
<https://groups.google.com/d/msgid/jupyter/CAOvn4qhTun9SqLbKqa1bJA%2BORVCc1SkoLNawofyV7wrxpEg5gw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to a
topic in the Google Groups "Project Jupyter" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/jupyter/lJz-z5YGHgc/unsubscribe
<https://groups.google.com/d/topic/jupyter/lJz-z5YGHgc/unsubscribe>.
To unsubscribe from this group and all its topics, send an
email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jupyter/5cde4bb6-f2cb-59c3-f9a8-09abcd56e189%40gmail.com
<https://groups.google.com/d/msgid/jupyter/5cde4bb6-f2cb-59c3-f9a8-09abcd56e189%40gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google
Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jupyter/CAARHq%3DF4nRf1cPKBB33qCttA-VWaCWupy2LxVM-_hiY8%3DNb-Wg%40mail.gmail.com
<https://groups.google.com/d/msgid/jupyter/CAARHq%3DF4nRf1cPKBB33qCttA-VWaCWupy2LxVM-_hiY8%3DNb-Wg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google
Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jupyter/CAOvn4qjTG%3D2UtcZD2Q%3DjBpHHTbShpfOPG9kNJfp7To09FYJ_eQ%40mail.gmail.com
<https://groups.google.com/d/msgid/jupyter/CAOvn4qjTG%3D2UtcZD2Q%3DjBpHHTbShpfOPG9kNJfp7To09FYJ_eQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.