Jupyter Notebook - Naohiro2g/Raspberry-Pi-Projects GitHub Wiki

pandasについて

pandasは、numpy, matplotlibとセットっぽい。下記いづれか。

* aptの古いバージョンセットで行く。
  - sudo pip3 uninstall numpy matplotlib 
  - sudo apt-get install numpy matplotlib pandas
* pipの最新バージョンセットで行く。
  - sudo pip3 uninstall numpy
  - sudo pip3 pandas

いずれでも、下記、numpyインポートエラーが出る場合があるので、
sudo apt-get install libatlas-base-dev

numpyのインポートエラー対応

sudo apt-get install libatlas-base-dev

pip3でnumpy, matplotlibをインストールしている場合、これでオッケー。
sudo apt-get install python3-pandas
pip3インストール分を抜かなくても、numpy 1.17.0, matplotlib 3.0.3, pandas 0.19.2でいける模様。

pandasをpip3で入れるとコンパイルで死ぬ。40分かかっても終了しない。

うーむ。aptのmu-editorとnumpy, matplotlibはセットだな。
mu-editor (1.0.2+dfsg~uflash-1~bpo9)
python3-numpy (1:1.12.1-3)
python3-matplotlib (2.0.0+dfsg1-2)

だが、mu-editorのREPLは、numpy 1.17.0, matplotlib 3.0.3でも使えている。。

pandas コンパイルできた!

sudo apt-get install cython3 だと、cython3 (0.25.2-1)
sudo pip3 install Cythonだと、最新Cython-0.29.13
cythonが多少古くても関係ないはず。

cython3 (0.25.2-1) itrobot001で成功。005はPlease install Cythonで失敗
sudo pip3 install pandas
:
:
Successfully built pandas
Installing collected packages: numpy, pandas
  Found existing installation: numpy 1.12.1
    Uninstalling numpy-1.12.1:
      Successfully uninstalled numpy-1.12.1
Successfully installed numpy-1.17.0 pandas-0.25.0

itrobot005をリブートして、cython3 0.25のまま再挑戦。
time sudo pip3 install -U pandas
:
50分、Please install Cythonで失敗。やはりChromiumキャッシュ設定??増やしてみる?

Cython-0.29.13で挑戦。itrobot4,6,7,9,10,11挑戦中。
sudo apt-get install libatlas-base-dev
sudo pip3 install Cython 
time sudo pip3 install pandas
:
itrobot4,6,7,9,10,11挑戦中。
6,7,8が「デバイスに空き領域がありません」で失敗。Chromiumのキャッシュ設定がされているものたち。。
/var/tmp 16MB, /tmp 256MB設定, Chromiumに768MB。cat /etc/fstab
4,9,10,11は、成功。75分
6のfstabを書き換えて、再挑戦。書き換え失敗してた。。書き換えできていて、成功。
8のを書き換えて再挑戦。8失敗。
7は、./tmp/ を作ってみて、再挑戦。失敗。

---

itrobot002, 003は、pandas 0.19.2が既に入っている。

itrobot002
time sudo pip3 install -U pandas してみた。
11分で失敗。
エラーImportError: No module named 'numpy._build_utils'
time sudo pip3 install -U pandas --ignore-installedで再挑戦。
:
10分で、同じ結果。
色々抜いて、再挑戦。numpyが無いエラー。。
再挑戦。。またダメ。No module named 'numpy._build_utils'


3,5もZRam/Chromiumキャッシュ設定。。3,5,6,7,8
2はうまくいくはず?

2,6成功、7,8アウト。「デバイスに空き領域がありません」7は当たり前。8は再起動してなかったから。
006は、zRAM設定を外せていた。
3,7,8を512に変えて再挑戦。


nao2g006のtmpを256から512に増やして挑戦。げ、Cython cythonなかった。途中でキャンセル、Cython入れて、もう一度。
75分で成功。tmpは300程度使っていた模様。


RAMDISK設定を外すか、tmpを256から512に変えると無事コンパイル終了。75分かかる。cythonのバージョンは無関係。
ただし、pip側でnumpy最新版が入ってないとダメ。

install/config

sudo pip3 install jupyter
mkdir /home/pi/Documents/jupyter_notebook
jupyter notebook --generate-config

setting

nano /home/pi/.jupyter/jupyter_notebook_config.py

c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.notebook_dir = '/home/pi/Documents/jupyter_notebook'
c.NotebookApp.port = 8888

mac

c.NotebookApp.notebook_dir = '/Users/tsuji/Documents/jupyter_notebook'

password生成

jupyter notebook password
Enter password:
Verify password:
[NotebookPasswordApp] Wrote hashed password to /home/pi/.jupyter/jupyter_notebook_config.json

start

jupyter notebook

Jupyter Labもそろそろ使えるかな

sudo pip3 install jupyterlab

jupyter lab

notebookと併用できる模様