-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
I had some issues with pip install openexr when trying to install this module on macOS latest version (at time of writing).
I've not had the time to dig into the nuts and bolts of this problem, it seems to stem from developmental changes to the OpenEXR library, forking off from Imath and making minor changes to their API.
I've written a patch which has gotten this library installing and tested to be working within the scope of what I need it for (reading and processing images stored as .exr), it can likely be tidied and better tested (so no PR), hopefully this helps any others who run into difficulties:
diff --git a/OpenEXR.cpp b/OpenEXR.cpp
index 99ff258..d73372c 100644
--- a/OpenEXR.cpp
+++ b/OpenEXR.cpp
@@ -62,6 +62,7 @@ typedef int Py_ssize_t;
#include <ImfTimeCodeAttribute.h>
#include <ImfVecAttribute.h>
#include <ImfVersion.h>
+#include <ImfFrameBuffer.h>
#include <OpenEXRConfig.h>
@@ -87,8 +88,8 @@ typedef int Py_ssize_t;
#include <algorithm>
#include <iostream>
#include <iomanip>
-#include <iostream>
#include <vector>
+#include <fstream>
using namespace std;
using namespace Imf;
@@ -121,8 +122,8 @@ class C_IStream: public IStream
C_IStream (PyObject *fo):
IStream(""), _fo(fo) {}
virtual bool read (char c[], int n);
- virtual Int64 tellg ();
- virtual void seekg (Int64 pos);
+ virtual uint64_t tellg ();
+ virtual void seekg (uint64_t pos);
virtual void clear ();
virtual const char* fileName() const;
private:
@@ -148,7 +149,7 @@ const char* C_IStream::fileName() const
}
-Int64
+uint64_t
C_IStream::tellg ()
{
PyObject *rv = PyObject_CallMethod(_fo, (char*)"tell", NULL);
@@ -157,14 +158,14 @@ C_IStream::tellg ()
long long t = PyLong_AsLong(lrv);
Py_DECREF(lrv);
Py_DECREF(rv);
- return (Int64)t;
+ return (uint64_t)t;
} else {
throw Iex::InputExc("tell failed");
}
}
void
-C_IStream::seekg (Int64 pos)
+C_IStream::seekg (uint64_t pos)
{
PyObject *data = PyObject_CallMethod(_fo, (char*)"seek", (char*)"(L)", pos);
if (data != NULL) {
@@ -186,8 +187,8 @@ class C_OStream: public OStream
public:
C_OStream (PyObject *fo): OStream(""), _fo(fo) {}
virtual void write (const char *c, int n);
- virtual Int64 tellp ();
- virtual void seekp (Int64 pos);
+ virtual uint64_t tellp ();
+ virtual void seekp (uint64_t pos);
virtual void clear ();
virtual const char* fileName() const;
private:
@@ -212,7 +213,7 @@ const char* C_OStream::fileName() const
}
-Int64
+uint64_t
C_OStream::tellp ()
{
PyObject *rv = PyObject_CallMethod(_fo, (char*)"tell", NULL);
@@ -221,14 +222,14 @@ C_OStream::tellp ()
long long t = PyLong_AsLong(lrv);
Py_DECREF(lrv);
Py_DECREF(rv);
- return (Int64)t;
+ return (uint64_t)t;
} else {
throw Iex::InputExc("tell failed");
}
}
void
-C_OStream::seekp (Int64 pos)
+C_OStream::seekp (uint64_t pos)
{
PyObject *data = PyObject_CallMethod(_fo, (char*)"seek", (char*)"(L)", pos);
if (data != NULL) {
diff --git a/setup.py b/setup.py
index 4d307ee..5aac585 100644
--- a/setup.py
+++ b/setup.py
@@ -32,9 +32,9 @@ setup(name='OpenEXR',
ext_modules=[
Extension('OpenEXR',
['OpenEXR.cpp'],
- include_dirs=['/usr/include/OpenEXR', '/usr/local/include/OpenEXR', '/opt/local/include/OpenEXR'],
+ include_dirs=['/usr/include/OpenEXR', '/usr/local/include/OpenEXR', '/opt/local/include/OpenEXR', '/usr/local/include/Imath'],
library_dirs=['/usr/local/lib', '/opt/local/lib'],
- libraries=['Iex', 'Half', 'Imath', 'IlmImf', 'z'],
+ libraries=['Iex', 'Imath', 'OpenEXR', 'z'],
extra_compile_args=compiler_args)
],
py_modules=['Imath'],The general installation flow should look something like:
$ git clone https://github.com/jamesbowman/openexrpython
$ cd openexrpython
$ mv <path/to/openexr_macos.patch> ./
$ git apply ./openexr_macos.patch
$ brew install openexr
$ brew install imath
$ brew link openexr
$ brew link imath
$ pip install ./Hope this helps!
Liam
stevewongv, PhlixFer, hansonw and fgolemostevewongv, PhlixFer and fgolemoPhlixFer, merlinND and fgolemo
Metadata
Metadata
Assignees
Labels
No labels