How do I add a directory to mayapy's PATH?

How do I add a directory to mayapy's PATH?

kathal-2
Advocate Advocate
1,044 Views
3 Replies
Message 1 of 4

How do I add a directory to mayapy's PATH?

kathal-2
Advocate
Advocate

Hey! I'm trying to use a plugin that's dependent on numpy. I'm doing so through pip, so that I can install other dependencies should any come up later.

 

I opened Windows Terminal and ran

 

pip install numpy

 

which successfully installed numpy, but it looks like I need to install numpy specifically for mayapy.exe.

 

I followed this forum post and downloaded get-pip.py from here. However, when I try running get-pip.py in mayapy.exe as administrator, I get the following error:

 

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'get' is not defined

 

kathal2_0-1687358079635.png

get-pip.py is in the same directory as mayapy.exe.

 

I also tried dragging get-pip.py into mayapy.exe. A terminal window briefly opened, and I was able to screenshot it:

kathal2_1-1687358879557.png

If I'm not mistaken, it looks like pip is already installed, but the directory that it's installed in isn't on mayapy.exe's PATH. How can I add it?

0 Likes
Accepted solutions (1)
1,045 Views
3 Replies
Replies (3)
Message 2 of 4

kathal-2
Advocate
Advocate

Update: I added mayapy.exe and the pip installation directory to my PATH using this tutorial,

kathal2_0-1687633736453.png

...But mayapy still doesn't recognize the command.

kathal2_2-1687633887437.png

 

Is there anything else I should be doing?

0 Likes
Message 3 of 4

kathal-2
Advocate
Advocate
Accepted solution

After studying a bit of code (C++), I've obtained a more solid understanding of what exactly PATH is.

 

I recently learned that pip is part of virtually every Python installation. The issue wasn't that pip wasn't installed, it was that I was attempting to run pip directly within mayapy.exe rather than my system's terminal.

 

Here's what I did: I added C:\Program Files\Autodesk\Maya2024\bin to my system's PATH, opened a terminal window as an administrator, and ran

 

mayapy -m pip install numpy

 

That fixed it. If anyone reading this encounters an error during that last step, try navigating to mayapy's directory with

 

cd C:\Program Files\Autodesk\Maya2024\bin

 

Your PATH probably hasn't updated yet, it takes a few minutes to kick in.

 

I hope this helps someone out in the future, not having numpy installed has been a huge pain when attempting to use Maya/Nuke plugins and I think I've finally figured it out.

Message 4 of 4

kdotrant
Explorer
Explorer

Thanks for the detailed breakdown! Really helpful!

0 Likes