Python SDK on Windows?

Python SDK on Windows?

autodeskWH8HX
Explorer Explorer
5,062 Views
16 Replies
Message 1 of 17

Python SDK on Windows?

autodeskWH8HX
Explorer
Explorer

Following the instructions, I've downloaded the binaries, put them into site-packages, and I get this:

 

```

>>> from fbx import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.

```

 

I can tell it is correctly in `os.path`, because there is a different error if I move it.  All three files are in the folder.  I've tried it in python 3.10.1 and even dug out an old copy of 2.8 with the same result.

 

Anyone have any ideas?

0 Likes
5,063 Views
16 Replies
Replies (16)
Message 2 of 17

autodeskWH8HX
Explorer
Explorer

The OS X installer only lets you choose a disk, and then does not show you a path, or tell you what you installed.  It also does not work with the system python!

 

Is anyone else even able to use this?

0 Likes
Message 3 of 17

regalir
Autodesk
Autodesk

The binary python bindings are built with and for Python 3.7.6. It is possible that 3.10.1 (and certainly 2.8) are not compatible and fail to load the dll. An alternative solution is to get the sip sources and build the Python bindings directly with your desired Python version.

0 Likes
Message 4 of 17

regalir
Autodesk
Autodesk

On MacOS, the python Binding will be installed in: /Applications/Autodesk/FBX Python SDK/2020.x.x (where x are minor and point version numbers). From there, if you don't like the location, you can move the whole folder wherever you like or just copy the lib/Python38_x64 content to the site-packages of your Python interpreter.

0 Likes
Message 5 of 17

ellery
Participant
Participant

I'd like to give this topic a nudge.

 

I've gotten a little farther than the OP.  I have a clean Windows 10 VM.  I have installed Python 3.7.6 and the FBX Python SDK v2020.2.  I copied the two .pyd files from C:\Program Files\Autodesk\FBX\FBX Python SDK\2020.2\lib\Python37_x64\ to C:\Program Files\Python37\Lib\site-packages\fbx\.  I created an empty __init__.py file in the site-packages\fbx\ folder.  I put a copy of FbxCommon.py directly in the site-packages\  folder.

 

When I try to run one of the example programs, I get this result:

C:...> python "C:\Program Files\Autodesk\FBX\FBX Python SDK\2020.2\samples\ExportScene01\ExportScene01.py"
Traceback (most recent call last):
  File "C:\Program Files\Autodesk\FBX\FBX Python SDK\2020.2\samples\ExportScene01\ExportScene01.py", line 395, in <module>
    (lSdkManager, lScene) = FbxCommon.InitializeSdkObjects()
  File "C:\Program Files\Python37\lib\site-packages\FbxCommon.py", line 7, in InitializeSdkObjects
    lSdkManager = FbxManager.Create()
NameError: name 'FbxManager' is not defined

 

I cannot get past the "name 'FbxManager' is not defined" error.  I have tried different versions of the FBX Python SDK, and different versions of Python.  I originally tried on MacOS and switched to Windows when I couldn't get it to run there.

 

Does anyone have a foolproof step-by-step procedure to install and run the FBX Python SDK?  Because I'm feeling rather like a fool at this point.

0 Likes
Message 6 of 17

ellery
Participant
Participant
A quick update: I tried this on Linux (Ubuntu 20.04.4) and got the same result. I feel like there is just one key step I'm missing...
0 Likes
Message 7 of 17

regalir
Autodesk
Autodesk

Hi,

have you tried to just copy the three files (fbx.pyd, fbxsip.pid and FbxCommon.py) directly in ....\Lib\site-packages ?

This is actually how the samples have been configured to run if you want to copy the FBX python stuff into the site-packages. Alternatively, you can just add the ...\2020.2\lib\Python37_x64 folder to the path variable directly in the sample/your scripts code:

 

"""
   Copyright (C) 2017 Autodesk, Inc.
   All rights reserved.

   Use of this software is subject to the terms of the Autodesk license agreement
   provided at the time of installation or download, or which otherwise accompanies
   this software in either electronic or hard copy form.
 
"""

import sys
sys.path.append("C:/temp/pysdk/2020.2/lib/Python37_x64")

SAMPLE_FILENAME  = "ExportScene01.fbx"
Message 8 of 17

ellery
Participant
Participant

Yes, indeed it does work to copy the 3 files (fbx.pyd, FbxCommon.py, fbxsip.pyd) directly to the Python Lib/site-packages directory.  I thought I had tested this permutation.  But maybe I had first tried putting the files into Lib/site-packages/fbx, and when that failed I copied the 3 files from Lib/site-packages/fbx up one level, but did not remove the original copy.  Apparently, the presence of the Lib/site-packages/fbx files prevents it from working.

 

Just to be clear:

FAIL:

c:\my\python\dir\Lib
└───site-packages
    :
    ├───fbx
    │   ├───fbx.pyd
    │   ├───FbxCommon.py
    │   └───fbxsip.pyd
    :
    ├───fbx.pyd
    ├───FbxCommon.py
    └───fbxsip.pyd

 

SUCCESS:

c:\my\python\dir\Lib
└───site-packages
    :
    ├───fbx.pyd
    ├───FbxCommon.py
    └───fbxsip.pyd

 

I don't recall what led me to put the files into an fbx subdirectory.  It may have been something in the docs or it may have been an instinct on my part to organize it like other Python packages.

 

Thanks, @regalir!

0 Likes
Message 9 of 17

regalir
Autodesk
Autodesk

It is possible that what confused python is the folder named fbx and the fbx.pyd file. If I remember correctly, fbx.pyd cannot be renamed. Maybe, changing the folder name to something else and using an __init__.py file could work too?

0 Likes
Message 10 of 17

autodeskWH8HX
Explorer
Explorer
This is a completely insane way to distribute a Python package!

Message 11 of 17

regalir
Autodesk
Autodesk

To be fair, since the beginning when we started making the Python bindings, we never pretended to ship a Python Package. In fact, you cannot even use pip to find/update the FBX Python bindings.

 

The code is originally stored in the {FBXPYTHON}/lib/Python37_x64 (or _x86) and copying the files to the {PYTHON}/Libs/site-packages is suggested because site-packages is one of the locations Python search for the modules by default. But, as you certainly know, modules can be put anywhere that best suits your configuration as long as you properly tell Python where to find them. This is the approach we took!

0 Likes
Message 12 of 17

autodeskWH8HX
Explorer
Explorer
It would be better if you did not publish it, you have wasted countless
hours of Python developer's time. I'd personally already lost a week
before I opened this thread, and I'm still not even convinced it works on
anyone's machine at all, let alone that I can get it working on anything I
own.

Do you understand? This would be a great tool for some FBX processing that
I needed to do, but not only did it not work, I completely wasted all the
time I invested in it because I had to give up!

I think that if you reached out to your local Python group, they would tell
you this is silly, you should either take the afternoon to package it
properly or take it down so that nobody tries to use it.


Message 13 of 17

ellery
Participant
Participant

I would have to agree with @autodeskWH8HX.  I also invested a significant amount of time trying to get it to work, then more time checking before posting, so as not to waste others' time.

 

As FBX is a foundational technology and is not an open standard, Autodesk needs to support developers if they want to see its continued use.  A pip-installable package would be a great start!

Message 14 of 17

robear99
Community Visitor
Community Visitor

I am going on two weeks trying to get all this to work. Everytime I go to auto desk it is like different files are there. I currently have tried numerous different Python versions. I have vs 2019, so was attempting to use those sdk and python sdk files. As of now, if this is a workable item, someone show us. I install the Main SDK, no environment variables are made, I install the Python sdk for the fbx, and again, no environment variables, the bindings file requires Sip. There, that is 1.5 of my 2 weeks right there. Keep being told to go to some river site and download it. Yet every attempt to get it working fails, download the latest 6.7.7, that don't work. When I do a pip install sip, it installs 6.7.7, and no source *.sip files anywhere. No sip.exe. The one I get from the river site is a version 4.5 I think, the last working version 4, now no longer supported. That gives me a folder that actually has a configure.py file, the 6.7.7. Nope, bunch of files and no way to build it. As of now after two weeks, If I delete and uninstall everything and start over, I keep getting shot down at the sip stuff. Cannot complete the bindings without it. I have tried sever version 3.* versions of python, no 2s. SIck of this and truly believe Autodesk doesn't want anyone to get this work.

RS

Message 15 of 17

ellery
Participant
Participant

Here's what worked for me, and I tried it in a fresh copy of Windows 10 to be sure there weren't other factors at play.

 

  1. Install Python 3.7
  2. Install the FBX Python SDK 2020.3.2 (
    • I installed it in the default location:  C:\Program Files\Autodesk\FBX\FBX Python SDK
  3. Copy the 3 files from the FBX Python SDK lib dir
    • From dir: C:\Program Files\Autodesk\FBX\FBX Python SDK\2020.3.2\lib\Python37_x64
    • To dir: C:\Program Files\Python37\Lib\site-packages
    • The 3 files:  fbx.pyd, FbxCommon.py, fbxsip.pyd
  4. Install the Visual C++ Redistributable for Visual Studio 2015 (
    • Without this, I was getting the error:  "ImportError: DLL load failed: The specified module could not be found."

And, yes, I spent way too much time figuring this out.

Message 16 of 17

andrestronic12
Contributor
Contributor

Hi.

 

That works for me. I've had terrible problems on my computer, your steps work for me thank you

Message 17 of 17

claytonsrobot
Explorer
Explorer

 

My goal has been to build using "python install -r requirements.txt". My particular use-case is deploying a web app, on Vercel. Good news, this is actually the easiest way! Vercel uses Python 3.12 and spins up a Linux server. So, in my requirements.txt file, I have:

fbxsdkpy @ https://gitlab.inria.fr/api/v4/projects/18692/packages/pypi/files/b69fbe69fe954e29462a4f79689193abdf... ; python_version=='3.12' and (sys_platform=='linux' or sys_platform=='linux2' or sys_platform=='linux3')

 

You can learn more here: https://github.com/git-kinetix/fbxsdk_python.

 

The package name "fbxsdkpy" differs, but the "import fbx" Python command will function the same in your code.


At the connected Gitlab pypi directory, there are several wheel files, for various Python versions, for Linux and for Windows amd64. I have tested all of the wheels and the tar.gz versions as well and unfortunately, I have only succeeded using the 3.12 Linux wheel.

 

Therefore, if you want to be able to install the packages from scratch on each deployment using a requirements.txt file, for deploying to the web as well as running locally inside of a virtual environment, I recommend running on Linux with Python 3.12. I have accomplished this as a Windows user by running WSL2 (Windows Subsystem for Linux).

It is not required that all of my packages be build from the requirements.txt file for my local machine. So, I have also used the Windows installation method clarified by @ellery in order to be able to use the FBX SDK for Python when launching my Django server in localhost from the Windows side. It is annoying that it cannot build from a pip package on the fly. It is also annoying that the WSL side requires Python 3.12, while the Windows side requires Python 3.10. Managing this is fine using pyenv.

0 Likes