To content | To menu | To search

Monday, March 16 2020

Jupyter notebook で connected が点滅して処理が進まない

自宅で実行している Jupyter Notebook を外からアクセスしたかったので、リバースプロキシを設定しました こちらの下の方、

  • proxy_http_version 1.1;


ついでに ssl_stapling の設定も合わせてみた。

Thursday, June 15 2017

pip のエラー

pip でインストールしたもののアップデートをかけたら、pip 自身がエラーを吐くようになった。

Continue reading...

Thursday, February 2 2017

FreeBSD と Python3 で Jupyter notebook を動かした話

pkg や ports で Python3 をインストールしようとしても、周りのライブラリなどが複数のバージョンの Python2 をインストールしようとするので、観念して pkg や ports を使わずにセットアップした話。

Continue reading...

Thursday, June 18 2015

IPython Notebook


FreeBSD なら

# pkg install devel/ipython


$ ipython notebook


# ipython notebook --no-browser --port=80

ポート 80 はルート権限でないと使わせてくれない?あと Listen するアドレスの指定が必要だった。


$ ipython help notebook --help-all


とりあえず TLS 対応してみたい。ひとまず勝手証明書で。ディレクトリは適当。

# mkdir /usr/local/etc/cert
# cd /usr/local/etc/cert/
root@freebsd:/usr/local/etc/cert # openssl genrsa -des3 -out server.key 1024
Generating RSA private key, 1024 bit long modulus
e is 65537 (0x10001)
Enter pass phrase for server.key:
Verifying - Enter pass phrase for server.key:
root@freebsd:/usr/local/etc/cert # openssl req -new -days 365 -key server.key -out server.csr
Enter pass phrase for server.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
Country Name (2 letter code) [AU]: **
State or Province Name (full name) [Some-State]: *****
Locality Name (eg, city) []:*****
Organization Name (eg, company) [Internet Widgits Pty Ltd]:*****
Organizational Unit Name (eg, section) []:*****
Common Name (e.g. server FQDN or YOUR name) []:*****
Email Address []:*****

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
root@freebsd:/usr/local/etc/cert #
root@freebsd:/usr/local/etc/cert # openssl x509 -req -signkey server.key -days 365 -in server.csr -out server.crt
Signature ok
Getting Private key
Enter pass phrase for server.key:
root@freebsd:/usr/local/etc/cert # mv server.key server.key.bak
root@freebsd:/usr/local/etc/cert # openssl rsa -in server.key.bak -out server.key
Enter pass phrase for server.key.bak:
writing RSA key
root@freebsd:/usr/local/etc/cert # ls
server.crt      server.csr      server.key      server.key.bak


# ipython notebook --no-browser --port=443 --ip=*** --NotebookApp.certfile=/usr/local/etc/cert/server.crt --NotebookApp.keyfile=/usr/local/etc/cert/server.key

とすると https://*** で TLS 接続。

IPython のためのディレクトリも作っておこう。

# mkdir /home/ipython
# mkdir /home/ipython/.ipython
# mkdir /home/ipython/notebook


$ ipython
Python 2.7.9 (default, Jun 12 2015, 19:23:08)
Type "copyright", "credits" or "license" for more information.

IPython 3.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from IPython.lib import passwd; passwd()
Enter password:
Verify password:
Out[1]: 'sha1:****************************************************************'

In [2]: exit


# ipython notebook --no-browser --port=443 --ip=***** --NotebookApp.certfile=/usr/local/etc/cert/server.crt --NotebookApp.keyfile=/usr/local/etc/cert/server.key --NotebookApp.password='sha1:****************************************************************' --ipython-dir=/home/ipython/.ipython --notebook-dir=/home/ipython/notebook --log-level=WARN