| Issue 126: | Can't import pyodbc when using mod_wsgi | |
| 15 people starred this issue and may be notified of changes. | Back to list |
What steps will reproduce the problem? Use any wsgi-file (the wsgi-sample will do) and put "import pyodbc" on top of it. What is the expected output? What do you see instead? I would expect that pyodbc gets imported. But instead an import error occurs - saying that the module could not be found. What version of the product are you using? On what operating system? Windows 7, Apache 2.2.16, Python 2.7, mod_wsgi 3.3, pyodbc 2.1.8. Also happens with different configurations on other windows machines (different os, apache and python). Please provide any additional information below. Maybe it has something to do with pyodbc binaries on windows because other non binary modules get imported correctly. This is a fresh system and afaicr i did nothing beside the obvious installation steps. The wsgi-sample and other wsgi-stuff works fine.
Nov 21, 2010
(No comment was entered for this change.)
Status:
Hold
Labels: Python2
Feb 21, 2011
maybe it's related to this: http://stackoverflow.com/questions/3706293/why-do-no-python-dlls-built-with-msvc-load-with-mod-wsgi
Mar 27, 2011
I got the same problem when I using apache+wsgi+pyodbc2.1.8, but the pyodbc2.1.7 works for me.
Then I compareed the two version, I found the section in 2.1.7
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
is become to
<dependency>
</dependency>
I think that would be the issue.
Mar 29, 2011
I don't see how this could be an Apache configuration issue. I'm using the standard configuration + wsgi (about 3 lines added to httpd.conf). I tried pyodbc 2.1.7 with no luck. I also tried prebuilt binaries for other software that was built using MinGW and these get imported fine. I checked the pyodbc binaries using Dependency Walker and it said that MSVCR90.DLL was missing. So i tried pyodbc 2.1.7 again using version 9.0.21022.8 of MSVCR90.DLL. On import i get an import error message directly from apache: --------------------------- Microsoft Visual C++ Runtime Library --------------------------- Runtime Error! Program: C:\Progr... R6034 An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information. --------------------------- I really don't get it - i mean - it's the correct DLL, right?
Apr 25, 2011
I'm stuck at the same point. Slightly different configuration:
Win XP Pro; Python 2.6.5; Apache 2.2.16; PyODBC 2.1.8; WSGI 3.3 ("mod_wsgi-win32-ap22py26-3.3.so")
This post seems to be relevant:
http://groups.google.com/group/modwsgi/browse_thread/thread/13b4a5faa962d77/dd4d6a03afbe16b6
... but I'm stuck, as I really have very little experience in building anything in C under Windows. According to that post: I have to install Mingw32, and rebuild... what? PyODBC? mod_wsgi?
Can the Windows version of [PyODBC | mod_wsgi] just be built that way all the time?
-- Dan
Apr 25, 2011
I always build pyodbc with MinGW. It looks impossible to make pyodbc find MSVCR90.DLL. It's terrible. Does anybody know what should I do to run pyodbc normally under Apache in Windows? From Python shell it works fine. Also I have the same problem with many releases of lxml.etree. Only lxml-2.2.2 works without building with MinGW. I think the reason for this is incorrect dependency information. Alexander.
May 17, 2011
http://groups.google.com/group/isapi_wsgi-dev/browse_thread/thread/03fa2b485ec2281d I believe this issue may be related to the msvc9compiler.py issues mentioned in the above link. If so, this is really an issue in Python itself, but a workaround may be found by tweaking msvc9compiler.py to remove the Visual C runtime info from the DLL's manifest. This let me get pyODBC working under IIS / isapi. I've attached my modified copy of msvc9compiler.py in case it helps.
Jul 14, 2011
Using Python 2.7, mod_wsgi 3.3, Apache 2.2, pyodbc 2.1.8 Comment #8 seems to have helped me. What didn't help: * pyodbc 2.1.7 * Python 2.6 * older mod_wsgi, build from http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi * building with mingw32 Attached build is what worked for me.
Oct 4, 2011
I know this is late, but I've been wrestling with this for months. The specific problem is with mod_wsgi and apache, not pyodbc or python. The quickest way to fix this issue is to download Apache built with vc9 C++ binaries. You can find it here: http://www.apachelounge.com/download/ However, I was using xampp which just recently (about two weeks from the time of writing this) has released their new package (1.7.7) which contains Apache 2.2 built with the new vc9 C++ binaries. You can find it here (all of the windows binaries are built with vc9): http://www.apachefriends.org/en/xampp-windows.html Both options above will get you back up and working. Once I installed, I placed my modules in the modules dir and modified the httpd.conf and I was able to import and use pyodbc. Thanks, Daniel Kleehammer
Oct 6, 2011
Please see issue 214. |
Labels: -Type-Defect -Priority-Medium Type-Other Priority-Low