From 40d6a517790f7a24f7c41cd66ab0375fdf175eee Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sun, 23 Nov 2014 06:26:48 -0600 Subject: [PATCH 1/5] Use virtualenv for all builds and install everything from wheelhouse Use venv for all builds and install everything from wheelhouse Use venv and all minimum requirements Edit requirements.txt in place and use one call Update minimum versions and install exclusively from wheelhouse Use mpl 1.3.1 on py 3.2 Fix pip invocation Fix pip invocation again Another fix to pip invocation Explicitly use venv python to call build_versions.py Move venv creation and activation to top level Do not use site-packages Fix minimum matplotlib ver and Pillow version check Fix minimum matplotlib ver Improve error message on version check Add more debug info Even more debug info More debug info Yet another debug print Fix python 2.7 installation problem check for PIL.Image version on install Add debug to before_install Try a pip install virtualenv first Clean up virtualenv creation, add debug info, fix PySide script install Fix virtualenv path for PySide install Fix venv location and activation Try no site packages and fix python 2.7 install --- .travis.yml | 9 ++++++++- requirements.txt | 6 +++--- setup.py | 21 ++++++++++++++------- tools/travis_install_optional.sh | 2 +- tools/travis_setup.sh | 16 +++++++++++----- 5 files changed, 37 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 958907e9..350b973b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ language: python python: - 2.6 -- "2.7_with_system_site_packages" +- 2.7 - 3.2 - 3.3 - 3.4 @@ -18,6 +18,13 @@ before_install: - export DISPLAY=:99.0 - export PYTHONWARNINGS="all" - export WHEELHOUSE="--no-index --find-links=http://travis-wheels.scikit-image.org/" + - sudo apt-get update + + - virtualenv -p python ~/venv + - source ~/venv/bin/activate + - which python + - python --version + - travis_retry tools/travis_setup.sh - python check_bento_build.py diff --git a/requirements.txt b/requirements.txt index 98f3b77f..9e5c9ba4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ cython>=0.19.2 -matplotlib>=1.1.0 -numpy>=1.6.1 +matplotlib>=1.1.1 +numpy>=1.6.0 scipy>=0.9 six>=1.3 networkx>=1.8 -pillow>=1.1.7 +pillow>=1.7.8 diff --git a/setup.py b/setup.py index 1d7b3d1c..f9ec3a07 100755 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ DEPENDENCIES = {} with open('requirements.txt', 'rb') as fid: data = fid.read().decode('utf-8', 'replace') for line in data.splitlines(): - pkg, _, version_info = line.partition('>=') + pkg, _, version_info = line.replace('==', '>=').partition('>=') # Only require Cython if we have a developer checkout if pkg.lower() == 'cython' and not VERSION.endswith('dev'): continue @@ -88,22 +88,29 @@ def check_requirements(): for (package_name, min_version) in DEPENDENCIES.items(): if package_name == 'cython': package_name = 'Cython' - dep_error = False + dep_error = '' if package_name.lower() == 'pillow': package_name = 'PIL.Image' + min_version = '1.1.7' try: package = __import__(package_name, fromlist=[package_name.rpartition('.')[0]]) except ImportError: - dep_error = True + dep_error = ('You need `%s` version %s or later.' + % (package_name, min_version)) else: - package_version = get_package_version(package) + if package_name == 'PIL': + package_version = package.PILLOW_VERSION + else: + package_version = get_package_version(package) if LooseVersion(min_version) > LooseVersion(package_version): - dep_error = True + dep_error = ('You need `%s` version %s or later,' + 'found version %s.' + % (package_name, min_version, + package_version)) if dep_error: - raise ImportError('You need `%s` version %s or later.' \ - % (package_name, min_version)) + raise ImportError(dep_error) if __name__ == "__main__": diff --git a/tools/travis_install_optional.sh b/tools/travis_install_optional.sh index ec01d899..b1de66de 100755 --- a/tools/travis_install_optional.sh +++ b/tools/travis_install_optional.sh @@ -10,7 +10,7 @@ if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then else sudo apt-get install -q libqt4-dev pip install -q PySide $WHEELHOUSE - python ~/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/pyside_postinstall.py -install + python ~/venv/bin/pyside_postinstall.py -install fi # imread does NOT support py3.2 diff --git a/tools/travis_setup.sh b/tools/travis_setup.sh index e8227642..d9f46cd9 100755 --- a/tools/travis_setup.sh +++ b/tools/travis_setup.sh @@ -2,20 +2,26 @@ set -ex sh -e /etc/init.d/xvfb start -sudo apt-get update pip install wheel flake8 coveralls nose -pip uninstall -y numpy + +# install system tk +sudo apt-get install python-tk # on Python 2.7, use the system versions of numpy, scipy, and matplotlib # and the minimum version of cython and networkx if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then sudo apt-get install python-scipy python-matplotlib - pip install https://github.com/cython/cython/archive/0.19.2.tar.gz - pip install https://github.com/networkx/networkx/archive/networkx-1.8.tar.gz + sed -i 's/cython>=/cython==/g' requirements.txt + sed -i 's/networkx>=/networkx==/g' requirements.txt fi -pip install -r requirements.txt $WHEELHOUSE +# on Python 3.2, use matplotlib 1.3.1 +if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then + sed -i 's/matplotlib>=*.*.*/matplotlib==1.3.1/g' requirements.txt +fi + +pip install $WHEELHOUSE -r requirements.txt # clean up disk space sudo apt-get clean From 043721aa24d3424bb92d6f80b49ab589b553e347 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sun, 30 Nov 2014 21:25:42 -0600 Subject: [PATCH 2/5] Use system packages on Py2.7 Use system packages on python 2.7 Try and fix PyQt4 and use wheelhouse astropy Fix version requirements --- .travis.yml | 6 ++---- requirements.txt | 4 ++-- tools/travis_install_optional.sh | 17 ++++++++++++++++- tools/travis_setup.sh | 15 ++++++++++----- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 350b973b..e3766925 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,13 +20,11 @@ before_install: - export WHEELHOUSE="--no-index --find-links=http://travis-wheels.scikit-image.org/" - sudo apt-get update - - virtualenv -p python ~/venv + - travis_retry tools/travis_setup.sh + - source ~/venv/bin/activate - which python - python --version - - - travis_retry tools/travis_setup.sh - - python check_bento_build.py - tools/header.py "Dependency versions" diff --git a/requirements.txt b/requirements.txt index 9e5c9ba4..189b627b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ cython>=0.19.2 -matplotlib>=1.1.1 -numpy>=1.6.0 +matplotlib>=1.1.0 +numpy>=1.6.1 scipy>=0.9 six>=1.3 networkx>=1.8 diff --git a/tools/travis_install_optional.sh b/tools/travis_install_optional.sh index b1de66de..582503bd 100755 --- a/tools/travis_install_optional.sh +++ b/tools/travis_install_optional.sh @@ -7,6 +7,21 @@ tools/header.py "Install optional dependencies" if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then sudo apt-get install -q python-qt4 + # http://stackoverflow.com/a/9716100 + LIBS=( PyQt4 sip.so ) + + PYTHON_VERSION=python$(python -c "import sys; print (str(sys.version_info[0])+'.'+str(sys.version_info[1]))") + VAR=( $(which -a $PYTHON_VERSION) ) + + GET_PYTHON_LIB_CMD="from distutils.sysconfig import get_python_lib; print (get_python_lib())" + LIB_VIRTUALENV_PATH=$(python -c "$GET_PYTHON_LIB_CMD") + LIB_SYSTEM_PATH=$(${VAR[-1]} -c "$GET_PYTHON_LIB_CMD") + + for LIB in ${LIBS[@]} + do + ln -s $LIB_SYSTEM_PATH/$LIB $LIB_VIRTUALENV_PATH/$LIB + done + else sudo apt-get install -q libqt4-dev pip install -q PySide $WHEELHOUSE @@ -25,7 +40,7 @@ if [[ $TRAVIS_PYTHON_VERSION != 3.4 ]]; then fi sudo apt-get install -q libfreeimage3 -pip install -q astropy +pip install -q astropy $WHEELHOUSE if [[ $TRAVIS_PYTHON_VERSION == 2.* ]]; then pip install -q pyamg diff --git a/tools/travis_setup.sh b/tools/travis_setup.sh index d9f46cd9..5b91a976 100755 --- a/tools/travis_setup.sh +++ b/tools/travis_setup.sh @@ -3,19 +3,24 @@ set -ex sh -e /etc/init.d/xvfb start -pip install wheel flake8 coveralls nose - -# install system tk -sudo apt-get install python-tk - # on Python 2.7, use the system versions of numpy, scipy, and matplotlib # and the minimum version of cython and networkx if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then + virtualenv -p python --system-site-packages ~/venv sudo apt-get install python-scipy python-matplotlib sed -i 's/cython>=/cython==/g' requirements.txt sed -i 's/networkx>=/networkx==/g' requirements.txt +else + virtualenv -p python --system-site-packages ~/venv fi +source ~/venv/bin/activate +pip install wheel flake8 coveralls nose + +# install system tk for matplotlib +sudo apt-get install python-tk + + # on Python 3.2, use matplotlib 1.3.1 if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then sed -i 's/matplotlib>=*.*.*/matplotlib==1.3.1/g' requirements.txt From f19dcbbdc380abbf6f39f19bc1df26c44c2e670a Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 3 Dec 2014 20:56:28 -0600 Subject: [PATCH 3/5] Clean up use of python version check for pyqt install --- tools/travis_install_optional.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/travis_install_optional.sh b/tools/travis_install_optional.sh index 582503bd..fa4df268 100755 --- a/tools/travis_install_optional.sh +++ b/tools/travis_install_optional.sh @@ -10,8 +10,7 @@ if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then # http://stackoverflow.com/a/9716100 LIBS=( PyQt4 sip.so ) - PYTHON_VERSION=python$(python -c "import sys; print (str(sys.version_info[0])+'.'+str(sys.version_info[1]))") - VAR=( $(which -a $PYTHON_VERSION) ) + VAR=( $(which -a $TRAVIS_PYTHON_VERSION) ) GET_PYTHON_LIB_CMD="from distutils.sysconfig import get_python_lib; print (get_python_lib())" LIB_VIRTUALENV_PATH=$(python -c "$GET_PYTHON_LIB_CMD") From 62a37bda32a4ce08f366025c69f37a13beb90f10 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 3 Dec 2014 21:23:17 -0600 Subject: [PATCH 4/5] Fix python version check --- tools/travis_install_optional.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/travis_install_optional.sh b/tools/travis_install_optional.sh index fa4df268..5160d9fb 100755 --- a/tools/travis_install_optional.sh +++ b/tools/travis_install_optional.sh @@ -10,7 +10,7 @@ if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then # http://stackoverflow.com/a/9716100 LIBS=( PyQt4 sip.so ) - VAR=( $(which -a $TRAVIS_PYTHON_VERSION) ) + VAR=( $(which -a python$TRAVIS_PYTHON_VERSION) ) GET_PYTHON_LIB_CMD="from distutils.sysconfig import get_python_lib; print (get_python_lib())" LIB_VIRTUALENV_PATH=$(python -c "$GET_PYTHON_LIB_CMD") From 23e81753dd1f4eeb3b70b85b76bb3f5092c1b777 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 4 Dec 2014 20:09:46 -0600 Subject: [PATCH 5/5] Invoke sudo to create link to system PyQt --- tools/travis_install_optional.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/travis_install_optional.sh b/tools/travis_install_optional.sh index 5160d9fb..fd112074 100755 --- a/tools/travis_install_optional.sh +++ b/tools/travis_install_optional.sh @@ -18,7 +18,7 @@ if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then for LIB in ${LIBS[@]} do - ln -s $LIB_SYSTEM_PATH/$LIB $LIB_VIRTUALENV_PATH/$LIB + sudo ln -s $LIB_SYSTEM_PATH/$LIB $LIB_VIRTUALENV_PATH/$LIB done else