1st time build, MySQL-Python error


Hey folks, Was recommended this project by a fellow home brewer and after reading up, I look forward to getting it online. There seems to be a wealth of information and support on this forum so here’s hoping someone is able to point me in the right direction! (please).

I work in IT and have some exposure to Linux/Unix systems, I have limited experience and am comfy with nano/VI and CLI commands. Im building my kegberry on a Raspberry Pi 2B that I have from a previous project, Arduino and flow meters on order! (thank AliExpress).

I’ve got all the dependencies installed (I believe) and have the Pi system / firmware updated. I’ve reached the point of trying to install kegbot and keep hitting an error. One thing upfront - I am using the latest release of Raspbian Jessie and have identified some dependance require ‘default-’ prefixing to install - which I have done.

The error I get is

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-cIDqL8/MySQL-python/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-record-nWsa3Q/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-cIDqL8/MySQL-python/

Full install output is here: https://www.icloud.com/iclouddrive/02SOECX_mZQ9r5RYXxR4GmOOg#output

I suspect I have missed a step or something, any help would be greatly appreciated.



Welcome to the forum! Check out the first post in this thread for help installing Kegbot on your 2B. It should get you going!


Thanks Johnny for your reply! :slight_smile:

I started with the install based on that forum post, then moved to the original server install guide as has no luck with the instructions in the post. I got the below when following the post:

[email protected]:~ $ sudo bash -c ~/mypkgs/install.sh

  • sudo bash -c ‘DEBIAN_FRONTEND=noninteractive apt-get -yq install python-setuptools’
    Reading package lists…
    Building dependency tree…
    Reading state information…
    python-setuptools is already the newest version (40.8.0-1).
    The following packages were automatically installed and are no longer required:
    python3-pyperclip python3-thonny rpi.gpio-common
    Use ‘sudo apt autoremove’ to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  • sudo easy_install pip
    sudo: easy_install: command not found
    [email protected]:~ $ sudo bash -c ~/mypkgs/install_part2.sh
  • sudo su -l kegbot -c ‘. /home/kegbot/kegbot-pycore.venv/bin/activate && pip install /home/pi/mypkgs/kegbot-pyutils-0.1.8.tar.gz’
    -bash: /home/kegbot/kegbot-pycore.venv/bin/activate: No such file or directory

I read though the post you linked to, cant see anything with errors along these lines.

I have however made great progress and wanted to share with the forum…

Note: After running install.sh…

It seems as of Jan 2019, one of the commands in the install.sh is depreciated “easy_install pip” and needs to be replaced with “get-pip.py” however this didnt work for me either, so using

sudo nano ~/mypkgs/install.sh

I modified the install.sh and replaced the line

sudo easy_install pip


curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

As i had already run the install.sh, this allowed me to then edit the REQUIRED_PACKAGES in /usr/local/lib/python2.7/dist-packages/kegberry/app.py, and change the entry for libmysqlclient-dev to default-libmysqlclient-dev AND mysql-server to default-mysql-server

Note newer versions of Raspbian have moved from mysql to MariaDB, hence the need to prefix ‘default’

Re-run install.sh, then get to the the part of your later post Fix issue with MySQL/MariaDB Permissions & Index - did this, rebooted and re-run install.sh.

This took a lot longer and looked a lot more promising, but ended with an error:

subprocess.CalledProcessError: Command ‘sudo su -l kegbot -c “. /home/kegbot/kegbot-server.venv/bin/activate && pip install kegbot==1.2.3”’ returned non-zero exit status 1

Full output is here - https://www.icloud.com/iclouddrive/0xLWLXH_8AMMPjuuSfD8VCpyA#output2

Im unsure what to do next…


Thanks for this feedback, I’ll try to run through the setup again and see if I hit the same errors. I’ve only recently been installing with the latest version of Stretch on only ever on a 3B and 3B+, never a Pi2 so I won’t be able to exactly replicate your Pi2B & Jessie setup but I’ll run the install on the latest Jessie on a Pi3 and see what happens.

A few months ago I started working on a one-line installation script that combines all of the manual fixes and I got it working but never published it. I’ll also try to resurrect that and see if I can make it simple for the future.


Let me know if you want me to test a pre-release install script or anything.



So I’ve done some testing and I think you’re actually running the newest version of the Raspbian Software which is called “Buster”. The previous version was call “Stretch” and the one before that was “Jessie”.

I’ve run through the installation steps from my post again on both Jessie and Stretch and they both worked perfectly following my instructions. But when trying the install on the latest Buster release I’m seeing the exact same issues you’re having (I wasn’t aware a new one was released, but likely to support the new Raspberry Pi 4).

I’ll work on figuring out a solution to get it installed on Buster, hopefully with a single-line installer script, but in the meantime I would suggest if you want to get up and running you should install the image for the last Stretch release (2019-04-08-raspbian-stretch-lite.zip) and follow the instructions for the Stretch install. That should get you up and running quickly!


Thank you @johnnyruz - you’re a legend! Appreciate your help. I’ll get onto this over the weekend and post back.


I rebuilt my kegbot about a month ago and ran into similar issues. the solution for me was to install the july 5 2017 version of jessy instead of the latest version of raspbian. followed all the steps outlined by @johnnyruz and all is working well. also consider adding the enhancements on john’s github…you wont be disappointed!


Thanks for your feedback @mhmatttu, will check it out when i have it all working!

@johnnyruz - I made great progress using the April 2019 released at the link you provided. I got everything online and working, setup the kegs and setup whats on tap at the moment. I then went to add the email setup in, following a reboot i now get ‘502 Bad Gateway’ on the web GUI. Ive removed all the newly added email config, rebooted and still have the error. I ran some commands I found in another post of yours - Kegberry/Kegbot New Installation > output is here - https://www.icloud.com/iclouddrive/08sxBWzE2P9bJVPRWjZ2QJKwA#output

I restarted kegbot services with

sudo supervisorctl restart kegbot:*

This gives:

kegbot:kegboard_daemon: stopped
kegbot:gunicorn: ERROR (spawn error)
kegbot:celery: ERROR (spawn error)
kegbot:kegbot_core: ERROR (spawn error)
kegbot:kegboard_daemon: started

Are you able to please provide any guidance?


I would just double-check your syntax in the configuration file since it looks like with that error message there is some issue with Kegbot reading that file so the startup is crashing. Unfortunately the error message is not very descriptive :frowning: . Look specifically for how you’re defining strings (use single quotes, not double) and that any true/false values have their first letter capitalized (i.e. True). I know things like that have bitten me in the past.

If things get really screwed up, you can always delete everything in the /home/kegbot folder, including the .kegbot hidden folder and re-run the last step of the installation. That should get you back to a clean state.


Thanks again @johnnyruz, even though I had commented all of the lines out that I had re-added, I still wasn’t able to get things running, I changed the debug from False to True and its all back online and working. I’ll investigate further this coming week as I have Arduino Leonardo and flow sensors en-route also :+1: