Autodesk 3ds Max ships with a pre-built version of PySide 2.0, and is the preferred library for using QT with Python in 3ds Max (see { Creating Python Uis }). You may install other CPython extension libraries as well. However, while every effort has been made to ensure that CPython extension libraries such as PyQt, SciPy, NumPy, PIL, and so forth work with Python in 3ds Max, Autodesk does not provide technical support for them.
3ds Max includes the standard version of Python 3. This version's binaries are compiled with VC15, matching 3ds Max and Max Batch, meaning they are binary compatible and most CPython extension libraries should work "out of the box". You simply need to use PIP to install them (see the instructions below).
The official binaries of Python 2.7 are compiled with Visual Studio 2008 (VC9.0), while 3ds Max 2021 (and its version of 3dsmaxpy.exe
) is compiled with Visual Studio 2017 toolset 1.41 (VC15.8.4). This means pre-compiled extension libraries Python are not binary compatible with 3ds Max, and you need to recompile CPython extension libraries for use with Python in 3ds Max with the more recent compiler. See the SDK Requirements topic in the 3ds Max Developer's Guide for specifics about the required Visual Studio and Windows toolset versions. Compiled extension libraries must then be placed at a location that can be found by Python. We recommend using pip to compile and install extension libraries.
Pip is a package management system for Python. It is useful for managing additional Python modules, including managing building modules from source (for example, NumPy). For libraries that contain pre-built binaries (such as zmq), these should work without recompilation with Python 3. With Python 2, you will need to obtain the source and re-build the binaries, replacing the ones installed by pip. By default, pip will try to use pre-built binaries. You can force pip to build from source with the --no-binary flag, and specifying a required version (see example below).
The pip
script is included with the 3ds Max Python 3 distribution as of 3ds Max 2021.1 Update. You can upgrade it to the most recent version by running python -m ensurepip --upgrade --user
from a command prompt.
To install a package, such as Pillow:
.\python.exe -m pip install --user pillow
Make sure you are executing the 3ds Max python.exe
, and not another version of python on your path. The -m
command-line argument runs pip as a module, and the --user
option ensures that the package is installed in your user directory rather than the 3ds Max Python directory.
Visual Studio 2017 (with VC15.0) must be installed to build libraries from source.
To install pip:
[3ds Max Install]
and run: .\3dsmaxpy.exe [script location]\get-pip.py --user
where [script_location] is the location you saved the get-pip.py script.<3ds Max Install>\scripts
directory. For example, to install Pillow, open a command prompt in [3ds Max Install]
and run: 3dsmaxpy.exe -m pip install --no-cache-dir --no-binary pillow pillow==5.0.0
. This will download, compile and install Pillow. Many CPython libraries have additional requirements. NumPy, for example, also requires a Fortran77 compiler, and has several additional dependencies. The Pillow example above requires Zlib
and libjpeg
(at minimum) be present on the system. Check the specific library's project page for information about any dependencies you will need to obtain.
Use the --no-cache-dir
option if Python is installed on your computer.
By default, 3dsmaxpy.exe
handles the case where there is a space in the path of the 3ds Max python install. You can disable this feature by setting an environment variable, \__disable_space_handling
to FALSE.