Installing and importing PyMEL

Note: PyMEL is developed and maintained by LUMA pictures. Autodesk does not directly support PyMEL.

PyMEL is an open-source Python library that helps with the development of Maya extensions by providing a simplified syntax for common operations.

PyMEL for Python 2 is packaged with Maya and PyMEL for Python 3 can be installed as an optional component with Maya.

If you did not install PyMEL for Python 3 with Maya, it can still be installed using the pip package manager. Consult the the pip user guide for the most up-to-date information about pip install.

If you choose to install PyMEL separately, you will need to ensure that the version you install is the most recent version of PyMEL that is compatible with Maya.

For Maya 2022, PyMEL 1.2 and its update versions are compatible with Maya.

By default, PyMEL will be installed in the Maya site-package directory. To install PyMEL to your user space, you will need to run the installation command with the --user option.

Note: If you do not have proper permissions to install in the Maya site-packages directory, packages will be installed in your user space.

To install the PyMEL package on Windows

From the command prompt, change directory to C:\Program Files\Autodesk\Maya<VersionNumber>\bin and run

mayapy -m pip install "pymel>=1.2.,<1.3."

To install within your user space, run

mayapy -m pip install --user "pymel>=1.2.,<1.3."

To install the PyMEL package on macOS

Open a terminal window, change directory to /Applications/Autodesk/maya<VersionNumber>/Maya.app/Contents/bin, and run:

sudo ./mayapy -m pip install "pymel>=1.2.,<1.3."

To install within your user space, run

./mayapy -m pip install --user "pymel>=1.2.,<1.3."

To install the PyMEL package on Linux

Open a terminal window, change directory to /usr/Autodesk/Maya<VersionNumber>/bin/, and run

sudo ./mayapy -m pip install "pymel>=1.2.,<1.3."

To install within your user space, run

./mayapy -m pip install --user "pymel>=1.2.,<1.3."

Use mayapy -m pip list to verify that PyMEL is installed.

To use the PyMEL library, open the Python Script Editor and execute the following command:

import pymel.core as pm

Once you have imported the PyMEL library, you can use the PyMEL commands. For example, you can create a sphere:

s = pm.sphere()

To uninstall PyMEL, use mayapy -m pip uninstall pymel. You will need Administrator privileges on Windows, and super user privileges on macOS and Linux to uninstall PyMEL if it was installed in Maya's site-packages directory.