|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +password='jetbot' |
| 4 | + |
| 5 | +# Keep updating the existing sudo time stamp |
| 6 | +sudo -v |
| 7 | +while true; do sudo -n true; sleep 120; kill -0 "$$" || exit; done 2>/dev/null & |
| 8 | + |
| 9 | +# Enable i2c permissions |
| 10 | +sudo usermod -aG i2c $USER |
| 11 | + |
| 12 | +# Install pip and some python dependencies |
| 13 | +sudo apt-get update |
| 14 | +sudo apt install -y python3-pip python3-pil |
| 15 | +sudo pip3 install --upgrade numpy |
| 16 | + |
| 17 | +# Install the pre-built TensorFlow pip wheel |
| 18 | +sudo apt-get update |
| 19 | +sudo apt-get install -y libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev |
| 20 | +sudo apt-get install -y python3-pip |
| 21 | +sudo pip3 install -U pip |
| 22 | +sudo pip3 install -U numpy==1.16.1 future==0.17.1 mock==3.0.5 h5py==2.9.0 keras_preprocessing==1.0.5 keras_applications==1.0.6 enum34 futures testresources setuptools protobuf |
| 23 | +sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow-gpu==1.14.0+nv19.10 |
| 24 | + |
| 25 | +# Install the pre-built PyTorch pip wheel |
| 26 | +wget https://nvidia.box.com/shared/static/phqe92v26cbhqjohwtvxorrwnmrnfx1o.whl -O torch-1.3.0-cp36-cp36m-linux_aarch64.whl |
| 27 | +sudo pip3 install numpy torch-1.3.0-cp36-cp36m-linux_aarch64.whl |
| 28 | + |
| 29 | +# Install torchvision package |
| 30 | +git clone https://github.com/pytorch/vision |
| 31 | +cd vision |
| 32 | +git checkout v0.4.0 |
| 33 | +sudo python3 setup.py install |
| 34 | + |
| 35 | +# Install traitlets (master, to support the unlink() method) |
| 36 | +sudo python3 -m pip install git+https://github.com/ipython/traitlets@master |
| 37 | + |
| 38 | +# Install jupyter lab |
| 39 | +sudo apt install -y nodejs npm |
| 40 | +sudo pip3 install jupyter jupyterlab |
| 41 | +sudo jupyter labextension install @jupyter-widgets/jupyterlab-manager |
| 42 | + |
| 43 | +jupyter lab --generate-config |
| 44 | +#jupyter notebook password |
| 45 | +python3 -c "from notebook.auth.security import set_password; set_password('$password', '$HOME/.jupyter/jupyter_notebook_config.json')" |
| 46 | + |
| 47 | +# install jetbot python module |
| 48 | +cd |
| 49 | +sudo apt install -y python3-smbus |
| 50 | +cd ~/jetbot |
| 51 | +sudo apt-get install -y cmake |
| 52 | +sudo python3 setup.py install |
| 53 | + |
| 54 | +# Install jetbot services |
| 55 | +cd jetbot/utils |
| 56 | +python3 create_stats_service.py |
| 57 | +sudo mv jetbot_stats.service /etc/systemd/system/jetbot_stats.service |
| 58 | +sudo systemctl enable jetbot_stats |
| 59 | +sudo systemctl start jetbot_stats |
| 60 | +python3 create_jupyter_service.py |
| 61 | +sudo mv jetbot_jupyter.service /etc/systemd/system/jetbot_jupyter.service |
| 62 | +sudo systemctl enable jetbot_jupyter |
| 63 | +sudo systemctl start jetbot_jupyter |
| 64 | + |
| 65 | +# Make swapfile |
| 66 | +cd |
| 67 | +sudo fallocate -l 4G /var/swapfile |
| 68 | +sudo chmod 600 /var/swapfile |
| 69 | +sudo mkswap /var/swapfile |
| 70 | +sudo swapon /var/swapfile |
| 71 | +sudo bash -c 'echo "/var/swapfile swap swap defaults 0 0" >> /etc/fstab' |
| 72 | + |
| 73 | +# Copy JetBot notebooks to home directory |
| 74 | +cp -r ~/jetbot/notebooks ~/Notebooks |
| 75 | + |
0 commit comments