pythonassimptrimesh

Using pyassimp library in Python


There is too many information out there and I tried most of them. However, I couldn't get assimp working in Python. This is the error that I get :

  File "C:\Users\X\AppData\Local\Programs\Python\Python35\lib\site-packages\pyassimp\helper.py", line 234, in search_library
    raise AssimpError("assimp library not found")
pyassimp.errors.AssimpError: assimp library not found

I know that I have to include dll file in the current working directory. I found a Assimp64.dll file on the internet and copied it to my working directory. But it didn't work. Also tried this suggestion : https://github.com/assimp/assimp/issues/1438 Still, it didn't work.. I also tried to compile an assimp.dll using cmake but I couldn't manage to do so. How I could solve my problem? Any ideas?


Solution

  • First install pyassimp with pip:

    pip install pyassimp
    

    Second you need to download the assimp source from github. CMake is not a compiler, its a builder tool. With it you can build or create Visual Studio project or solution, if you are on Windows. After you created the Visual Studio solution with CMake, open Assimp.sln file in Visual Studio and right click on ALL_BUILD and build it (alternativly choose your build target "Release or Debug"), it will take 4-5 minutes to build and compile. You will get "assimp-vc140-mt.dll", copy this .dll file to your python installation folder to \Lib\site-packages\pyassimp.

    And if you are a visual type, here are some videos i created about pyassimp:Intro to PyAssimp