Using oiio in python on a new mac #3445
Unanswered
ahemberger
asked this question in
Q&A
Replies: 4 comments 2 replies
-
If you are using the macOS installed python then it doesn’t know where your
homebrew python libraries are. You need to add them to your PYTHONPATH.
You should add them to a .zshrc (macOS defaults to zsh) or whatever shell
you changed it to use.
…On Wed, Jun 15, 2022 at 05:33 Allen Hemberger ***@***.***> wrote:
Hi;
I've installed oiio on my macbook (M1 MAX) using Homewbrew; I can verify
it's installed by successfully invoking oiiotool from my Terminal.
When I try to "import OpenImageIO" in python, though, I get "module not
found". Google searches about this issue seem to turn up results for
pre-Monterey installs of homebrew, or mention symlinking (which I would
like to avoid; this will only break later and confuse me I worry). What's
the best practice for managing this currently?
Thank you!
—
Reply to this email directly, view it on GitHub
<#3445>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA5UANUHFBY35BHIFRCCV3VPHESXANCNFSM5Y3EMAQA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
You only need to append to the $PYTHONPATH, not overwrite it. Pyenv is
unrelated to this as it is just updating the $PATH env variable.
…On Wed, Jun 15, 2022 at 08:17 Allen Hemberger ***@***.***> wrote:
Thanks; I more or less understand this. I'm using pyenv to manage my
python versions; it seems like getting pythonpath to follow along with
pyenv to synchronize versions might be more complicated than I anticipated
(and I understand this is outside the scope of this particular repo). I was
hoping this might be an easy fix.
—
Reply to this email directly, view it on GitHub
<#3445 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA5UAML2OG6QASW4ZHI52DVPHXYNANCNFSM5Y3EMAQA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
It looks like homebrew is only setup for python 3.9.
https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/openimageio.rb
You would have to submit a change to add additional python version support
as flags or add a variant based on other python versions. Macos currently
defaults to 3.9 which is why many formula in homebrew default to that.
…On Wed, Jun 15, 2022 at 14:48 Allen Hemberger ***@***.***> wrote:
Ok; thank you.
I can see this was installed when I did a 'brew install openimageio':
/opt/homebrew/Cellar/openimageio/
2.3.16.0/lib/python3.9/site-packages/OpenImageIO.cpython-39-darwin.so
What is the mechanism that encouraged the installer to install this for
python 3.9? I assume it was homebrew itself. How should I get/manage
versions compatible with other versions of python? Is this possible?
I tried:
brew unlink ***@***.***
brew link ***@***.***
to – I think – switch homebrew's python version to 3.7, then tried to
re-install oiio:
brew reinstall openimageio
but this did not introduce any new files into the path mentioned above.
And, of course, switching to a python version other than 3.9 fails to find
oiio.
FWIW, though, to your previous recommendation, it indeed works; I have
this in my .zshrc:
###############################################################################
# Set OpenImageIO
echo "\tSetting up OpenImageIO..."
export PYTHON_VERSION="3.9"
export PYTHONPATH="/opt/homebrew/Cellar/openimageio/2.3.16.0/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH <http://2.3.16.0/lib/python$%7BPYTHON_VERSION%7D/site-packages:$PYTHONPATH>"
and if I configure pyenv to use python 3.9, it seems to import OpenImageIO
fine.
—
Reply to this email directly, view it on GitHub
<#3445 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA5UAIFD4ISNYTCPOSLKVLVPJFUJANCNFSM5Y3EMAQA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
…or, presumably, then, build oiio myself.
Ok cool, this has all been very helpful and illuminating, thanks so very much for all your help. Even just understanding how I should set my expectations is quite useful.
… On Jun 15, 2022, at 5:45 PM, Deke Kincaid ***@***.***> wrote:
It looks like homebrew is only setup for python 3.9.
https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/openimageio.rb
You would have to submit a change to add additional python version support
as flags or add a variant based on other python versions. Macos currently
defaults to 3.9 which is why many formula in homebrew default to that.
On Wed, Jun 15, 2022 at 14:48 Allen Hemberger ***@***.***>
wrote:
> Ok; thank you.
>
> I can see this was installed when I did a 'brew install openimageio':
>
> /opt/homebrew/Cellar/openimageio/
> 2.3.16.0/lib/python3.9/site-packages/OpenImageIO.cpython-39-darwin.so
>
> What is the mechanism that encouraged the installer to install this for
> python 3.9? I assume it was homebrew itself. How should I get/manage
> versions compatible with other versions of python? Is this possible?
>
> I tried:
>
> brew unlink ***@***.***
>
> brew link ***@***.***
>
> to – I think – switch homebrew's python version to 3.7, then tried to
> re-install oiio:
>
> brew reinstall openimageio
>
> but this did not introduce any new files into the path mentioned above.
> And, of course, switching to a python version other than 3.9 fails to find
> oiio.
>
> FWIW, though, to your previous recommendation, it indeed works; I have
> this in my .zshrc:
>
> ###############################################################################
>
> # Set OpenImageIO
>
> echo "\tSetting up OpenImageIO..."
>
> export PYTHON_VERSION="3.9"
>
> export PYTHONPATH="/opt/homebrew/Cellar/openimageio/2.3.16.0/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH <http://2.3.16.0/lib/python$%7BPYTHON_VERSION%7D/site-packages:$PYTHONPATH>"
>
>
> and if I configure pyenv to use python 3.9, it seems to import OpenImageIO
> fine.
>
> —
> Reply to this email directly, view it on GitHub
> <#3445 (reply in thread)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAA5UAIFD4ISNYTCPOSLKVLVPJFUJANCNFSM5Y3EMAQA>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi;
I've installed oiio on my macbook (M1 MAX) using Homewbrew; I can verify it's installed by successfully invoking oiiotool from my Terminal.
When I try to "import OpenImageIO" in python, though, I get "module not found". Google searches about this issue seem to turn up results for pre-Monterey installs of homebrew, or mention symlinking (which I would like to avoid; this will only break later and confuse me I worry). What's the best practice for managing this currently?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions