From a361f320c2183d69b59c69e632493ca0c3a42f97 Mon Sep 17 00:00:00 2001 From: Lawrence Hudson Date: Wed, 17 Aug 2016 13:03:33 +0100 Subject: [PATCH 1/8] CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d037fc..c6a8a30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ This is an overview of major changes. Refer to the git repository for a full log Version 0.1.34 ------------- +- #349 Linux instructions - #347 Explicitly reference python2 in scripts - #342 Conda environment files - #333 Ugly error message when opening or saving a file From 98e12c42197800c78775d39490edb8f10897c915 Mon Sep 17 00:00:00 2001 From: Lawrence Hudson Date: Wed, 17 Aug 2016 13:04:04 +0100 Subject: [PATCH 2/8] Initial commit --- DevelopingOnLinux.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 DevelopingOnLinux.md diff --git a/DevelopingOnLinux.md b/DevelopingOnLinux.md new file mode 100644 index 0000000..230ed88 --- /dev/null +++ b/DevelopingOnLinux.md @@ -0,0 +1,42 @@ +# Inselect on Linux + +These instructions use the system's Python and many system python packages. +For an approach using `miniconda` see `.travis.yml`. + +1. Setup Python virtual environment + +``` +sudo apt-get install python-pip python-dev build-essential +sudo pip2 install --upgrade pip +sudo pip2 install virtualenv virtualenvwrapper +``` + +Append to ``~/.bash_profile` + +``` + +# Setup virtualenvwrapper +export WORKON_HOME=~/Envs/ +source /usr/local/bin/virtualenvwrapper.sh +``` + + +2. Install system dependencies +``` +sudo apt-get install python-pyside pyside-tools python-numpy python-scipy python-sklearn python-opencv libzbar-dev libdmtx-dev +``` + +3. Create virtual environment for Inselect and install dependencies from pip + +``` +mkvirtualenv --system-site-packages inselect +pip2 install -r requirements.pip +``` + +4. Test and run + +``` +python -m bin.freeze_icons +nosetests --verbose --with-coverage --cover-inclusive --cover-tests --cover-package=inselect inselect +./inselect.py +``` From 942a2df9ea3451802658bd6bf078c01a7c5aafe6 Mon Sep 17 00:00:00 2001 From: Lawrence Hudson Date: Wed, 17 Aug 2016 13:46:46 +0100 Subject: [PATCH 3/8] Updates. Tested on Ubuntu 14.04 --- DevelopingOnLinux.md | 48 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/DevelopingOnLinux.md b/DevelopingOnLinux.md index 230ed88..ef1a12f 100644 --- a/DevelopingOnLinux.md +++ b/DevelopingOnLinux.md @@ -3,7 +3,7 @@ These instructions use the system's Python and many system python packages. For an approach using `miniconda` see `.travis.yml`. -1. Setup Python virtual environment +# Setup Python virtual environment ``` sudo apt-get install python-pip python-dev build-essential @@ -13,30 +13,66 @@ sudo pip2 install virtualenv virtualenvwrapper Append to ``~/.bash_profile` + ``` -# Setup virtualenvwrapper +## Setup virtualenvwrapper export WORKON_HOME=~/Envs/ source /usr/local/bin/virtualenvwrapper.sh ``` -2. Install system dependencies +# Install system dependencies ``` -sudo apt-get install python-pyside pyside-tools python-numpy python-scipy python-sklearn python-opencv libzbar-dev libdmtx-dev +sudo apt-get install python-pyside pyside-tools python-numpy python-scipy python-sklearn python-opencv libdmtx-dev libzbar-dev ``` -3. Create virtual environment for Inselect and install dependencies from pip +# Create virtual environment for Inselect and install dependencies from pip ``` mkvirtualenv --system-site-packages inselect pip2 install -r requirements.pip ``` -4. Test and run +## LibDMTX barcode reading library + +* Get source for the wrappers + + ``` + cd ~/projects + git clone git://libdmtx.git.sourceforge.net/gitroot/libdmtx/dmtx-wrappers + ``` + +* Install Python library + + ``` + cd python + python2 setup.py install + ``` + +## Test barcode reading libraries + +Inselect has optional barcode reading capabilities. The dependent libraries +should have been installed. + +``` +python -c "from gouda.engines import ZbarEngine; print(ZbarEngine.available())" +python -c "from gouda.engines import LibDMTXEngine; print(LibDMTXEngine.available())" +``` + +# Developing + +Icons are stored as individual files in `icons`. They are frozen into +a python file `inselect/gui/icons.py` by running ``` python -m bin.freeze_icons +``` + +Test and run + +``` nosetests --verbose --with-coverage --cover-inclusive --cover-tests --cover-package=inselect inselect ./inselect.py ``` + From bdc8b54cbb6cb20d18d9a012e66de63bb10ed194 Mon Sep 17 00:00:00 2001 From: Lawrence Hudson Date: Wed, 17 Aug 2016 13:46:57 +0100 Subject: [PATCH 4/8] Fix for Ubuntu 14.04 --- inselect/lib/sort_document_items.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inselect/lib/sort_document_items.py b/inselect/lib/sort_document_items.py index c657ea6..011f357 100644 --- a/inselect/lib/sort_document_items.py +++ b/inselect/lib/sort_document_items.py @@ -27,7 +27,7 @@ def _do_kde(values): bins = np.append(samples[minima], RESCALE) # Cut data - return (v[0] for v in np.digitize(values, bins, right=True).tolist()) + return np.digitize(values.reshape(len(values)), bins, right=True) def sort_document_items(items, by_columns): @@ -36,6 +36,9 @@ def sort_document_items(items, by_columns): if not items: # Algorithm is not tolerant of empty values return [] + elif 1 == len(items): + # Breaks algorithm when using older numpy (< 10.1) + return items else: rects = [i['rect'] for i in items] x_bins = _do_kde(r.x_centre for r in rects) From a413286563c3c8e27f2770baf78e240084d89e1a Mon Sep 17 00:00:00 2001 From: Lawrence Hudson Date: Wed, 17 Aug 2016 15:57:10 +0100 Subject: [PATCH 5/8] Updates for Ubuntu 16.04 --- DevelopingOnLinux.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/DevelopingOnLinux.md b/DevelopingOnLinux.md index ef1a12f..43f0968 100644 --- a/DevelopingOnLinux.md +++ b/DevelopingOnLinux.md @@ -1,6 +1,7 @@ # Inselect on Linux These instructions use the system's Python and many system python packages. +Tested on Ubuntu 14.04 and 16.04, both with 2GB RAM. For an approach using `miniconda` see `.travis.yml`. # Setup Python virtual environment @@ -66,13 +67,29 @@ Icons are stored as individual files in `icons`. They are frozen into a python file `inselect/gui/icons.py` by running ``` -python -m bin.freeze_icons +python2 -m bin.freeze_icons ``` -Test and run +# Test and run ``` nosetests --verbose --with-coverage --cover-inclusive --cover-tests --cover-package=inselect inselect +``` + +Ubuntu 16.04 appears to come with `nose` already installed so the +`pip2 install -r requirements.pip` step above will not install `nose` within +the virtual env so `nosetests` will not find the packages within the +virtualenv and you will see lots of `ImportErrors`. If this is the case, run + +``` +python -m nose --verbose --with-coverage --cover-inclusive --cover-tests --cover-package=inselect inselect +``` + +Run `nosetests` as shown above. + +Run inselect: + +``` ./inselect.py ``` From bc567d073361882c3f240a538da2fed068811adc Mon Sep 17 00:00:00 2001 From: Lawrence Hudson Date: Wed, 17 Aug 2016 15:58:24 +0100 Subject: [PATCH 6/8] Correct path for libdmtx --- DevelopingOnLinux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DevelopingOnLinux.md b/DevelopingOnLinux.md index 43f0968..518bc1f 100644 --- a/DevelopingOnLinux.md +++ b/DevelopingOnLinux.md @@ -47,8 +47,9 @@ pip2 install -r requirements.pip * Install Python library ``` - cd python + cd dmtx-wrappers/python python2 setup.py install + cd ~/projects/inselect ``` ## Test barcode reading libraries @@ -92,4 +93,3 @@ Run inselect: ``` ./inselect.py ``` - From 092d1d573da14aeb4e0304ec8a33e1c0ada51ae0 Mon Sep 17 00:00:00 2001 From: Lawrence Hudson Date: Wed, 17 Aug 2016 16:07:33 +0100 Subject: [PATCH 7/8] Tweaks to instructions --- DevelopingOnLinux.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/DevelopingOnLinux.md b/DevelopingOnLinux.md index 518bc1f..e0050de 100644 --- a/DevelopingOnLinux.md +++ b/DevelopingOnLinux.md @@ -79,16 +79,14 @@ nosetests --verbose --with-coverage --cover-inclusive --cover-tests --cover-pack Ubuntu 16.04 appears to come with `nose` already installed so the `pip2 install -r requirements.pip` step above will not install `nose` within -the virtual env so `nosetests` will not find the packages within the +the virtual env. `nosetests` will not find the packages within the virtualenv and you will see lots of `ImportErrors`. If this is the case, run ``` python -m nose --verbose --with-coverage --cover-inclusive --cover-tests --cover-package=inselect inselect ``` -Run `nosetests` as shown above. - -Run inselect: +Run inselect ``` ./inselect.py From 967cd46edd6aae650445c9e4c585e1732eee8a56 Mon Sep 17 00:00:00 2001 From: Lawrence Hudson Date: Wed, 17 Aug 2016 19:48:30 +0100 Subject: [PATCH 8/8] Explicit pillow --- DevelopingOnLinux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DevelopingOnLinux.md b/DevelopingOnLinux.md index e0050de..84c49fd 100644 --- a/DevelopingOnLinux.md +++ b/DevelopingOnLinux.md @@ -25,7 +25,7 @@ source /usr/local/bin/virtualenvwrapper.sh # Install system dependencies ``` -sudo apt-get install python-pyside pyside-tools python-numpy python-scipy python-sklearn python-opencv libdmtx-dev libzbar-dev +sudo apt-get install python-pyside pyside-tools python-numpy python-scipy python-sklearn python-opencv python-pil libdmtx-dev libzbar-dev ``` # Create virtual environment for Inselect and install dependencies from pip