Skip to content

Instantly share code, notes, and snippets.

@cvium
Last active August 1, 2018 12:51
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cvium/a9cdb6d50d314a5e3933 to your computer and use it in GitHub Desktop.
Save cvium/a9cdb6d50d314a5e3933 to your computer and use it in GitHub Desktop.
Flexget on OpenELEC on Raspberry Pi

Instructions

Credit to danielfm

Compile from Source

First you need to download the source code and change the package build for the Python package. Replace X with the version you wish to install:

$ git clone -b openelec-X.0 https://github.com/openelec/openelec.tv
$ cd openelec.tv
$ vim packages/lang/Python/package.mk

Change vim with whatever text editor you prefer. Then find the following line:

 EXCLUDE_DIRS="bsddb curses idlelib lib-tk lib2to3 msilib pydoc_data test unittest distutils"

Remove distutils and unittest from this line and save your changes. If neither are present, then you don't have to recompile and may skip to the next section on how to install pip etc.

You can now compile it. THIS WILL TAKE A LONG TIME. Depending on your setup/hardware/etc, this will take at least a couple of hours. It took me 4 hours in a virtual machine with 2 GB ram, 1 core. Also make sure you have enough space. It took up ~15-20gb for me.

Run the following command to compile it for a raspberry pi (append image at the end if you wish to create an image file):

$ PROJECT=RPi ARCH=arm make

If you wish to compile it for a different architecture then take a look at this guide.

Wait a gazillion hours while it compiles.

After it completes, either clone the image file onto an sd card or follow the rpi installation guide to install it. For other devices, use this guide instead.

Post Compilation and Installation

Boot it up and ssh into it. NOTE: ~ usually just points to /storage

Create the file ~/.pydistutils.cfg with the following content:

[install]
install_lib = ~/lib
install_scripts = ~/bin

This file will let Python know where to install the packages.

Set PYTHONPATH and PATH variables in ~/.profile for ease of use:

export PYTHONPATH=~/lib
export PATH=$PATH:~/bin
$ cd ~
$ mkdir lib bin
$ curl -o get-pip.py https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$ source .profile
$ python get-pip.py

If you did not include unittest, then you need easy_install and another unit test library. pyunit will do the trick. If you already have the unittest module, then skip the next part and simply install flexget.

$ curl -o ez_setup.py https://bootstrap.pypa.io/ez_setup.py
$ python ez_setup.py
$ easy_install pyunit

Flexget can now be installed and whatever other libraries you need.

$ pip install flexget

END OF TEXT

@Jsteiginga
Copy link

This was just what I was looking for!

couldn't get the get-pip.py but the url has been changed and now it works! thanks!

$ curl -o get-pip.py https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py

@antonydenyer
Copy link

Or you can use -L to follow redirects
$ curl -L -o get-pip.py https://raw.github.com/pypa/pip/master/contrib/get-pip.py

@Superpiffer
Copy link

In the latest Beta distutils has been readded: OpenELEC/OpenELEC.tv@c9f693a

I tried to install flexget with this version but python ez_setup.py ended with
ImportError: No module named unittest

I'm afraid that I have to compile OpenELEC from scratch...

@billsuxx
Copy link

get-pip install was successfull, but this one didn't work for me:

python ez_setup.py

got this error:

File "/tmp/tmpCjXSGF/setuptools-23.0.0/setuptools/py31compat.py", line 2, in
import unittest
ImportError: No module named unittest
Something went wrong during the installation.
See the error message above.

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