Skip to content

Deploy the Python Application

Antonio Vivace edited this page Oct 20, 2018 · 17 revisions

Prerequisites:

  • portaudio19-dev (to compile pyaudio)
  • git
  • python3
  • python3-pip
  • python3-venv
  • libopenjp2-7-dev libtiff5 (pillow)
sudo apt install portaudio19-dev git python3-pip python3 python3-venv libopenjp2-7-dev libtiff5 libatlas-base-dev libhdf5-dev libhdf5-serial-dev python-gobject libharfbuzz-bin libwebp6 libjasper1 libilmbase12 libgstreamer1.0-0 libavcodec-extra57 libavformat57 libopencv-dev libqtgui4 libqt4-test omxplayer
git clone https://github.com/CoderBotOrg/coderbot.git
cd coderbot
python3 -m venv .
source bin/activate
pip3 install -r requirements.txt
python3 init.py

Note that an error about PyAudio, similar to this

Building wheels for collected packages: PyAudio
  Running setup.py bdist_wheel for PyAudio ... error
  Complete output from command /home/pi/coderbot/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-vup_psej/PyAudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpq1wxoi_1pip-wheel- --python-tag cp35:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help
  
  error: invalid command 'bdist_wheel'
  
  ----------------------------------------
  Failed building wheel for PyAudio
  Running setup.py clean for PyAudio
Failed to build PyAudio

is completely normal. Installation will proceed using Running setup.py install for PyAudio ... done. As long as you can see "PyAudio" in the list of "Installing collected packages", everything is good.

Stub

sudo apt install portaudio19-dev git python3-pip python3 python3-venv libopenjp2-7-dev libtiff5 libatlas-base-dev libhdf5-dev libhdf5-serial-dev python-gobject libharfbuzz-bin libwebp6 libilmbase12 libgstreamer1.0-0 libavcodec-extra57 libavformat57 libopencv-dev libqtgui4 libqt4-test
git clone https://github.com/CoderBotOrg/coderbot.git --branch rpi-stub
cd coderbot
python3 -m venv .
source bin/activate
pip3 install -r requirements.txt
PYTHONPATH=./stub python3 init.py

Note error on pycairo when installing requirementes.txt, delete "pycairo==1.17.0" from requirements.txt

Failed to build pycairo
Installing collected packages: pycairo
  Running setup.py install for pycairo ... error
    Complete output from command /home/bino/coderbot/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-q1ny_iy2/pycairo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-y9mjjns0-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/bino/coderbot/include/site/python3.6/pycairo:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/cairo
    copying cairo/__init__.py -> build/lib.linux-x86_64-3.6/cairo
    copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.6/cairo
    copying cairo/py.typed -> build/lib.linux-x86_64-3.6/cairo
    running build_ext
    Package cairo was not found in the pkg-config search path.
    Perhaps you should add the directory containing `cairo.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'cairo' found
    Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1.
    
    ----------------------------------------
Command "/home/user/coderbot/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-q1ny_iy2/pycairo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-y9mjjns0-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/coderbot/include/site/python3.6/pycairo" failed with error code 1 in /tmp/pip-build-q1ny_iy2/pycairo/
Clone this wiki locally