Re: Installing JupyterHub and LDAP

220 views
Skip to first unread message

Jori Mäntysalo

unread,
Oct 26, 2016, 6:40:50 AM10/26/16
to sage-...@googlegroups.com
More progress, but now I am stuck. Last time I ended on

> pip3 install jupyterhub
>
> Noticed that it used IPv6, got a headache when googling, found the
> instruction to put GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet" on
> /etc/default/grub, said update-grub and got the login prompt.

and after that

jupyterhub --no-ssl --port=80

works. Next, I did a snakeoil cert:

openssl req -newkey rsa:2048 -new -nodes -keyout key.pem -out csr.pem
openssl x509 -req -days 365 -in csr.pem -signkey key.pem -out server.crt

and said

jupyterhub --ssl-key=/root/key.pem --ssl-cert=/root/server.crt –port=443

and now I have https connection. Then I said

apt-get install ldap-auth-client nscd

and gave parameters, and checked with

getent passwd

that the server sees ldap users. Then I put

from ldapauthenticator import LDAPAuthenticator

c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'
c.LDAPAuthenticator.server_address = 'ldaps://ldap.myunit.uta.fi'
c.LDAPAuthenticator.bind_dn_template = 'uid={username},ou=People,dc=myunit,dc=uta,dc=fi'

to jupyterhub_config.py.

Now I was able to log in with my LDAP username. But it does not work, I
got

Couldn't set CWD to /home/staff/jm58660 ([Errno 2] No such file or
directory: '/home/staff/jm58660')

Couldn't set CWD to /home/staff ([Errno 2] No such file or directory:
'/home/staff')

/usr/local/lib/python3.5/dist-packages/IPython/paths.py:69: UserWarning:
IPython parent '/home/staff/jm58660' is not a writable location, using a
temp directory.

and so a "500 internal error". So how to tell Jupyterhub to use some kind
of temporary directory for ldap users?

* * *

Some other things: Is it possible to run plain R (or GAP or...) from
Jupyter? Can I change worksheet type, for example test what "10/4" will
output as a plain Python2?

Both are possible with SageNB.

--
Jori Mäntysalo

Dima Pasechnik

unread,
Oct 26, 2016, 9:00:35 AM10/26/16
to sage-devel
you probably need to change the jupyter kernel to the one for R (which does exist, and is stable, I think)
resp. for GAP (does exist too, albeit still in beta, IMHO: see http://opendreamkit.org/activities/2016-08-03-gap-docker-jupyter/)

Luca De Feo

unread,
Oct 26, 2016, 9:02:26 AM10/26/16
to sage-...@googlegroups.com
I have no experience with the LDAP authenticator. It is probably best
to ask your questions on :
https://groups.google.com/forum/#!forum/jupyter

Luca

Luca De Feo

unread,
Oct 26, 2016, 9:05:04 AM10/26/16
to sage-...@googlegroups.com
> Some other things: Is it possible to run plain R (or GAP or...) from
> Jupyter? Can I change worksheet type, for example test what "10/4" will
> output as a plain Python2?
>
> Both are possible with SageNB.

You can change the kernel via the "Kernel" menu (there are kernels for
R, GAP, PARI/GP, Python, etc.), or you can change the kernel inside a
single cell with

%%python2
print 10//4

I just tested that this works in the Jupyter notebook shipped with
Sage, %%python3 breaks, though.

Luca

Jori Mäntysalo

unread,
Oct 28, 2016, 6:26:28 AM10/28/16
to sage-...@googlegroups.com
On Wed, 26 Oct 2016, Luca De Feo wrote:

>> Some other things: Is it possible to run plain R (or GAP or...) from
>> Jupyter?

> You can change the kernel via the "Kernel" menu (there are kernels for
> R, GAP, PARI/GP, Python, etc.)

Kernel menu shows only Python3 and SageMath, so it does not show "kernel
inside kernel", like R in Sage.

> or you can change the kernel inside a
> single cell with
>
> %%python2

Works. Thanks.

* * *

Totally there seems to be too much trouble with Jupyterhub just now. It
seems that SageNB error is not common, so for now we continue with it.

For other purposes Jupyterhub seems to be a great piece of software.

--
Jori Mäntysalo

Dima Pasechnik

unread,
Oct 28, 2016, 12:40:27 PM10/28/16
to sage-devel


On Friday, October 28, 2016 at 10:26:28 AM UTC, Jori Mäntysalo wrote:
On Wed, 26 Oct 2016, Luca De Feo wrote:

>> Some other things: Is it possible to run plain R (or GAP or...) from
>> Jupyter?

> You can change the kernel via the "Kernel" menu (there are kernels for
> R, GAP, PARI/GP, Python, etc.)

Kernel menu shows only Python3 and SageMath, so it does not show "kernel
inside kernel", like R in Sage.

Well, I suppose you can install more "usual" jupyter kernels, e.g. R one, GAP one, etc.

Jori Mäntysalo

unread,
Nov 1, 2016, 5:25:32 AM11/1/16
to sage-devel
On Fri, 28 Oct 2016, Dima Pasechnik wrote:

> Well, I suppose you can install more "usual" jupyter kernels, e.g. R one,
> GAP one, etc.

Of course, but then profit for using Sage fades away.

On the plus side I could have "kernels" for, say, last two stable
versions and last beta.

--
Jori Mäntysalo
Reply all
Reply to author
Forward
0 new messages