Buildozer, python-for-android and matplotlib

175 views
Skip to first unread message

o.ilc...@promaster.ua

unread,
Dec 8, 2015, 11:05:20 AM12/8/15
to Python For Android
Can't get running matplotlib.

There is no recipe for matplotlib, so I found one on stackoverflow:
VERSION_matplotlib=${VERSION_matplotlib:-1.5.0}
DEPS_matplotlib=(numpy python dateutil pyparsing six linpng pytz freetype agg PyCXX qhull ttconv)
URL_matplotlib=http://pypi.python.org/packages/source/m/matplotlib/matplotlib-$VERSION_matplotlib.tar.gz
MD5_matplotlib=7952a539418ed77432aa4727409f24cf
BUILD_matplotlib=$BUILD_PATH/matplotlib/$(get_directory $URL_matplotlib)
RECIPE_matplotlib=$RECIPES_PATH/matplotlib

# function called for preparing source code if needed
# (you can apply patch etc here.)
function prebuild_matplotlib() {
    true
}

function shouldbuild_lxml() {
    if [ -d "$SITEPACKAGES_PATH/matplotlib" ]; then
        DO_BUILD=0
    fi
}

# function called to build the source code
function build_matplotlib() {
    cd $BUILD_matplotlib

    push_arm

    export CC="$CC -I$BUILD_numpy/"
    export LDFLAGS="-L$BUILD_numpy/numpy/.libs -L$BUILD_numpy/numpy/.libs -L$BUILD_numpy/.libs -L$BUILD_numpy/numpy -L$BUILD_numpy/numpy -L$BUILD_numpy/  $LDFLAGS"
    export LDSHARED="$LIBLINK"

    chmod +x $BUILD_numpy/numpy-config
    export PATH=$PATH:$BUILD_numpy
    #plus more for the other dependencies
    try $HOSTPYTHON setup.py build_ext -I$BUILD_matplotlib
    try find . -iname '*.pyx' -exec $CYTHON {} \;
    try $HOSTPYTHON setup.py build_ext -v
    try find build/lib.* -name "*.o" -exec $STRIP {} \;

    export PYTHONPATH=$BUILD_hostpython/Lib/site-packages
    try $BUILD_hostpython/hostpython setup.py install -O2 --root=$BUILD_PATH/python-install --install-lib=lib/python2.7/site-packages

    unset LDSHARED
    pop_arm
}

# function called after all the compile have been done
function postbuild_matplotlib() {
    true
}

But this gives an error:

Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
Traceback (most recent call last):
  File "setup.py", line 10, in <module>
    use_setuptools()
  File "/home/olga/PycharmProjects/pfdandroid/.buildozer/android/platform/python-for-android/build/matplotlib/matplotlib-1.5.0/distribute_setup.py", line 163, in use_setuptools
    return _do_download(version, download_base, to_dir, download_delay)
  File "/home/olga/PycharmProjects/pfdandroid/.buildozer/android/platform/python-for-android/build/matplotlib/matplotlib-1.5.0/distribute_setup.py", line 132, in _do_download
    to_dir, download_delay)
  File "/home/olga/PycharmProjects/pfdandroid/.buildozer/android/platform/python-for-android/build/matplotlib/matplotlib-1.5.0/distribute_setup.py", line 212, in download_setuptools
    src = urlopen(url)
  File "/home/olga/PycharmProjects/pfdandroid/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/home/olga/PycharmProjects/pfdandroid/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib2.py", line 400, in open
    response = meth(req, response)
  File "/home/olga/PycharmProjects/pfdandroid/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
  File "/home/olga/PycharmProjects/pfdandroid/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib2.py", line 432, in error
    result = self._call_chain(*args)
  File "/home/olga/PycharmProjects/pfdandroid/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "/home/olga/PycharmProjects/pfdandroid/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib2.py", line 619, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/home/olga/PycharmProjects/pfdandroid/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib2.py", line 394, in open
    response = self._open(req, data)
  File "/home/olga/PycharmProjects/pfdandroid/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib2.py", line 417, in _open
    'unknown_open', req)
  File "/home/olga/PycharmProjects/pfdandroid/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "/home/olga/PycharmProjects/pfdandroid/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib2.py", line 1232, in unknown_open
    raise URLError('unknown url type: %s' % type)
urllib2.URLError: <urlopen error unknown url type: https>
# Command failed: ./distribute.sh -m "openssl numpy matplotlib kivy" -d "pfd"
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2


How can I fix it?

Alexander Taylor

unread,
Dec 9, 2015, 12:37:40 PM12/9/15
to Python For Android
The error is the unknown url type thing. Googling suggests e.g. http://stackoverflow.com/questions/27115803/urllib-error-urlerror-urlopen-error-unknown-url-type-https as a soluction. I'm not sure where the code trying to do this is though.

Paul Royik

unread,
Dec 9, 2015, 2:37:05 PM12/9/15
to Python For Android
The problem is distribute is downloaded from https site (however, first, http is redirected to https).
Reply all
Reply to author
Forward
0 new messages