Thread: Building on Win7 x64 for python2.6.4 x64 DLL load failed Error
Hi,
I am trying to build psycopg2 for a version of python that is packaged with the 3D creation package Maya (version 2013). I can build and install psycopg2 to the python install but when load the module I get the following error;
# Error: ImportError: file C:\Program Files\Autodesk\Maya2013\Python\lib\site-packages\psycopg2\__init__.py line 50: DLL load failed: %1 is not a valid Win32 application. #
My build process is;
- Run the x64 VS9 build environment setup script
- Build the cextenstion, including the right libs and headers; "C:\Program Files\Autodesk\Maya2013\bin\mayapy.exe" setup.py build_ext -"IC:\Program Files\Autodesk\Maya2013\include\python2.6" -"LC:\Program Files\Autodesk\Maya2013\lib"
- Build the rest of the module
- Install
Oops, I didn't mean to send that then.
That was basically all I needed to say though.
Thanks,
Jack
On 28 November 2013 17:26, Jack Straw <jack.straw@saddingtonbaynes.com> wrote:
Hi,I am trying to build psycopg2 for a version of python that is packaged with the 3D creation package Maya (version 2013). I can build and install psycopg2 to the python install but when load the module I get the following error;# Error: ImportError: file C:\Program Files\Autodesk\Maya2013\Python\lib\site-packages\psycopg2\__init__.py line 50: DLL load failed: %1 is not a valid Win32 application. #My build process is;
- Run the x64 VS9 build environment setup script
- Build the cextenstion, including the right libs and headers; "C:\Program Files\Autodesk\Maya2013\bin\mayapy.exe" setup.py build_ext -"IC:\Program Files\Autodesk\Maya2013\include\python2.6" -"LC:\Program Files\Autodesk\Maya2013\lib"
- Build the rest of the module
- Install
On Thu, Nov 28, 2013 at 5:26 PM, Jack Straw <jack.straw@saddingtonbaynes.com> wrote: > Hi, > > I am trying to build psycopg2 for a version of python that is packaged with > the 3D creation package Maya (version 2013). I can build and install > psycopg2 to the python install but when load the module I get the following > error; > > # Error: ImportError: file C:\Program > Files\Autodesk\Maya2013\Python\lib\site-packages\psycopg2\__init__.py line > 50: DLL load failed: %1 is not a valid Win32 application. # > > My build process is; > > Run the x64 VS9 build environment setup script > Build the cextenstion, including the right libs and headers; "C:\Program > Files\Autodesk\Maya2013\bin\mayapy.exe" setup.py build_ext -"IC:\Program > Files\Autodesk\Maya2013\include\python2.6" -"LC:\Program > Files\Autodesk\Maya2013\lib" > Build the rest of the module > Install Smells like a 32/64 bit mess-up between Maya, Python and the compiler. Googling "python DLL load failed: %1 is not a valid Win32 application" yields lots of result, for example http://stackoverflow.com/questions/4676433/solving-dll-load-failed-1-is-not-a-valid-win32-application-for-pygame Particularly interesting is this resource: http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg offering alternative win builds of psycopg. -- Daniele
It does smell like it but I cannot find the source of the smell. I'm definitely using x64 build tools, the Maya install is x64 and I have checked that the python is x64 (using "print("%x" % sys.maxsize, sys.maxsize > 2**32)").
Do you have any experience with Dependancy Walker? A lot of the links reference it to find the missing dependencies but I have no idea what to do with the information.
Jack
On 28 November 2013 17:41, Daniele Varrazzo <daniele.varrazzo@gmail.com> wrote:
Smells like a 32/64 bit mess-up between Maya, Python and the compiler.On Thu, Nov 28, 2013 at 5:26 PM, Jack Straw
<jack.straw@saddingtonbaynes.com> wrote:
> Hi,
>
> I am trying to build psycopg2 for a version of python that is packaged with
> the 3D creation package Maya (version 2013). I can build and install
> psycopg2 to the python install but when load the module I get the following
> error;
>
> # Error: ImportError: file C:\Program
> Files\Autodesk\Maya2013\Python\lib\site-packages\psycopg2\__init__.py line
> 50: DLL load failed: %1 is not a valid Win32 application. #
>
> My build process is;
>
> Run the x64 VS9 build environment setup script
> Build the cextenstion, including the right libs and headers; "C:\Program
> Files\Autodesk\Maya2013\bin\mayapy.exe" setup.py build_ext -"IC:\Program
> Files\Autodesk\Maya2013\include\python2.6" -"LC:\Program
> Files\Autodesk\Maya2013\lib"
> Build the rest of the module
> Install
Googling "python DLL load failed: %1 is not a valid Win32 application"
yields lots of result, for example
http://stackoverflow.com/questions/4676433/solving-dll-load-failed-1-is-not-a-valid-win32-application-for-pygame
Particularly interesting is this resource:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg
offering alternative win builds of psycopg.
-- Daniele
Windows and the various Python versions are always ....err.... challenging. In an embedded setup like this, if extensions are build with a different version of Visual C then the python interpreter, it can cause DLL load issues, which might be what we are seeing.
Few ideas:
* Can you look in the windows event log to see what DLL it is failing loading?
* Can you verify which compiler was used to build that version of python by opening up an interactive shell? Should be the first line, or 'sys.version'. Python 2.6's default compiler used VC 2008 (v.1500), which sounds like what you are trying to build against, but maybe they used a newer version to build Maya?
* Did you build the libpq.lib for linking, or was it part of a PostgreSQL distribution? At one time, the PostgreSQL distribution renamed the libpqdll.lib link library to the static version (libpq.lib). Not sure if that is still the case, but it might possible you need to have the libpq.dll placed in the location that the interpreter can find it if you built against a PostgreSQL distribution.
-jason
On Thu, Nov 28, 2013 at 10:58 AM, Jack Straw <jack.straw@saddingtonbaynes.com> wrote:
It does smell like it but I cannot find the source of the smell. I'm definitely using x64 build tools, the Maya install is x64 and I have checked that the python is x64 (using "print("%x" % sys.maxsize, sys.maxsize > 2**32)").Do you have any experience with Dependancy Walker? A lot of the links reference it to find the missing dependencies but I have no idea what to do with the information.JackOn 28 November 2013 17:41, Daniele Varrazzo <daniele.varrazzo@gmail.com> wrote:Smells like a 32/64 bit mess-up between Maya, Python and the compiler.On Thu, Nov 28, 2013 at 5:26 PM, Jack Straw
<jack.straw@saddingtonbaynes.com> wrote:
> Hi,
>
> I am trying to build psycopg2 for a version of python that is packaged with
> the 3D creation package Maya (version 2013). I can build and install
> psycopg2 to the python install but when load the module I get the following
> error;
>
> # Error: ImportError: file C:\Program
> Files\Autodesk\Maya2013\Python\lib\site-packages\psycopg2\__init__.py line
> 50: DLL load failed: %1 is not a valid Win32 application. #
>
> My build process is;
>
> Run the x64 VS9 build environment setup script
> Build the cextenstion, including the right libs and headers; "C:\Program
> Files\Autodesk\Maya2013\bin\mayapy.exe" setup.py build_ext -"IC:\Program
> Files\Autodesk\Maya2013\include\python2.6" -"LC:\Program
> Files\Autodesk\Maya2013\lib"
> Build the rest of the module
> Install
Googling "python DLL load failed: %1 is not a valid Win32 application"
yields lots of result, for example
http://stackoverflow.com/questions/4676433/solving-dll-load-failed-1-is-not-a-valid-win32-application-for-pygame
Particularly interesting is this resource:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg
offering alternative win builds of psycopg.
-- Daniele
Jack, On 28/11/13 12:58, Jack Straw wrote: > Do you have any experience with Dependancy Walker? A lot of the links > reference it to find the missing dependencies but I have no idea what to > do with the information. I had some experience with Dependency Walker and Postgres, but in the context of plperl. FWIW, you may want to look here: https://pyrseas.wordpress.com/2012/10/17/testing-python-and-postgresql-on-windows-part-5/ Regards, Joe