Cannot manage to compile Python FBX 2020.0.1 VS2017 with Python 3.7

Cannot manage to compile Python FBX 2020.0.1 VS2017 with Python 3.7

lhoyet
Participant Participant
3,528 Views
9 Replies
Message 1 of 10

Cannot manage to compile Python FBX 2020.0.1 VS2017 with Python 3.7

lhoyet
Participant
Participant

Hi everyone,

 

I'm trying to use Python FBX in a project, and I'm discovering that there are only bindings provided for Python 2.? and 3.1. The project I'm wanting to integrate the Python FBX module is running under python 3.7, so from my understanding I need to recompile the module myself.

 

I wonder if others went through the same steps, but I seem to be running into a couple of problems and therefore seek help. I also hope that it might help others if solved... For information I'm running it for Windows 10.

 

So I started by downloading and installing the FBX SDK, the Python FBX and FBX Python Bindings ( https://www.autodesk.com/developer-network/platform-technologies/fbx-sdk-2020-0 download:)

I then tried to follow as much as possible the steps provided by Autodesk (\FBX Python Bindings\2020.0.1\readme.txt).

 

As they recommand first installing sip ("4.19.3 because it is known that it correctly supports the '--sip-module'"), I downloaded the source from Riverbank (https://www.riverbankcomputing.com/software/sip/download/). As it was an already prepared version I went directly to 'python configure.py', followed by 'nmake install'(make install will actually run to an infinite loop on windows). Following the install running sip -V in the python root directory confirmed that it was the 4.19.3 version.

 

I then ran "python PythonBindings.py Python3_x86" from the c:\Program Files\Autodesk\FBX\FBX Python Bindings\2020.0.1 directory

And that's when I seem to get stuck, it get to the following code and does nothing

=> RUN COMMAND : "C:\Users\myuser\AppData\Local\Programs\Python\Python37-32\sip" -o -t FBX_X86 -c c:\Program Files\Autodesk\FBX\FBX Python Bindings\2020.0.1\build\Python37_x86 -b c:\Program Files\Autodesk\FBX\FBX Python Bindings\2020.0.1\build\Python37_x86\fbx_module.sbf -I c:\Program Files\Autodesk\FBX\FBX Python Bindings\2020.0.1\sip c:\Program Files\Autodesk\FBX\FBX Python Bindings\2020.0.1\sip\fbx_module.sip
sip: Usage: sip [-h] [-V] [-a file] [-b file] [-B tag] [-c dir] [-d file] [-D] [-e] [-f] [-g] [-I dir] [-j #] [-k] [-m file] [-o] [-p module] [-P] [-r] [-s suffix] [-t tag] [-w] [-x feature] [-X id:file] [-y file] [-z file] [@file] [file]

It looks like the command line that is ran is incorrect, but I have no idea what can be the cause. Would anyone know what's going wrong?

 

Thanks in advance

0 Likes
3,529 Views
9 Replies
Replies (9)
Message 2 of 10

lhoyet
Participant
Participant

Hi again, while I spent the day on this problem as usual it's when I post to try to get help that something starts to work. 

 

Sip does not seem to like much the long path (possibly with spaces): 

c:\Program Files\Autodesk\FBX\FBX Python Bindings\2020.0.1

I've tried to change it in the PythonBindings.py file to '.\\' instead, and I got some success. I'm stuck at the linking now, but that might be a similar problem, which I'm now looking into. But I'm happy to have any feedback if anyone ran into the same problem before. 

 

LINK : fatal error LNK1181: impossible d'ouvrir le fichier en entrée 'libfbxsdk-md.lib'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\link.EXE"' : code retour '0x49d'

 

0 Likes
Message 3 of 10

lhoyet
Participant
Participant

So if someone else runs into the same problem, I finally managed to get the Python FBX 2020.1 VS2017 to compile for Python 3.7 by modifying further the PythonBindings.py file.

 

It tool me a while, but I finally found that it was looking for the VS2015 dlls instead of the VS2017 ones, which I solved by changing the compiler in the PythonBidings.py file to:

 

vcCompiler = "vc150"
vsCompiler = "vs2017"
0 Likes
Message 4 of 10

master_cranky
Participant
Participant

Did you get it to compile?  I was able to get it to compile -- but the tests that ship with the bindings do not pass for me.  I have another thread similar to yours a few items above this post that goes into some detail of the issue I encountered.  Like you -- much of it can be answered by reading the instructions provided and following all recommendations (ie: using the correct sip, updating environment variables, etc.). 


I used the following and it 'builds' and creates a n fbx.pyd, fbxCommon.py, and fbxsip.py (although I too had to fix the spaces by doing a subst t: c:\program files\..\2020.1 ).  Anyway -- this is the command I ultimately run -- but the the tests fail so its a bit of a wash.     

 

pythonbindings.py Python3_x64 buildsip test

 

There are four tests that fail for me.

0 Likes
Message 5 of 10

lhoyet
Participant
Participant

Hi, 

 

Sorry for the (very) late answer. I indeed managed to build it, and it's working with my Python application (able to load FBX files, including 3D objects and animations). I've compiled it for python 3.7 x86, as well as 3.8.1 x64. But whenever a collaborator uses a different python version, we need to recompile everything, which is a pain...

 

One thing that also made the difference for me was to run de correct x86 or x64 Command Prompt in Admin, depending on whether I was compiling for Python 32 or 64bits.

 

I also ended up with an error while compiling (which is below), but the fbx.pyd file was created and does work. It was just not copied in the build/distrib/... folder

=> Copy the results to the folder:.\build\Distrib\site-packages\fbx
Traceback (most recent call last):
  File "PythonBindings.py", line 647, in <module>
    main(sys.argv)
  File "PythonBindings.py", line 626, in main
    shutil.copyfile(os.path.join(build_dir, 'fbx' + SIP_MODULE_EXT), os.path.join(sdk_lib_dir, 'fbx' + SIP_MODULE_EXT))
  File "C:\Users\lhoyet\AppData\Local\Programs\Python\Python38\lib\shutil.py", line 259, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '.\\build\\Python38_x64\\fbx.pyd'

 

I also had not run the tests in the past, but just checked and as it fails with the error above it does not seem to be running the tests... 

0 Likes
Message 6 of 10

Anonymous
Not applicable

Hello,

I have been trying to make an SDK for py3.8 but failing.

got to the point where i have the same error as you

can the specified folder is empty, where did you find it?

I have searched everywhere

Thank you

 

0 Likes
Message 7 of 10

lhoyet
Participant
Participant

Hi, 

 

As there are many of us working on the same project with different python versions, we have actually automated the process on our side and made it fully automatic. If you are interested we have a git project that integrated it the compilation and installation of the python FBX SDK using pip. 

 

You can access it here, and follow the installation instructions: https://gitlab.inria.fr/radili/fbxsdk_python

 

Let us know if you have any problem, as we have been using it internally but have not tested it extensively in other conditions. 

 

Cheers,

 

Ludovic

Message 8 of 10

master_cranky
Participant
Participant

Will take a look.  

With the latest sdk from Autodesk 2021 version I believe? there was 3.7x compiled versions that came with the distribution. It provided what I needed for now as it matches the VFXPlatform version.

0 Likes
Message 9 of 10

lhoyet
Participant
Participant
Normally it should be easily be updatable for any version of the SDK. That's what we were looking for in any case, but I don't know if we tested it with 2021...
0 Likes
Message 10 of 10

Anonymous
Not applicable

yes this python management in the early days is very difficult to manage but don't worry I made some solution guides for this issue now you can visit here for more details.

0 Likes