-
Notifications
You must be signed in to change notification settings - Fork 266
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
Can't import mitsuba in a conda environment with openexr installed [🐛 bug report] #411
Comments
Hi @Microno95 , Just checking here that you are running |
Hi @Speierers, I actually tried three configurations. |
Could you print you set PATH=%MITSUBA_DIR%;%PATH% |
Ah, I don't think that's the case in the master branch Line 11 in e1c0928
I'll try swapping to give the Mitsuba directory precedence and see if that fixes it. |
Just tested that, and now OpenEXR fails to load instead with the error: >>> import OpenEXR
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing OpenEXR: The specified procedure could not be found. It seems that the DLL path resolution correctly respects the From what I've read, a Windows application cannot load multiple DLLs with the same name in the same process unless the DLLs are loaded via the absolute path to the library instead of relying on Windows to resolve the dependency. |
This is the result of ['', 'G:\\research_files\\academic_work\\git_repositories\\mitsuba_renderer_folder\\mitsuba2\\build_windows\\release\\dist\\python', 'G:\\research_files\\academic_work\\git_repositories\\mitsuba_renderer_folder\\mitsuba2', 'C:\\Users\\ekin4\\.conda\\envs\\test_exr_mitsuba2\\python38.zip', 'C:\\Users\\ekin4\\.conda\\envs\\test_exr_mitsuba2\\DLLs', 'C:\\Users\\ekin4\\.conda\\envs\\test_exr_mitsuba2\\lib', 'C:\\Users\\ekin4\\.conda\\envs\\test_exr_mitsuba2', 'C:\\Users\\ekin4\\.conda\\envs\\test_exr_mitsuba2\\lib\\site-packages'] |
And is it necessary for you to import both |
At the moment, not a big priority. I have set up a separate environment for manipulating The convenience of using OpenEXR has been the documentation showing how to go from image data to numpy arrays and back. Other than that, there's no particular reason I could not use |
You can definitely use the Here is a little tuto: # load image from disk
bmp = Bitmap("some_image_file.png")
# convert to numpy array
np_img = np.array(bmp)
# convert from numpy array
bmp2 = Bitmap(np_img)
# write down to file
bmp2.write("my_image.exr") You can also specify the image format (e.g. RGB vs XYZ vs RGBA, ...) and the data type (float32 vs int32). Take a look at |
Swapping out OpenEXR for Bitmap worked superbly, much easier interface too. Thanks! Unfortunately, I ran into a similar issue involving pytorch (my script loads exr images into pytorch tensors). I believe it's due to the fact that pytorch comes with its own version of I tried setting Once I figure out the minimal number of steps to reproduce the error, I'll create a proper bug report. But I thought I'd comment here in case you have some idea of what to look at. |
I figured out how to make #ifndef ASMJIT_STATIC
#define ASMJIT_STATIC
#endif Now I can import pytorch and mitsuba simultaneously. I am still testing whether I can run them at the same time without issue. |
Nice catch! If you think this should be pushed on the main repository, feel free to open a PR 🚀 |
Summary
Unable to import mitsuba in a conda environment on windows if the environment has
openexr
andopenexr-python
installed as mitsuba cannot find its own openexr libraries.System configuration
scalar_rgb
scalar_mono
scalar_spectral
Description
When importing Mitsuba 2 in a conda environment on Windows where
openexr
andopenexr-python
(python bindings for OpenEXR) are installed from the conda repositories, the mitsuba modules do not correctly load due to the.dll
search path prioritising the environmentopenexr
libraries over the mitsuba compiled ones. For example,Half.dll
in the environment is found before theHalf.dll
library indist/
. You can check this by running:I've tested this on a Linux conda environment where the issue does not occur so this is entirely a problem with how Windows handles loading of
.dll
files and where it searches for them.Steps to reproduce
In a shell with conda installed
conda create -n test_exr_mitsuba python=3.8 numpy scipy openexr openexr-python -c conda-forge
python -m mitsuba
(alternatively run python and callimport mitsuba
)The text was updated successfully, but these errors were encountered: