doyubkim / fluid-engine-dev

Fluid simulation engine for computer graphics applications
https://fluidenginedevelopment.org/
MIT License
1.88k stars 263 forks source link

Python API import error on Windows and Python 3.8+ with Intel TBB #300

Open utilForever opened 4 years ago

utilForever commented 4 years ago

I encountered Python API import error while updating CubbyFlow.

import pyjet
ImportError: DLL load failed while importing pyjet:
The specified module could not be found. 

At first, I thought it was my problem, but after a few days of investigation, I found that there is a new Windows safety feature that changes how DLLs are loaded in Python 3.8. To resolve this issue, I needed to tell Python how to find the library again like this:

import os
os.add_dll_directory(r'C:/Intel/tbb/bin/intel64/vc14') << (The path that Intel TBB is located)
import pyjet

I think we should add this situation and solution to README.md or INSTALL.md. What do you think?

doyubkim commented 4 years ago

Is this still an issue if PATH env variable contains TBB?

utilForever commented 4 years ago

Yes, it is.

doyubkim commented 4 years ago

Ok that’s unfortunate 🙁 I’m starting to think if pyjet should use tbb from pypi. Having extra function call for every pyjet import doesn’t look nice.

utilForever commented 4 years ago

I agree. So I suggest adding this issue to documents such as README.md or INSTALL.md. 🤔

doyubkim commented 4 years ago

It should be a temporary warning message in the docs before we have proper fix. Do you mind posting a PR for that?

utilForever commented 4 years ago

Yes, I’ll post PR tonight. :) Do you want to add warning messages to Install.md?

doyubkim commented 4 years ago

@utilForever Not sure why I missed your last comment. Yup, that sounds good!

utilForever commented 4 years ago

@doyubkim Okay. I'll post PR tonight after I add warning messages. 😀

doyubkim commented 4 years ago

I'm also making some experiments to address general distribution issues with TBB. I think we should build and deploy the version of TBB that's been used with the Jet build. Hope I can come up with something to share soon.

utilForever commented 3 years ago

@doyubkim Not sure why I missed this issue. I'll post PR tonight after work. 📜