Can i Use pip in maya script editor ?

Can i Use pip in maya script editor ?

Anonymous
Not applicable
7,523 Views
7 Replies
Message 1 of 8

Can i Use pip in maya script editor ?

Anonymous
Not applicable

Can i Use pip in maya script editor ? If no then HOw to install any python package in Maya ?

0 Likes
Accepted solutions (1)
7,524 Views
7 Replies
Replies (7)
Message 2 of 8

cheng_xi_li
Autodesk Support
Autodesk Support
Accepted solution

Hi,

 

You can't use pip directly. You have to build the package and copy it to python\lib\site-packages.

 

Yours,

Li

0 Likes
Message 3 of 8

Anonymous
Not applicable

Even though this is years after the original question, this hit comes up when trying to use pip with maya and I didn't find any other instructions.

 

Fortunately, you CAN install pip and use it with maya!  I've only done it with 2017 so far but image it will be the same for other versions.

 

1 - Download get-py.py from https://pip.pypa.io/en/stable/installing/ 

2 - Open a commandline to mayapy.exe (Generally in AutoDesk\Maya\20XX\bin) and run the file:

...Maya\2017\bin mayapy.exe get-pip.py

3 - It should run without any errors, and it will have added Autodesk\Maya\20xx\Python\Scripts\pip.exe

4 - Use this pip, just like a normal python install!  Similarly, it places things in Autodesk\Maya20XX\Python\Lib\site-packages

 

So far most things seem to work correctly, like pytest, but jupyter doesn't.

Message 4 of 8

jencruz93
Participant
Participant

How do you create a pip package?

0 Likes
Message 5 of 8

2232549876
Community Visitor
Community Visitor

I tried this,but an error reported:

Could not find a version that satisfies the requirement pip (from version None)

0 Likes
Message 6 of 8

Anonymous
Not applicable

Notice that for Maya 2019, for example, you'll need an older version of the "get-pip.py"  script than the one that pops up on a noraml google search. You'd need this pip version of python 2.6: 

https://bootstrap.pypa.io/2.6/get-pip.py

0 Likes
Message 7 of 8

Anonymous
Not applicable

Also make sure you run the commands using Maya's python interpreter, like so:

 

From windows commandline/run : navigate to where mayapy.exe is located:

C:\> cd C:\Program Files\Autodesk\Maya2019\bin

 

put the get-pip.py file in that same folder, then run it via mayapy:

C:\Program Files\Autodesk\Maya2019\bin> mayapy.exe get-pip.py

 

Example of using pip to install a python package like numpy

C:\Program Files\Autodesk\Maya2019\bin>mayapy.exe -m pip install numpy

0 Likes
Message 8 of 8

Anonymous
Not applicable

btw, you can find out where your mayapy.exe is installed by running this in a python tab inside Maya:

import sys
print(sys.executable)

0 Likes