Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[GUIDE] How to install numpy+scipy in Maya Windows 64 bit?

14 REPLIES 14
Reply
Message 1 of 15
skuzee
28052 Views, 14 Replies

[GUIDE] How to install numpy+scipy in Maya Windows 64 bit?

I've seen a lot of queries about getting scipy working in Maya (Windows 64 bit) with a few not 100% reproducible answers.
 
So after a long personal struggle with the problem, here's my solution which will hopefully end the madness for all Windows Maya users:
 
 
TL;DR version
 
 
unzip them somewhere relevant to PYTHONPATH. Congratulations! You can now use scipy in all it's glory!
 
 
Long version
 
What you need is a fully functional Python interpreter compiled with MSVC2010. The steps for how to do that can be found here. Fortunately, the author not only explains the steps for how and why doing this is a good idea, but also provides pre-built binaries which is really nice of him. So go ahead and download the 2.7.10 64bit build and unzip it somewhere (I put mine here: "C:\Python27"). You can then use PIP to install a properly packaged Python wheels which should play nice with mayapy.
 
Python wheels are awesome because when properly packaged they don't require compilers to install C extensions. Unfortunately our new version of Python isn't part of the standard distribution, so existing "official" numpy and scipy wheels won't work for us. However, there are developers out there who have made custom wheels which will suit our needs. The one I used is made by "carlkl", a dev I've yet to directly contact to shower him with praise.
 
His builds use OpenBLAS, which I haven't benchmarked against builds made with Intel MLK, but they work fine for my needs and, I presume, most Maya users out there. To get the packages, find your new version of PIP you just installed (mine is at "C:\Python27\Scripts\pip.exe") and run these two commands:
 
 
Once PIP has installed *both* packages you can either point mayapy's PYTHONPATH to where PIP installed the packages, or copy them to "C:\Program Files\Autodesk\Maya20XX\Python\Lib\site-packages" or whatever location you keep your python modules. DO GRAB BOTH PACKAGES and don't mix and match scipy with a different builds of numpy or it will complain about DLL linking errors.
 
Congratulations, you're ready to rock!
 
Quick disclaimer: I recently noticed that running numpy.test() and scipy.test() *does* make mayapy crash, and i'm not entirely certain why but I do suspect it is benign. I've been using this build of scipy heavily in our tools and it's been stable and happy.
 
 
Cheers everyone!

 

Tags (3)
14 REPLIES 14
Message 2 of 15
SEVEZ
in reply to: skuzee

Thanks! It was very helpful )))
Message 3 of 15
Anonymous
in reply to: skuzee

Thanks! it was really helpful and saved so much time for me.

Message 4 of 15
Anonymous
in reply to: skuzee


When i try to import numpy in MAYA i am getting an error.

# Error: ImportError: file C:\Program Files\Autodesk\Maya2018\Python\lib\site-packages\numpy\core\__init__.py line 26: Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.

I have numpy 1.16.1; python 3.7

Numpy is already added to python path. C:\Program Files\Autodesk\Maya2018\Python\Lib\site-packages\numpy
I can import Numpy in cmd.  it says __init__.py line 26: Importing the multiarray numpy extension module failed..  
line 26 empty in the script..
I tried to reinstall numpy many times.  I'm beginner in MAYA and Python.
I'd be grateful for help.

Tags (3)
Message 5 of 15
Anonymous
in reply to: skuzee


When i try to import numpy in MAYA i am getting an error.

# Error: ImportError: file C:\Program Files\Autodesk\Maya2018\Python\lib\site-packages\numpy\core\__init__.py line 26: Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.

I have numpy 1.16.1; python 3.7

Numpy is already added to python path. C:\Program Files\Autodesk\Maya2018\Python\Lib\site-packages\numpy
I can import Numpy in cmd.  it says __init__.py line 26: Importing the multiarray numpy extension module failed..  
line 26 empty in the script..
I tried to reinstall numpy many times.  I'm beginner in MAYA and Python.
I'd be grateful for help.

Tags (3)
Message 6 of 15
Anonymous
in reply to: Anonymous

@Anonymous :

 

I personally haven’t tried this yet (not using Windows, and I’m comfortable building these kinds of packages), but right off the bat you are using a Python 3.7 compatible module, which will have a 99.9% chance of not working with Maya's Python. Internally, Maya uses 2.7.11 (or 14 in macOS) so you'll need to use the python27 wheel, not the python37 one.

 

Cheers,

Mike 

Message 7 of 15
skuzee
in reply to: Anonymous

Hey there,

 

This is an old post. But to get you started refer to this one instead.

In it you'll find this google drive link , all the modules in there i compiled for Maya 2018. They seem to work on older versions as well but i give no guarantees. Follow the link and grab numpy (and scipy). Install the wheels (you can rename .whl to .zip and extract manually if you don't know how to install packages) and move the numpy directory somewhere that can be seen by Maya.

 

That should be it! Good luck!

Message 8 of 15
Anonymous
in reply to: Anonymous

Thanks for your advice - It was very helpful!

Message 9 of 15
Anonymous
in reply to: skuzee

Many thanks skuzee,  I installed Python 2.7.11 and your modules! It worked perfectly!

Message 10 of 15
forrest.brent
in reply to: skuzee

Thanks to this handy guide my life doesn't suck so hard anymore

Message 11 of 15
Anonymous
in reply to: skuzee

 I am a student learning about it and met a  question.I follow you step to download and copy the numpy package to D:\maya\Maya2018\Python\Lib\site-packages,and then run my python plugin in maya script editor ,it still has error which is  " ImportError: file D:\maya\Maya2018\Python\lib\numpy\__init__.py line 140: cannot import name _distributor_init # " ,it made me confused .I have tried many ways but  failed.I use win10 and python27.Hoping to your reply.


@skuzee wrote:
I've seen a lot of queries about getting scipy working in Maya (Windows 64 bit) with a few not 100% reproducible answers.
 
So after a long personal struggle with the problem, here's my solution which will hopefully end the madness for all Windows Maya users:
 
 
TL;DR version
 
 
unzip them somewhere relevant to PYTHONPATH. Congratulations! You can now use scipy in all it's glory!
 
 
Long version
 
What you need is a fully functional Python interpreter compiled with MSVC2010. The steps for how to do that can be found here. Fortunately, the author not only explains the steps for how and why doing this is a good idea, but also provides pre-built binaries which is really nice of him. So go ahead and download the 2.7.10 64bit build and unzip it somewhere (I put mine here: "C:\Python27"). You can then use PIP to install a properly packaged Python wheels which should play nice with mayapy.
 
Python wheels are awesome because when properly packaged they don't require compilers to install C extensions. Unfortunately our new version of Python isn't part of the standard distribution, so existing "official" numpy and scipy wheels won't work for us. However, there are developers out there who have made custom wheels which will suit our needs. The one I used is made by "carlkl", a dev I've yet to directly contact to shower him with praise.
 
His builds use OpenBLAS, which I haven't benchmarked against builds made with Intel MLK, but they work fine for my needs and, I presume, most Maya users out there. To get the packages, find your new version of PIP you just installed (mine is at "C:\Python27\Scripts\pip.exe") and run these two commands:
 
 
Once PIP has installed *both* packages you can either point mayapy's PYTHONPATH to where PIP installed the packages, or copy them to "C:\Program Files\Autodesk\Maya20XX\Python\Lib\site-packages" or whatever location you keep your python modules. DO GRAB BOTH PACKAGES and don't mix and match scipy with a different builds of numpy or it will complain about DLL linking errors.
 
Congratulations, you're ready to rock!
 
Quick disclaimer: I recently noticed that running numpy.test() and scipy.test() *does* make mayapy crash, and i'm not entirely certain why but I do suspect it is benign. I've been using this build of scipy heavily in our tools and it's been stable and happy.
 
 
Cheers everyone!

 


 

Message 12 of 15
Anonymous
in reply to: Anonymous

 I met the same question too. the error is about " ImportError: file D:\maya\Maya2018\Python\lib\numpy\__init__.py line 140: cannot import name _distributor_init # " ,and I want to know how do you solve your problem , I  have tried many ways but failed. Hoping to your reply.

Message 13 of 15
Nikolay_Makarov
in reply to: Anonymous

been there.

you should do as instruction says.
1) install python27(as expample)(37 dosn't work)
2) with python installer install libs from correct path ( 

pip install -i https://pypi.anaconda.org/carlkl/simple scipy
)
3) copy libs to site-package
4) profit
Message 14 of 15
Anonymous
in reply to: skuzee

skuzee's Google drive link saved me! worked like a charm for Maya 2019

Message 15 of 15

thanks, worked for me

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report