[GUIDE] How to install Scipy in Maya Windows 64 bit

560 views
Skip to first unread message

Eric Vignola

unread,
Aug 31, 2015, 6:23:52 PM8/31/15
to Python Programming for Autodesk Maya
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 interpreted 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 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!

hg...@locus.com

unread,
Jan 28, 2016, 4:08:08 AM1/28/16
to Python Programming for Autodesk Maya
I've got numpy for maya 2016 from your goole drive, thank you.
But I hope to find the way to build lots of python libraries to run in Maya 2016 and further. Would you mind to give some advice to build them with VS2010?

Marcus Ottosson

unread,
Jan 28, 2016, 4:43:49 AM1/28/16
to python_in...@googlegroups.com

There isn't much to it, really.

Whenever you see the instruction:

$ python configure.py

You replace it with:

$ /path/to/maya/bin/mayapy configure.py

And the rest is unchanged.

$ nmake
$ nmake install

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/ad9acede-ed04-4389-ba42-bed1d41515d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Eric Vignola

unread,
Feb 5, 2016, 11:18:04 PM2/5/16
to python_in...@googlegroups.com
Here are the basics:

1) Install Visual Studio 2010
2) Follow the long version of my instructions to get yourself a fully functional version Python compiled in VS2010. (mayapy doesn't come with pip)
3) When faced with a package with binary dependencies (ex: numpy), you'll need to build them from source. So get the source, open a shell, setup VS2010 environments by running vcvarsall.bat located under the 64bit folder of your VS2010 toolchain. And then launch "python setup.py build". If you have all the dependencies required, then you should be able to just compile the package.

Numpy you should be able to compile with the above steps with no  problems, then drop the result somewhere Maya is aware of and you're ready to go. Scipy is much more complex as it has Fortran dependencies that are difficult to configure. For that reason i chose to use the python wheels i discussed in my post.

Last bit of advice to everyone: if you want to make life easy for yourselves, just use Maya on OSX... All you have to do is append your system path like so:

import sys
sys.path.append(<path to site-packages>)

and you'll be swimming with all the python goodness you can dream of. For fun i just imported matplotlib, a package that's quite difficult to get working for Maya 64 bit Windows, and on OSX it was effortless.

cheers!





--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/yTOP-en1fDY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.

Marcus Ottosson

unread,
Feb 6, 2016, 4:14:52 AM2/6/16
to python_in...@googlegroups.com

2) Follow the long version of my instructions to get yourself a fully functional version Python compiled in VS2010. (mayapy doesn’t come with pip)

Or follow the short instructions on installing pip.


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CACv3nu45R8Mi%3DvaHrRN7m%2BuGEhyMBX_3eFxv_rh%2B7QjBU3e4BA%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Eric Vignola

unread,
Feb 6, 2016, 2:08:34 PM2/6/16
to python_in...@googlegroups.com
If this is purely for yourself, or you aren't developing anything that will run outside Maya, or you know for sure every user you support has Maya installed, then yes by all means stick with Marcus's way. (or move to OSX :P)

Marcus Ottosson

unread,
Feb 6, 2016, 2:57:11 PM2/6/16
to python_in...@googlegroups.com
What do you mean? If you aren't running it in Maya, just install it via pip. Don't bother compiling anything.

You seem to feel the need to defend your efforts made figuring this out, and I get it, sometimes what you don't know is what ends up costing you the most amount of time. But that's not reason enough to point others in the same obscure direction if there's an apparent quicker way to go at it.

Beyond that; Maya's Python might not be your off-the-shelf copy. Compiling a separate Python may leave you with a slightly different interpreter, and any libraries you compile with it might break in subtle ways. This is especially true if you compile PyQt.


For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Reply all
Reply to author
Forward
0 new messages