From 40d6a517790f7a24f7c41cd66ab0375fdf175eee Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sun, 23 Nov 2014 06:26:48 -0600 Subject: [PATCH] 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