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 can be installed as an optional component with Maya. If you did not install PyMEL along 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 are installing PyMEL separately, you will need to install the most recent version of PyMEL that is compatible with Maya. For Maya 2023, this is PyMEL 1.3 and its update versions.

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.3.*,<1.4.*"

To install within your user space, run

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

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.3.*,<1.4.*"

To install within your user space, run

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

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.3.*,<1.4.*"

To install within your user space, run

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

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.