Skip to content

Instantly share code, notes, and snippets.

Last active Aug 25, 2021
What would you like to do?
Pebble SDK installation script

Now that Pebble servers are gone, some old components in the SDK need to be patched or replaced so they can fetch what they need from Rebble.

This script downloads and installes everything needed to build projects and also run the emulator.

Was tested on Ubuntu 18.04.2 on WSL.

# Python 2.7 + pip + virtualenv
sudo apt install -y python2.7 python2.7-dev python2.7-pip
sudo -H python2.7 -m pip install -U pip setuptools wheel virtualenv
# Node.js + npm
sudo apt install -y libssl1.0-dev nodejs-dev npm
# Emulator dependencies
sudo apt install -y libsdl1.2debian libfdt1 libpixman-1-0
[ -e ~/pebble-dev ] || mkdir ~/pebble-dev
cd ~/pebble-dev
# Get SDK base
[ -e pebble-sdk-4.5-linux64.tar.bz2 ] || wget
[ -e pebble-sdk-4.5-linux64 ] || tar -xf pebble-sdk-4.5-linux64.tar.bz2
cd pebble-sdk-4.5-linux64
# Add to PATH
if [ -z "$(grep 'pebble-sdk-4.5-linux64' ~/.bashrc)" ]; then
echo 'export PATH=~/pebble-dev/pebble-sdk-4.5-linux64/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
# Fix pypkjs in requirements.txt
if [ "$(grep 'pebble-sdk-homebrew' requirements.txt)" ]; then
cp requirements.txt requirements.txt.OLD
grep -v pypkjs requirements.txt.OLD > requirements.txt
echo 'git+' >> requirements.txt
# Replace pebble-tool
if [ "$(grep '' pebble-tool/pebble_tool/sdk/" ]; then
mv pebble-tool pebble-tool.OLD
git clone
# Install requirements
[ -e .env ] || virtualenv --no-site-packages .env
. .env/bin/activate
pip install -r requirements.txt
pip install -r pebble-tool/requirements.txt
# Install latest SDK
echo y | pebble sdk install latest

This comment has been minimized.

Copy link

@wolframroesler wolframroesler commented Sep 21, 2019

Thanks a lot. I got the following error:

Requirement already satisfied: websocket-client==0.32.0 in ./.env/lib/python2.7/site-packages (from -r pebble-tool/requirements.txt (line 15)) (0.32.0)
Requirement already satisfied: wheel==0.24.0 in ./.env/lib/python2.7/site-packages (from -r pebble-tool/requirements.txt (line 16)) (0.24.0)
Requirement already satisfied: colorama==0.3.3 in ./.env/lib/python2.7/site-packages (from -r pebble-tool/requirements.txt (line 17)) (0.3.3)
Requirement already satisfied: packaging==16.7 in ./.env/lib/python2.7/site-packages (from -r pebble-tool/requirements.txt (line 18)) (16.7)
Requirement already satisfied: pyparsing in ./.env/lib/python2.7/site-packages (from packaging==16.7->-r pebble-tool/requirements.txt (line 18)) (2.4.2)
Installing collected packages: sourcemap
Successfully installed sourcemap-0.2.0
Traceback (most recent call last):
  File "/opt/pebble-dev/pebble-sdk-4.5-linux64/pebble-tool/", line 4, in <module>
    import pebble_tool
  File "/opt/pebble-dev/pebble-sdk-4.5-linux64/pebble-tool/pebble_tool/", line 8, in <module>
    import requests.packages.urllib3 as urllib3
ImportError: No module named requests.packages.urllib3

Remedy (thanks certbot/certbot#5104):

$ pip install requests urllib3 pyOpenSSL progressbar packaging httplib2 oauth2client websocket libpebble2 colorama pypng pyqrcode --force --upgrade

Then run again.

Thanks a lot!


This comment has been minimized.

Copy link

@dentonlt dentonlt commented Jan 1, 2020

I'm on Ubuntu/WSL/Windows 10. I get an error as python2.7-pip doesn't exist. At line 4, change is to python-pip.

I also get a persistent failure during pebble sdk install latest. When installing JS deps, there is a silent error and then the installer rolls back. Removing the --silent args in reveals an npm cache file permissions error. npm responds with a recommended solution:

sudo chown -R 1000:1000 "~/.npm"
Thanks so much for the script - saves much work and digging around!




This comment has been minimized.

Copy link

@raenye raenye commented May 30, 2020

Thanks for the script.
--no-site-packages is no longer needed (or accepted) by virtualenv; it's the default now.


This comment has been minimized.

Copy link

@elektronchika elektronchika commented Sep 24, 2020

I get the following error in WSL with Ubuntu 20.04 LTS: 41: virtualenv: not found 42: .: Can't open .env/bin/activate

What am I missing? Thank you!


This comment has been minimized.

Copy link

@dentonlt dentonlt commented Sep 24, 2020

Looks like virtualenv failed to install. Try manually installing it - check the code in line 5 of the script.

If the installation worked, it might be a PATH problem. Make sure the script can find virtualenv in your PATH.

The line 42 error message is only because of the failure on line 41.

Good luck out there =p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment