Python setup.py install requirements.txt

For programs meant solely for ARM platforms that don’t have conda or Python wheels, e.g. Raspberry Pi and Beaglebone, you can use setup.py to install prerequisites using apt install:

req = ['numpy','scipy']  # long pip install time since no .whl for ARM
from setuptools import setup, find_packages
import subprocess
import sys,os

req = [os.path.basename(sys.executable) + '-' + r for r in req]

try:
    cmd = ['sudo','apt-get','install'] + req
    print(' '.join(cmd))
    subprocess.check_call(cmd)
    ok=True
except Exception as e:
    ok = False
    print(e)

setup(name='cool_program',
      packages=find_packages(),
      )

if not ok:
    print('\n *** please execute')
    print(' '.join(cmd))

Leave a Comment