Setting up Raspbian Stretch Lite for Mac

Note: I am using a raspberry pi 2 with 64 gb sd card. As of finishing this setup i used up 1.9GB on /dev/root

This setup assumes that you have no ethernet available and will try to connect to wifi immediately. This will also setup the raspberry pi as headless from the start so you don’t have to have an extra monitor and keyboard.

(Though this is not effective for the purpose of this Pi which is mesh network) I think. I’m not sure since we could just add in a 2nd wifi dongle if needed.

  1. Download current and historical image files here.
  2. Setup using macbook command line following instructions here
  3. While the card is inserted to the Mac, Add an ssh file at the boot directory
    • command is: touch ssh
    • if it doesn’t work, remove and reinsert the card
  4. Plugin Pi to an ethernet/LAN network you can access
    • This is important as you will be using ssh.
    • If you are going to use wifi then you need a keyboard and monitor and follow this setup
    • network {
          ssid = ""
          psk =""
      }

Once you are connected, regardless of method (but from here on we assume via SSH)

  1. Enter the command sudo raspi-config
    1. Opens up the GUI config tool
    2. Choose Localisation Options and then Keyboard layout
    3. Change Locales
    4. en_US.UTF-8
    5. sudo locale-gen en_US.UTF-8
    6. sudo update-locale en_US.UTF-8

If you want to connect to hidden SSID, forums say to just include the following: scan_ssid = 1, in the supplicant.conf. But I couldn’t get it to work. Hence the focus on using LAN first or visible SSIDs.

Changing the timezone.

sudo dpkg-reconfigure tzdata

Default Pi credentials:

username: pi
password: raspberry

 

Installing TensorFlow on Raspberry Pi

This git page discusses how to do it but using Raspbian Jessie Lite, although I was able to do it on Stretch lite. If you want to do it painlessly, use Python 2.7. If you want to use 3.5, i think you just have to rename the whl file for 3.2 to 3.5. (I haven’t tried that yet)

*Note that runnign setup.py bdist_wheel for numpy (takes a long time, about 15-20 min i think), it will look like it hanged, but just wait for it.

Detecting the Raspberry Pi on the LAN

If possible, also connect your main workstation to the same LAN as the Pi (or if you are working in a smaller network, like your home, then you can just use wifi, what is important is you find the IP of the Pi)

  • using mac:  brew install arp-scan
  • ifconfig to know which interface is connected
  • sudo arp-scan –interface=en3 –localnet

Next you can try setting up a static IP address for the Pi so you don’t have to look for it’s IP everytime. This is easy for a home network as you can set the static settings on the router, but for a school wide network or office network, then this will be more difficult.

Installing updated Vim on Raspberry Pi 2/3

Right now i don’t think we can install vim with Python 2 support easily: https://github.com/joonty/vdebug/issues/303

So we install vim.nox with support for Python 3, this shouldn’t have any impact with the python being used in TensorFlow.

./configure --enable-pythoninterp=yes \
            --with-python-config-dir=/usr/lib/python2.7/config \
  • sudo apt-get install vim-nox

  • update-alternatives –list editor
    • You should see the packages/binary that can handle editing
  • sudo update-alternatives –set editor /usr/bin/vim.nox
  • git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
  • Attempt to install YouCompleteMe via the instructions on the git page.

Installing YouCompleteMe

  • After installing Vundle add the following to vimrc
    • Plugin ‘Valloric/YouCompleteMe’
    • save
  • Open vim and :PluginInstall
  • Wait a while
  • If you get this error:
    • The ycmd server SHUT DOWN (restart with ‘:Ycm… Follow the instructions in the documentation

    • Need to compile manually
    • Go to ~/.vim/bundles/YouCompleteMe
    • sudo apt-get install cmake
    • YCM_CORES=1 ./install.py (if you are interested in autocompletion for c/c++, go etc… see their documentation)
    • This will take a while (15-20 minutes)

Transferring files to Pi

to compress: tar -zcvf name.tar.gz folder
extract: tar -zxvf name.tar.gz
scp -rv file-to-transfer.zip pi@IP_ADDRESS:/path

Transfer trained files from tensor flow for poets

python label_image.py --graph=retrained_graph.pb --image=../tae.jpg --labels=retrained_labels.txt

Backing up Pi image

Regular back-up methods will copy the whole sd card size to your destination. If you want to resize the image generated, please check the following links.

 

 

 

One response to “Setting up Raspbian Stretch Lite for Mac”

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.