Giter Site home page Giter Site logo

oiio-python's Introduction

oiio-python

OpenImageIO Python 3.x package.

Build pipeline CI Status
Windows Server 2016 Build Status
Ubuntu 16.041 Build Status
macOS 10.13 Build Status

1 Should also work on CentOS 7 for example.

About the project

OpenImageIO is built using vcpkg and packaged into Python wheels on Windows, Linux and macOS platforms (thanks to Azure Pipelines).

To make this work, some customization of the vcpkg port files were necessary and thus these modifications are stored in this repository.

Download wheels

Download the wheels under "Releases". CI jobs produce wheels and they can be downloaded from the respective CI job.

Usage

  • Install the wheel: pip install ...
  • From within Python, import OpenImageIO: from oiio import OpenImageIO as oiio

See the tests folder for code examples used to test the built wheels' functionality.

Notes

  • Official OpenImageIO repository at OpenImageIO/oiio, note the .travis.yml and appveyor.yml
  • The python3 files for oiio at vcpkg/ports/python3
  • The vcpkg files for oiio at vcpkg/ports/openimageio
  • Get SHA512 of file:
    • macOS: openssl dgst -sha512 [FILE]
  • A new release is automatically performed when a commit is performed on the master branch.
  • Updating to a newer OpenImageIO version:
    1. Update the oiio.version variable in the .yml files
    2. Update the version and SHA512 in the OpenImageIO port files.

oiio-python's People

Contributors

fredrikaverpil avatar sidneyguenther avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

oiio-python's Issues

GitHub release

Investigate how we could trigger a GitHub release after successful builds. Perhaps on pushing a tag?

giflib causes wheel import error on macOS

2019-02-01T21:15:04.5740960Z ImportError while importing test module '/Users/vsts/agent/2.144.2/work/1/s/tests/test_imagedimensions.py'.
2019-02-01T21:15:04.5741100Z Hint: make sure your test modules/packages have valid Python names.
2019-02-01T21:15:04.5741270Z Traceback:
2019-02-01T21:15:04.5741320Z test_imagedimensions.py:5: in <module>
2019-02-01T21:15:04.5741380Z     from oiio import OpenImageIO as oiio
2019-02-01T21:15:04.5742050Z E   ImportError: dlopen(/Users/vsts/hostedtoolcache/Python/3.6.5/x64/lib/python3.6/site-packages/oiio/OpenImageIO.so, 2): Symbol not found: _GifLastError
2019-02-01T21:15:04.5742610Z E     Referenced from: /Users/vsts/hostedtoolcache/Python/3.6.5/x64/lib/python3.6/site-packages/oiio/OpenImageIO.so
2019-02-01T21:15:04.5742780Z E     Expected in: flat namespace
2019-02-01T21:15:04.5743330Z E    in /Users/vsts/hostedtoolcache/Python/3.6.5/x64/lib/python3.6/site-packages/oiio/OpenImageIO.so

Link: https://fredrikaverpil.visualstudio.com/oiio-python/_build/results?buildId=827&view=logs&jobId=71d407c9-c576-569c-7d43-abe3f2f427cf&taskId=61447aba-a88d-5c82-03aa-a6e79ea00334&lineStart=58&lineEnd=66&colStart=1&colEnd=130

Building openjpeg fails on macOS

Error when building openjpeg

2019-02-01T15:33:53.3493500Z Building package openjpeg[core]:x64-osx... 
2019-02-01T15:33:53.5056390Z -- Downloading https://github.com/uclouvain/openjpeg/archive/v2.3.0.tar.gz...
2019-02-01T15:33:54.7427020Z -- Extracting source /Users/vsts/agent/2.144.2/work/1/s/vcpkg/downloads/uclouvain-openjpeg-v2.3.0.tar.gz
2019-02-01T15:33:54.9173170Z -- Using source at /Users/vsts/agent/2.144.2/work/1/s/vcpkg/buildtrees/openjpeg/src/v2.3.0-711dc321d0
2019-02-01T15:33:54.9190960Z -- Configuring x64-osx-dbg
2019-02-01T15:34:00.5526130Z CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:56 (message):
2019-02-01T15:34:00.5562140Z     Command failed: /Users/vsts/agent/2.144.2/work/1/s/vcpkg/downloads/tools/cmake-3.12.4-osx/cmake-3.12.4-Darwin-x86_64/CMake.app/Contents/bin/cmake;/Users/vsts/agent/2.144.2/work/1/s/vcpkg/buildtrees/openjpeg/src/v2.3.0-711dc321d0;-DBUILD_CODEC:BOOL=OFF;-DOPENJPEG_INSTALL_PACKAGE_DIR=share/openjpeg;-DOPENJPEG_INSTALL_INCLUDE_DIR=include;-DCMAKE_MAKE_PROGRAM=/Users/vsts/agent/2.144.2/work/1/s/vcpkg/downloads/tools/ninja-1.8.2-osx/ninja;-DCMAKE_SYSTEM_NAME=Darwin;-DBUILD_SHARED_LIBS=OFF;-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/Users/vsts/agent/2.144.2/work/1/s/vcpkg/scripts/toolchains/osx.cmake;-DVCPKG_TARGET_TRIPLET=x64-osx;-DVCPKG_PLATFORM_TOOLSET=external;-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON;-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON;-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON;-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE;-DCMAKE_VERBOSE_MAKEFILE=ON;-DVCPKG_APPLOCAL_DEPS=OFF;-DCMAKE_TOOLCHAIN_FILE=/Users/vsts/agent/2.144.2/work/1/s/vcpkg/scripts/buildsystems/vcpkg.cmake;-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON;-DVCPKG_CXX_FLAGS=;-DVCPKG_CXX_FLAGS_RELEASE=;-DVCPKG_CXX_FLAGS_DEBUG=;-DVCPKG_C_FLAGS=;-DVCPKG_C_FLAGS_RELEASE=;-DVCPKG_C_FLAGS_DEBUG=;-DVCPKG_CRT_LINKAGE=dynamic;-DVCPKG_LINKER_FLAGS=;-DCMAKE_INSTALL_LIBDIR:STRING=lib;-DCMAKE_INSTALL_BINDIR:STRING=bin;-G;Ninja;-DCMAKE_BUILD_TYPE=Debug;-DCMAKE_INSTALL_PREFIX=/Users/vsts/agent/2.144.2/work/1/s/vcpkg/packages/openjpeg_x64-osx/debug
2019-02-01T15:34:00.5563420Z     Working Directory: /Users/vsts/agent/2.144.2/work/1/s/vcpkg/buildtrees/openjpeg/x64-osx-dbg
2019-02-01T15:34:00.5563600Z     See logs for more information:
2019-02-01T15:34:00.5565830Z       /Users/vsts/agent/2.144.2/work/1/s/vcpkg/buildtrees/openjpeg/config-x64-osx-dbg-out.log
2019-02-01T15:34:00.5567720Z       /Users/vsts/agent/2.144.2/work/1/s/vcpkg/buildtrees/openjpeg/config-x64-osx-dbg-err.log
2019-02-01T15:34:00.5567810Z 
2019-02-01T15:34:00.5568200Z Call Stack (most recent call first):
2019-02-01T15:34:00.5570610Z   scripts/cmake/vcpkg_configure_cmake.cmake:265 (vcpkg_execute_required_process)
2019-02-01T15:34:00.5571910Z   ports/openjpeg/portfile.cmake:10 (vcpkg_configure_cmake)
2019-02-01T15:34:00.5572470Z   scripts/ports.cmake:71 (include)
2019-02-01T15:34:00.5572660Z 
2019-02-01T15:34:00.5573000Z 
2019-02-01T15:34:00.5648170Z Error: Building package openjpeg:x64-osx failed with: BUILD_FAILED
2019-02-01T15:34:00.5649340Z Please ensure you're using the latest portfiles with `.\vcpkg update`, then
2019-02-01T15:34:00.5649500Z submit an issue at https://github.com/Microsoft/vcpkg/issues including:
2019-02-01T15:34:00.5650370Z   Package: openjpeg:x64-osx
2019-02-01T15:34:00.5651350Z   Vcpkg version: 2018.11.23-unknownhash

Link: https://fredrikaverpil.visualstudio.com/oiio-python/_build/results?buildId=783&view=logs&jobId=71d407c9-c576-569c-7d43-abe3f2f427cf&taskId=e77e90ae-c444-5a31-2c94-89dc8588ffbc&lineStart=157&lineEnd=174&colStart=1&colEnd=69

Error when attempting to import the built wheel

2019-02-01T15:59:15.7437810Z ============================= test session starts ==============================
2019-02-01T15:59:15.7438860Z platform darwin -- Python 3.6.5, pytest-4.2.0, py-1.7.0, pluggy-0.8.1 -- /Users/vsts/hostedtoolcache/Python/3.6.5/x64/python
2019-02-01T15:59:15.7440020Z cachedir: .pytest_cache
2019-02-01T15:59:15.7440370Z rootdir: /Users/vsts/agent/2.144.2/work/1/s/tests, inifile:
2019-02-01T15:59:15.8807100Z collecting ... collected 0 items / 1 errors
2019-02-01T15:59:15.9349240Z 
2019-02-01T15:59:15.9349930Z ==================================== ERRORS ====================================
2019-02-01T15:59:15.9355830Z ___________________ ERROR collecting test_imagedimensions.py ___________________
2019-02-01T15:59:15.9357000Z ImportError while importing test module '/Users/vsts/agent/2.144.2/work/1/s/tests/test_imagedimensions.py'.
2019-02-01T15:59:15.9357250Z Hint: make sure your test modules/packages have valid Python names.
2019-02-01T15:59:15.9357300Z Traceback:
2019-02-01T15:59:15.9357420Z test_imagedimensions.py:5: in <module>
2019-02-01T15:59:15.9357500Z     from oiio import OpenImageIO as oiio
2019-02-01T15:59:15.9358110Z E   ImportError: dlopen(/Users/vsts/hostedtoolcache/Python/3.6.5/x64/lib/python3.6/site-packages/oiio/OpenImageIO.so, 2): Symbol not found: _GifLastError
2019-02-01T15:59:15.9358730Z E     Referenced from: /Users/vsts/hostedtoolcache/Python/3.6.5/x64/lib/python3.6/site-packages/oiio/OpenImageIO.so
2019-02-01T15:59:15.9358810Z E     Expected in: flat namespace
2019-02-01T15:59:15.9359340Z E    in /Users/vsts/hostedtoolcache/Python/3.6.5/x64/lib/python3.6/site-packages/oiio/OpenImageIO.so
2019-02-01T15:59:15.9359530Z !!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
2019-02-01T15:59:15.9359610Z =========================== 1 error in 0.19 seconds ============================

Link: https://fredrikaverpil.visualstudio.com/oiio-python/_build/results?buildId=783&view=logs&jobId=71d407c9-c576-569c-7d43-abe3f2f427cf&taskId=61447aba-a88d-5c82-03aa-a6e79ea00334&lineStart=50&lineEnd=68&colStart=1&colEnd=110

Show all relevant oiio log files from vcpkg/builtrees

cat C:/vcpkg/buildtrees/openimageio/config-x64-windows-err.log
cat C:/vcpkg/buildtrees/openimageio/config-x64-windows-out.log
cat C:/vcpkg/buildtrees/openimageio/install-x64-windows-dbg-err.log
cat C:/vcpkg/buildtrees/openimageio/install-x64-windows-dbg-out.log
cat C:/vcpkg/buildtrees/openimageio/install-x64-windows-rel-err.log
cat C:/vcpkg/buildtrees/openimageio/install-x64-windows-rel-out.log

libpng warning: Application built with libpng-1.4.12 but running with 1.6.36

I tried the macOS oiio 2.0.4 wheel (which by the way is half the size of the Linux/Windows equivalent wheel) on my laptop and attempted to load a jpeg file instead of the EXR file in our current test:

$ pytest
=============================================================== test session starts ================================================================
platform darwin -- Python 3.7.2, pytest-4.2.0, py-1.7.0, pluggy-0.8.1
rootdir: /Users/fredrik/code/repos/oiio-python/tests, inifile:
collected 1 item

test_imagedimensions.py F                                                                                                                    [100%]

===================================================================== FAILURES =====================================================================
___________________________________________________________________ test_answer ____________________________________________________________________

    def test_answer():
        """Verify image dimensions."""
        image_filepath = os.path.join(
            os.path.dirname(__file__), "img", "test.png"
        )
        img_width, img_height = image_dimensions(image_filepath)
>       assert img_width == 1024
E       assert 0 == 1024

test_imagedimensions.py:35: AssertionError
--------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------
libpng warning: Application built with libpng-1.4.12 but running with 1.6.36
============================================================= 1 failed in 0.25 seconds =============================================================

Wheel naming

Currently, this is the name of a wheel built for Windows: oiio-2.0.4_20190127.115-py3-none-any.whl

Download: oiio-2.0.4_20190127.115-py3-none-any.whl.zip

Tests are tracked in the python-tag branch, PR #15

  • Investigate why it does not say py36 in this case, as we will have to build for each Python version, I presume?
  • Investigate why the wheel name doesn't indicate this was built for Windows only.
  • Perform pip install -U pip before build
  • Use a wheel version which does not produce the following warning:

2019-01-28T21:14:21.4399891Z C:\hostedtoolcache\windows\Python\3.7.0\x64\lib\site-packages\setuptools\dist.py:484: UserWarning: The version specified ('2.0.4-20190128.39') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.

Python 3.7 cannot build oiio

I'm trying to build in the 3.7 branch.

Seems like pybind is automatically downloading Python 3.6 and that is the problem:

2019-01-27T20:42:39.4857374Z Starting package 76/76: openimageio:x64-windows
2019-01-27T20:42:39.4857438Z Building package openimageio[core]:x64-windows... 
2019-01-27T20:42:40.1780351Z -- Downloading https://github.com/OpenImageIO/oiio/archive/bb2c617e83b3b264c9f4b7503d3c01c16570fdb7.tar.gz...
2019-01-27T20:42:42.5099913Z -- Extracting source C:/vcpkg/downloads/OpenImageIO-oiio-bb2c617e83b3b264c9f4b7503d3c01c16570fdb7.tar.gz
2019-01-27T20:42:43.3633329Z -- Applying patch fix_libraw.patch
2019-01-27T20:42:43.5055934Z -- Applying patch failed. This is expected if this patch was previously applied.
2019-01-27T20:42:43.5056546Z -- Applying patch use-webp.patch
2019-01-27T20:42:43.6033449Z -- Using source at C:/vcpkg/buildtrees/openimageio/src/c16570fdb7-3c5d294ecd
2019-01-27T20:42:43.6133449Z -- Configuring x64-windows
2019-01-27T20:42:58.5416211Z CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:56 (message):
2019-01-27T20:42:58.5416487Z     Command failed: ninja;-v
2019-01-27T20:42:58.5416632Z     Working Directory: C:/vcpkg/buildtrees/openimageio/x64-windows-rel/vcpkg-parallel-configure
2019-01-27T20:42:58.5416700Z     See logs for more information:
2019-01-27T20:42:58.5416931Z       C:\vcpkg\buildtrees\openimageio\config-x64-windows-out.log
2019-01-27T20:42:58.5416994Z 
2019-01-27T20:42:58.5417044Z Call Stack (most recent call first):
2019-01-27T20:42:58.5417131Z   scripts/cmake/vcpkg_configure_cmake.cmake:259 (vcpkg_execute_required_process)
2019-01-27T20:42:58.5417199Z   ports/openimageio/portfile.cmake:35 (vcpkg_configure_cmake)
2019-01-27T20:42:58.5417257Z   scripts/ports.cmake:71 (include)
2019-01-27T20:42:58.5417324Z 
2019-01-27T20:42:58.5417353Z 
2019-01-27T20:42:58.5489447Z Error: Building package openimageio:x64-windows failed with: BUILD_FAILED
2019-01-27T20:42:58.5489786Z Please ensure you're using the latest portfiles with `.\vcpkg update`, then
2019-01-27T20:42:58.5489958Z submit an issue at https://github.com/Microsoft/vcpkg/issues including:
2019-01-27T20:42:58.5490159Z   Package: openimageio:x64-windows
2019-01-27T20:42:58.5490301Z   Vcpkg version: 2018.11.23-nohash

Log file output available in the build: https://fredrikaverpil.visualstudio.com/oiio-python/_build/results?buildId=273

2019-01-27T20:43:00.0602591Z CMake Warning at src/dicom.imageio/CMakeLists.txt:7 (message):
2019-01-27T20:43:00.0604027Z   DICOM plugin will not be built, no DCMTK
2019-01-27T20:43:00.0604873Z 
2019-01-27T20:43:00.0605887Z 
2019-01-27T20:43:00.0606957Z -- FFmpeg not found: ffmpeg plugin will not be built
2019-01-27T20:43:00.0608103Z CMake Warning at src/gif.imageio/CMakeLists.txt:7 (message):
2019-01-27T20:43:00.0609234Z   GIF plugin will not be built
2019-01-27T20:43:00.0610343Z 
2019-01-27T20:43:00.0611268Z 
2019-01-27T20:43:00.0612426Z CMake Warning at src/heif.imageio/CMakeLists.txt:7 (message):
2019-01-27T20:43:00.0613953Z   heif plugin will not be built
2019-01-27T20:43:00.0614912Z 
2019-01-27T20:43:00.0615845Z 
2019-01-27T20:43:00.0617048Z CMake Warning at src/jpeg2000.imageio/CMakeLists.txt:16 (message):
2019-01-27T20:43:00.0618407Z   Jpeg-2000 plugin will not be built
2019-01-27T20:43:00.0619326Z 
2019-01-27T20:43:00.0620421Z 
2019-01-27T20:43:00.0621561Z CMake Warning at src/raw.imageio/CMakeLists.txt:7 (message):
2019-01-27T20:43:00.0622585Z   Raw plugin will not be built
2019-01-27T20:43:00.0624120Z 
2019-01-27T20:43:00.0625128Z 
2019-01-27T20:43:00.0626294Z -- WebP plugin will not be built
2019-01-27T20:43:00.0627763Z -- Create imagio_pvt.h from imageio_pvt.h.in
2019-01-27T20:43:00.0628757Z -- Setting SOVERSION to: 2.1
2019-01-27T20:43:00.0629907Z -- pybind11 2.2, include dir: C:/vcpkg/installed/x64-windows/include
2019-01-27T20:43:00.0631410Z CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
2019-01-27T20:43:00.0632331Z   Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at
2019-01-27T20:43:00.0633859Z   least version "3.7")
2019-01-27T20:43:00.0635029Z Call Stack (most recent call first):
2019-01-27T20:43:00.0636207Z   C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
2019-01-27T20:43:00.0637625Z   C:/Program Files/CMake/share/cmake-3.13/Modules/FindPythonInterp.cmake:159 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
2019-01-27T20:43:00.0639065Z   C:/vcpkg/scripts/buildsystems/vcpkg.cmake:247 (_find_package)
2019-01-27T20:43:00.0640064Z   src/python/CMakeLists.txt:4 (find_package)
2019-01-27T20:43:00.0641030Z 
2019-01-27T20:43:00.0642153Z 
2019-01-27T20:43:00.0643595Z -- Configuring incomplete, errors occurred!
2019-01-27T20:43:00.0644746Z See also "C:/vcpkg/buildtrees/openimageio/x64-windows-rel/CMakeFiles/CMakeOutput.log".
2019-01-27T20:43:00.0645796Z See also "C:/vcpkg/buildtrees/openimageio/x64-windows-rel/CMakeFiles/CMakeError.log".
2019-01-27T20:43:00.0646798Z ninja: build stopped: subcommand failed.

When you look at the CONTROL file for pybind, it is saying python3 is a dependency, and when you look at the python3 portfile, it is installing python 3.6.4.

First thing to try is to have pybind install python3 using 3.7 instead of 3.6.

ImageBufAlgo.ociodisplay supported?

Hello there,

I am trying to convert exrs to jpg and am constantly getting the error: Could not construct the color transform

I have tried based on the examples here, using spi-vfx as a guide but really I want to be using aces
https://openimageio.readthedocs.io/en/latest/pythonbindings.html

I think first question I should ask is this built with OCIO? Im just trying to find a solution to maintain an OCIO look in a 8bit format like jpg without going into nuke for example!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.