Skip to content

Deploy the Python Application

Antonio Vivace edited this page Feb 28, 2019 · 17 revisions

Prerequisites:

  • portaudio19-dev (to compile pyaudio)
  • git
  • python3
  • python3-pip
  • python3-venv
  • libopenjp2-7-dev libtiff5 (pillow)
  • libhdf5-dev (cv2)
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 libhdf5-dev

Note that an error in installing omxplayer may occour, ignore that. Furthermore, if you use Ubuntu, packages >for libjasper1 may not be found, you can solve this problem with:

sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt install libjasper1 libjasper-dev

Now, once you have the dependencies,

git clone https://github.com/CoderBotOrg/coderbot.git
cd coderbot
python3 -m venv .
source bin/activate
pip3 install -r requirements_stub.txt
# If you plan to run just the Stub mode, you don't need the following line
pip3 install -r requirements.txt

Now, run the backend with python3 init.py or

PYTHONPATH=stub:test python3 init.py

for the Stub mode.

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.

Clone this wiki locally