Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support python 3 #95

Closed
quicklizard99 opened this issue Oct 14, 2014 · 11 comments
Closed

Support python 3 #95

quicklizard99 opened this issue Oct 14, 2014 · 11 comments
Assignees

Comments

@quicklizard99
Copy link
Member

We are tied to Python 2.7.x because one of our dependencies - OpenCV - provides only Python 2.x bindings. Although Python 2.7 will be supported until 2020, there will be only bugfix releases - no new development.

Python 3 is the future. OpenCV 3 (currently in alpha) will provide Python 3 bindings.

@quicklizard99
Copy link
Member Author

More information. Suggest we aim to support both python 2.7.x and 3.x, at least in the short term, once OpenCV 3 has been released. This work requires that we have thorough tests with excellent code coverage (#84).

@quicklizard99
Copy link
Member Author

Python 3 has a different API for C extension modules. Support for Python 3 requires that we (or someone else) rewrites the pydmtx module, which provides an interface to the libdmtx Data Matrix barcode reading library. Also the zbar module, if we decide to support the zbar barcode reading library.

@stefanv
Copy link
Contributor

stefanv commented Apr 28, 2015 via email

@quicklizard99
Copy link
Member Author

Thanks @stefanv - that would be great. Probably best to wait until I have tried Inselect with Python 3 - I think it likely that there will be other sticking points - cx_freeze, PyInstaller, PySide - to sort out before we get to barcodes. Ideally, barcode reading would be part of OpenCV because neither libdmtx nor zbar haven't been developed for years.

@stefanv
Copy link
Contributor

stefanv commented Apr 30, 2015 via email

@quicklizard99
Copy link
Member Author

A first pass at python 3 support on iss95.

@quicklizard99
Copy link
Member Author

How I built OpenCV 3.0.0 RC1 on Ubuntu 14.04 (with help from 1 and 2). Download opencv-3.0.0-rc1.zip to ~/build/. The following will make and install to ~/local/opencv-3.0.0-rc1. The cv2 extension python will be installed to the virtual env's site-packages: ~/Envs/dig343/lib/python3.4/site-packages for me.

cd ~/build
unzip opencv-3.0.0-rc1.zip
cd opencv-3.0.0-rc1
mkdir build
cd build
workon dig343    # the name of my virtual env
rm -rf * && cmake -D CMAKE_BUILD_TYPE=RELEASE \
        -D PYTHON3_EXECUTABLE=$(which python3) \
        -D PYTHON3_PACKAGES_PATH=`python3 -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())'` \
        -D PYTHON3_INCLUDE_DIR=`python3 -c 'from distutils.sysconfig import get_python_inc; print(get_python_inc())'` \
        -D PYTHON3_LIBRARY=`python3 -c 'from distutils import sysconfig; print("{LIBDIR}/{LDLIBRARY}".format(**sysconfig.get_config_vars()))'` \
        -D CMAKE_INSTALL_PREFIX=~/local/opencv-3.0.0-rc1 \
        -D BUILD_EXAMPLES=ON \
        -D INSTALL_PYTHON_EXAMPLES=ON \
        -D WITH_QT=ON \
        ~/build/opencv-3.0.0-rc1/

    make -j4 # 4 cores - use the appropriate number here
    make install

Test

python -c "import cv2; print(cv2.__version__)"

@stefanv
Copy link
Contributor

stefanv commented Apr 30, 2015

Another few potential options for wrapping:

https://github.com/dlbeer/quirc
https://github.com/glassechidna/zxing-cpp

What kind of barcodes do we need to support?

@quicklizard99
Copy link
Member Author

#372 and #374 add Python 3 compatible wrappers for libdmtx and zbar respectively.

@quicklizard99
Copy link
Member Author

quicklizard99 commented Nov 29, 2016

Things blocking Python 3

PyInstaller and cx_Freeze (used to freeze Inselect for Mac OS X and Windows respectively) both claim to support Python 3.

@quicklizard99
Copy link
Member Author

Pull #403: all tests pass on Mac OS X, Windows and on Ubuntu 12.04, 14.04 and 16.04.

Neither the Mac OS X nor the Windows installers build properly - the next job.

quicklizard99 added a commit that referenced this issue Dec 6, 2016
quicklizard99 added a commit that referenced this issue Dec 7, 2016
quicklizard99 added a commit that referenced this issue Dec 7, 2016
quicklizard99 added a commit that referenced this issue Dec 8, 2016
quicklizard99 added a commit that referenced this issue Dec 8, 2016
quicklizard99 added a commit that referenced this issue Dec 8, 2016
quicklizard99 added a commit that referenced this issue Dec 8, 2016
quicklizard99 added a commit that referenced this issue Dec 8, 2016
quicklizard99 added a commit that referenced this issue Dec 8, 2016
quicklizard99 added a commit that referenced this issue Dec 8, 2016
quicklizard99 added a commit that referenced this issue Dec 8, 2016
quicklizard99 added a commit that referenced this issue Dec 8, 2016
quicklizard99 added a commit that referenced this issue Dec 9, 2016
quicklizard99 added a commit that referenced this issue Dec 9, 2016
quicklizard99 added a commit that referenced this issue Dec 9, 2016
quicklizard99 added a commit that referenced this issue Dec 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants