Trouble with maya 2013 and python image library

we recently upgraded to maya 2013 from 2012 and I am having trouble getting PIL to work.
I am getting the (quite common) error message:

ImportError: The _imaging C module is not installed

Both maya 2012 and 2013 are 64-bit, and both are using python 2.6.4. I checked my Path, and ensured that “_imaging.pyd” is present and on the path.

I ran “mayapy.exe” in command-line mode with verbosity on, and sure enough, mayapy from 2013 cannot import “_imaging”, but 2012 can.

What could I have missed during the upgrade process that would cause this kind of problem?

What happens if you try to import the _imaging module directly?

from within maya:

# Error: DLL load failed: The specified module could not be found.
# Traceback (most recent call last):
#   File "<maya console>", line 1, in <module>
# ImportError: DLL load failed: The specified module could not be found. # 

from mayapy.exe (2013):

>>> import _imaging
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.

Make sure that the system PATH variable is the same in both cases. I typically like to debug this kind of stuff by firing up Maya, and running the MEL command

system(“start cmd”)

The command prompt that is created will inherit the Maya environment. From here you can inspect all the system variables by redirecting the output of the SET command to a text file like this:

set >c:\set.txt

Then do the same thing from the other Maya version and compare the two. I suggest sorting the output first using Notepad++'s TextFX>>TextFX Tools>>Sort Lines Case Insensitive so that diffing is easier. On that note, load the two in the diff utility of your choice to make this easier.

I tried your suggestion, and besides the expected diffs between “2012” and “2013”, i didn’t see anything (readily obvious) that would indicate why python in maya 2013 can’t locate the “_imaging.pyd” file.

got a couple of programmers to help out, still no luck getting it to run, but we did get some additional information when it fails.

a programmer got the “C Run-Time Error R6034” error, which is related to the Visual Studio redists and manifests.
http://msdn.microsoft.com/en-us/library/ms235560(v=vs.80).aspx

when i download the 2008 redist and put it on the pythonpath, i get this error when trying to import _imaging using mayapy.exe for 2013:

>>> import _imaging
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

Try using depends to see what dll it is trying to use. The most common case is that people compiled a debug executable and forgot to package the msvcr***.dll with the library.

http://www.dependencywalker.com/

You may just need to install a different redist package depending on what version it was compiled with…

It is looking for MSVCR90.DLL. Maya 2012 is working just fine, as well as vanilla python26. weird that maya 2013 is failing. My gut is telling me its a path/env problem with 2013.

when i placed MSVCR90.DLL alongside mayapy, i get this error:

>>> import _imaging
import encodings.cp437 # loaded from Zip C:\Program Files\Autodesk\Maya2013\bin
python26.zip\encodings\cp437.pyc
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
ImportError: DLL load failed: %1 is not a valid Win32 application.

Looks like PIL is gonna have to be re-compiled against Visual Studio 2010 to be compatible with Maya 2013.

http://grokbase.com/p/python/image-sig/118js6g1e3/help-with-pil-on-64-bit-windows-7-and-maya

I’m thinking that is going to affect a lot more than just PIL.

ouchy.

Now pushing my mental 2013 rollout plans a little farther back on their mental shelf. (and putting away my mental step ladder)

Having said that, this all seems solvable, just tedious and fraught with missteps.

thanks guys! I guess I can skip messing around with trying to get our 2012 python stuff running on 2013 and jump to recompiling things… saves me at least some work

WOW! This is incredible. I understand the decision (wrong as it may be) but I find this pretty awful, especially in terms of communication. Wow.

The irony being, of course, the upgrade from 2008 to 2010 allowed their devs access to better tools, while making their third party devs (us) suffer.

I’m going to guess that they didn’t even realize that this was a problem until they had done the switch (if they ever realized it at all).

We’ve done this in house and it’s sort of impossible to do it accidentally…

Iv’e got a case open with Autodesk regarding this issue, but I was wondering if anyone has recompiled pywin 2.6 with vs2010 and wouldn’t mind sharing?

I would love to get the site-packages folder so I could move to 2013!

[QUOTE=rgkovach123;17287]got a couple of programmers to help out, still no luck getting it to run, but we did get some additional information when it fails.

a programmer got the “C Run-Time Error R6034” error, which is related to the Visual Studio redists and manifests.
http://msdn.microsoft.com/en-us/library/ms235560(v=vs.80).aspx

when i download the 2008 redist and put it on the pythonpath, i get this error when trying to import _imaging using mayapy.exe for 2013:

>>> import _imaging
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

[/QUOTE]

Works perfectly fine here with the package from:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil

Not sure why this is an “ZOMG I’m on fire” issue.

It just needs a recompile (worst case) or getting one already recompiled.

Also, its not only a Maya issue. Nuke 6.2v* + ImageMagic has the same problem.

Not that I like AD just “doing it”, but… far from the end of the world.

[QUOTE=Zach Gray;17797]Iv’e got a case open with Autodesk regarding this issue, but I was wondering if anyone has recompiled pywin 2.6 with vs2010 and wouldn’t mind sharing?

I would love to get the site-packages folder so I could move to 2013![/QUOTE]

pywin 2.6x64 via 2010 also on the site I linked above. Using it here as well.

Cheers.

It isn’t that simple. Let’s say you have a large collection of libraries you share between several python 2.6 versions- now you need specially compiled ones for Maya. This is pain.