Correct-Syntax / py-oiio

Python OpenImageIO (OIIO)
MIT License
19 stars 1 forks source link

ModuleNotFoundError: No module named 'oiio.OpenImageIO' #1

Closed johhnry closed 1 year ago

johhnry commented 1 year ago

Hi,

I just tested your setup on Windows and this is what I did:

$ git clone https://github.com/Correct-Syntax/py-oiio.git
$ cd py-oiio
$ vcpkg.exe install openimageio[pybind11]:x64-windows
$ cp <vcpkg>\current\installed\x64-windows\lib\python3.10\site-packages\OpenImageIO\OpenImageIO.cp310-win_amd64.pyd .\oiio\
$ mv .\oiio\OpenImageIO.cp310-win_amd64.pyd .\oiio\OpenImageIO
$ cp <vcpkg>\current\installed\x64-windows\bin\OpenImageIO.dll .\oiio\
$ cp <vcpkg>\current\installed\x64-windows\bin\OpenImageIO_Util.dll .\oiio\

$ python -c "import oiio"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\jhenry\git\py-oiio\oiio\__init__.py", line 16, in <module>
    from .OpenImageIO import *
ModuleNotFoundError: No module named 'oiio.OpenImageIO'

This is the file structure:

.
├── LICENSE
├── oiio
│   ├── OpenImageIO
│   ├── OpenImageIO.dll
│   ├── OpenImageIO_Util.dll
│   └── __init__.py
├── README.md
├── setup.cfg
├── setup.py
└── tests
    ├── img
    │   └── oiio-logo-with-alpha.png
    └── test.py

What did I miss?

Thanks!

Correct-Syntax commented 1 year ago

image

Based on your directory structure, my guess is that you forgot to copy the dlls over.

johhnry commented 1 year ago

@Correct-Syntax thanks for answering so quickly!

After I posted the issue, I just noticed that line in the readme. I tried copying all the dlls but it doesn't work either:

$ cp <vcpkg>\current\installed\x64-windows\bin\*.dll .\oiio\
.
├── LICENSE
├── oiio
│   ├── boost_atomic-vc143-mt-x64-1_82.dll
│   ├── boost_chrono-vc143-mt-x64-1_82.dll
│   ├── boost_container-vc143-mt-x64-1_82.dll
│   ├── boost_context-vc143-mt-x64-1_82.dll
│   ├── boost_coroutine-vc143-mt-x64-1_82.dll
│   ├── boost_date_time-vc143-mt-x64-1_82.dll
│   ├── boost_filesystem-vc143-mt-x64-1_82.dll
│   ├── boost_random-vc143-mt-x64-1_82.dll
│   ├── boost_regex-vc143-mt-x64-1_82.dll
│   ├── boost_stacktrace_noop-vc143-mt-x64-1_82.dll
│   ├── boost_stacktrace_windbg-vc143-mt-x64-1_82.dll
│   ├── boost_stacktrace_windbg_cached-vc143-mt-x64-1_82.dll
│   ├── boost_system-vc143-mt-x64-1_82.dll
│   ├── boost_thread-vc143-mt-x64-1_82.dll
│   ├── bz2.dll
│   ├── fmt.dll
│   ├── Iex-3_1.dll
│   ├── IlmThread-3_1.dll
│   ├── Imath-3_1.dll
│   ├── jpeg62.dll
│   ├── legacy.dll
│   ├── libcrypto-3-x64.dll
│   ├── libexpat.dll
│   ├── libffi.dll
│   ├── liblzma.dll
│   ├── libpng16.dll
│   ├── libssl-3-x64.dll
│   ├── OpenEXR-3_1.dll
│   ├── OpenEXRCore-3_1.dll
│   ├── OpenEXRUtil-3_1.dll
│   ├── OpenImageIO
│   ├── OpenImageIO.dll
│   ├── OpenImageIO_Util.dll
│   ├── python3.dll
│   ├── python310.dll
│   ├── sqlite3.dll
│   ├── tiff.dll
│   ├── turbojpeg.dll
│   ├── zlib1.dll
│   └── __init__.py
├── README.md
├── setup.cfg
├── setup.py
└── tests
    ├── img
    │   └── oiio-logo-with-alpha.png
    └── test.py
$ python -c "import oiio"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\jhenry\git\py-oiio\oiio\__init__.py", line 16, in <module>
    from .OpenImageIO import *
ModuleNotFoundError: No module named 'oiio.OpenImageIO'

(I also renamed OpenImageIO.cp310-win_amd64.pyd to OpenImageIO)

Correct-Syntax commented 1 year ago
  1. It may have something to do with where you are in your terminal. Try moving to the folder (if you aren't already there)
  2. Copy this to your python site-packages dir oiio.zip. See if that works. If it doesn't then I will be extremely surprised.
johhnry commented 1 year ago

Oh I'm sorry it's a dumb mistake, I renamed the .pyd file to OpenImageIO without the extension so it didn't work! Now it works with OpenImageIO.pyd

Thanks for your help ^^

Correct-Syntax commented 1 year ago

You're welcome.