Building PyISAPIe against Python 2.7 in 64bit

334 views
Skip to first unread message

jamescrowley

unread,
Sep 1, 2010, 4:51:16 AM9/1/10
to PyISAPIe
Hi guys,

I've checked out the latest version from SVN and am trying to get this
working in 64bit against Python 2.7? Does anyone know if this is
possible? Huge thanks to geographika and his instructions at
http://geographika.co.uk/compiling-a-64-bit-version-of-pyisapie which
I used as a basis.

This is what I've done so far:

- defined a new #define PY_27 (270) constant
- added new condition to include header files from Python27 folder (in
line with the others)
- switched to the x64 build configuration
- defined preprocessor constants for _WIN64;_AMD64_; and
PYI_PY_VERSION=PY_27; .... the 64 constants appeared to be necessary
having looked at the python header files?
- added "$(SolutionDir)\Python\x64\Python27\libs" to the list of
additional library directories for the linker
- copied python27 installation files to Python\x64 folder

All builds fine (I'm on a x64 Windows 7 machine), but when I come to
add to IIS 7 following the instructions here: http://geographika.co.uk/setting-up-python-on-iis7
I'm getting a

The specified module could not be found. (0x8007007e)

error. I suspected a permissions error whenever trying to load a .py
file in the browser (renaming the dll results in a slightly different
error). However, I've basically given every user full access to that
file and it still won't work... so I'm wondering if it's a binding
issue with the 2.7 libraries?

Does anyone have any ideas how I can track this down further?

Many thanks!

James

Phillip Sitbon

unread,
Sep 1, 2010, 1:27:15 PM9/1/10
to pyis...@googlegroups.com
Two guesses:

- You don't have 2.7 x64 "properly" installed (via the installer), or maybe
- The app pool is set to 32-bit instead of 64.

Hope one of those makes it an easy fix.

It's been building in 64-bit from SVN for a while now (the next
release has been very slow to get done), but I don't usually recommend
people change the source to get it working for them, not that you've
done anything extreme to get 2.7 working. Go look at the current
checkin, which actually has 2.7 support along with a few fixes. Also,
I am moving to VS2010 exclusively, partly because it's better and
partly because I don't want to have two development environments on
top of all the other permutations. So, just a warning if you see the
.vcproj file missing.

Cheers,

Phillip

> --
> You received this message because you are subscribed to the Google Groups "PyISAPIe" group.
> To post to this group, send email to pyis...@googlegroups.com.
> To unsubscribe from this group, send email to pyisapie+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pyisapie?hl=en.
>
>

James Crowley

unread,
Sep 1, 2010, 1:38:11 PM9/1/10
to pyis...@googlegroups.com
Hi Phillip,

Cheers for the response. 2.7 x64 was installed via the Windows MSI installer, and the app pool is definitely running in 64 bit mode, so unfortunately as far as I can tell all is good on that front.

Working on VS2010 anyway so that's all good - will take your updates and dump mine! Do I actually need to set any different preprocessor directives to build for 64 bit? The configurations you've got set up don't seem to have anything set differently, but as far as I could tell from the header files, it did need _WIN64 and _AMD64_ set? Am I barking up the wrong tree?

Many thanks

James
--

---
James Crowley
CEO, developerFusion - the global developer community - http://www.developerfusion.com/
CTO, TechEye - all the technology news unfit for print - http://www.techeye.net/

linkedin: http://linkedin.com/in/jamescrowley
twitter: http://twitter.com/jamescrowley

Phillip

unread,
Sep 1, 2010, 2:03:16 PM9/1/10
to PyISAPIe
Sorry to hear my ideas were a bust. I'll have more time this afternoon
to puzzle it out.

For building my code- you'll need to double-check the default
preprocessor PYI_PY_VERSION and make sure it's PY_27. Also, you don't
have to worry about the _WIN64 et al. preprocessor defines, just set
the build platform to Release/x64 and let it do its thing.

The error you're having is the least informational and can happen in
way too many cases... so I'm at a loss for now. It could be
dependencies, or permissions, or configuration. Let me know if you get
anything different with the SVN code.

Phillip


On Sep 1, 10:38 am, James Crowley <james.crow...@gmail.com> wrote:
> Hi Phillip,
>
> Cheers for the response. 2.7 x64 was installed via the Windows MSI
> installer, and the app pool is definitely running in 64 bit mode, so
> unfortunately as far as I can tell all is good on that front.
>
> Working on VS2010 anyway so that's all good - will take your updates and
> dump mine! Do I actually need to set any different preprocessor directives
> to build for 64 bit? The configurations you've got set up don't seem to have
> anything set differently, but as far as I could tell from the header files,
> it did need _WIN64 and _AMD64_ set? Am I barking up the wrong tree?
>
> Many thanks
>
> James
>
> On 1 September 2010 18:27, Phillip Sitbon <phil...@sitbon.net> wrote:
>
>
>
>
>
> > Two guesses:
>
> > - You don't have 2.7 x64 "properly" installed (via the installer), or maybe
> > - The app pool is set to 32-bit instead of 64.
>
> > Hope one of those makes it an easy fix.
>
> > It's been building in 64-bit from SVN for a while now (the next
> > release has been very slow to get done), but I don't usually recommend
> > people change the source to get it working for them, not that you've
> > done anything extreme to get 2.7 working. Go look at the current
> > checkin, which actually has 2.7 support along with a few fixes. Also,
> > I am moving to VS2010 exclusively, partly because it's better and
> > partly because I don't want to have two development environments on
> > top of all the other permutations. So, just a warning if you see the
> > .vcproj file missing.
>
> > Cheers,
>
> > Phillip
>
> > On Wed, Sep 1, 2010 at 1:51 AM, jamescrowley <james.crow...@gmail.com>
> > pyisapie+u...@googlegroups.com<pyisapie%2Bunsubscribe@googlegroups.c om>
> > .
> > > For more options, visit this group at
> >http://groups.google.com/group/pyisapie?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "PyISAPIe" group.
> > To post to this group, send email to pyis...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > pyisapie+u...@googlegroups.com<pyisapie%2Bunsubscribe@googlegroups.c om>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/pyisapie?hl=en.
>
> --
>
> ---
> James Crowley
> CEO, developerFusion - the global developer community -http://www.developerfusion.com/
> CTO, TechEye - all the technology news unfit for print -http://www.techeye.net/

James Crowley

unread,
Sep 1, 2010, 2:22:20 PM9/1/10
to pyis...@googlegroups.com
Phillip - was hoping they weren't - much easier for both of us :D

Just tried checking out a fresh version from SVN, switched to x64, copied in the x64 Python27 files and built. Same thing happens.

As a sense check, I tried downloading the pre-compiled version for 2.5.4 from here: http://geographika.co.uk/compiling-a-64-bit-version-of-pyisapie (linked in the comments) and it ran against Python 2.5.4 fine, in the same set up. Well, the ISAPI filter worked. Some other weird issues with ctypes missing from that particular x64 install, but Python was clearly running!

Would you mind maybe sending me a pre-compiled version at your end for 2.7 - if that's a version you can easily build, just to check there's nothing weird going on at my compilation end?

Thanks for your assistance :)

James

To unsubscribe from this group, send email to pyisapie+u...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/pyisapie?hl=en.




--

---
James Crowley
CEO, developerFusion - the global developer community - http://www.developerfusion.com/
CTO, TechEye - all the technology news unfit for print - http://www.techeye.net/

Phillip Sitbon

unread,
Sep 1, 2010, 3:04:46 PM9/1/10
to pyis...@googlegroups.com
I'm sending you the DLL off-list just because I'd rather.

I just tested a very fresh setup. I enabled all the necessary IIS
features on my recently-installed Windows 7 Ultimate laptop and only
added the handler mapping for PyISAPIe, which was in its own folder
along with the Http package. I had Info.py in the web root folder, and
everything ran perfectly on the first go. Here's the version info both
for PyISAPIe and Python that you will hopefully, eventually see:

Version.Full 1.1.0.201 64bit Python-2.7 [Sep 1 2010]
sys.version 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)]

Hope this helps you track down the problem (is that your Python
sys.version too?). I'm not so sure Visual Studio is going to be
messing up, but this way you can be sure.

Phillip

James Crowley

unread,
Sep 1, 2010, 4:21:54 PM9/1/10
to pyis...@googlegroups.com
Phillip, I must be doing something really stupid here, but I can't for the life of me see what. I'm just trying locally here (x64 Windows 7 Ultimate) instead of the server (x64 Win2008), and still getting the same problem. Could you just sense check the steps I've taken?

1. Installed python.2.7.amd64.msi from http://www.python.org/ftp/python/2.7/python-2.7.amd64.msi. Running python.exe displays the same sys version as yours.
2. Created a directory called PyISAPIe in the Python installation folder (C:\Program Files\Python27) and place your DLL in there. Given read permissions to IUSR and Network Service (also tried every other account I can find and given that full control!!) to the DLL.
3. Added the Http package to the C:\Program Files\Python27\Lib\site-packages folder
4. Created a brand new app pool and website, taking all the defaults (Enable 32 bit applications=False, Identity=Application Pool Identity, LoadUserProfile=False)
5. Added a handler mapping for .py extensions pointing to C:\Program Files\Python27\Pyisapie\PyISAPIe.dll, with no request restrictions
6. Placed Info.py in the web root folder
7. Visited http://localhost/info.py and get the same 500 error (code 0x8007007e).

Can you see what I'm missing?

Everything points to a permission error, but the fact it seemed to work with Python25 with the same process means I'm kinda stumped at this point.

Thanks so much for your patience with this!

James

James Crowley

unread,
Sep 1, 2010, 6:03:09 PM9/1/10
to pyis...@googlegroups.com
Okay, so I tracked down the various issues at play here, and it's working!

1. On my desktop, for some reason Python didn't add any PATH or registry values. So it was loading the ISAPI dll but failing to find the Python library.
2. On the server, the registry values were there (weird). However, there were no 2008/2010 VC++ runtimes installed for x64 (I think it needed VS 2008 versions for Python, and VS 2010 versions for your DLL).

The Process Monitor tool (http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx) which allowed me to see what file accesses were going on (hat tip to geographika for the suggestion).

Thanks for your help Phillip :)

James
Reply all
Reply to author
Forward
0 new messages