building python extensions with .net sdk compiler?

A

Anthony Baxter

I'm trying to build a binary of fastaudio (the wrapper for the PortAudio
library, from http://www.freenet.org.nz/python/pyPortAudio/) for Python 2.3.
There's a lot of FAQs and the like out there that give some simple directions,
involving fetching the .net sdk from MSDN and distutils "should work" -
however, when I follow them and try to do the setup.py build step, I get
a message:
error: Python was built with version 6 of Visual Studio, and extensions need
to be built with the same version of the compiler, but it isn't installed.

Argh. All I want is a simple way to say 'give me a binary object that I can
drop into my site-packages directory'. Is there a way, or am I screwed?

Anthony
 
Z

Zuurcool

Anthony said:
I'm trying to build a binary of fastaudio (the wrapper for the PortAudio
library, from http://www.freenet.org.nz/python/pyPortAudio/) for Python 2.3.
There's a lot of FAQs and the like out there that give some simple directions,
involving fetching the .net sdk from MSDN and distutils "should work" -
however, when I follow them and try to do the setup.py build step, I get
a message:
error: Python was built with version 6 of Visual Studio, and extensions need
to be built with the same version of the compiler, but it isn't installed.

Hello Anthony,

I got this insane message, how did you solve this "problem" ?

------------
running install
running build
running build_py
running build_ext
error: The .NET Framework SDK needs to be installed before building
extensions for Python.
-------------

Or does anyone know why i get this message, the .net sdk is about 100Mb,
no fun !

Zuurcool.
 
G

Grumman

I got this insane message, how did you solve this "problem" ?
------------
running install
running build
running build_py
running build_ext
error: The .NET Framework SDK needs to be installed before building
extensions for Python.

The message says what it says. You have to install the .net SDK to use
this. You'll also need the Platform SDK if you don't have it already
installed. (And its a *lot* bigger than the .net sdk)

And then you'll find out that you either need to hack
distutils/msvccompiler.py, or your registry.
 
D

David Fraser

Grumman said:
The message says what it says. You have to install the .net SDK to use
this. You'll also need the Platform SDK if you don't have it already
installed. (And its a *lot* bigger than the .net sdk)

And then you'll find out that you either need to hack
distutils/msvccompiler.py, or your registry.

So using MinGW seems like the better option ... is it working for Python
2.4?

David
 
G

Grumman

David said:
So using MinGW seems like the better option ... is it working for Python
2.4?

Yes it does. :) I haven't tried it, but probably.

The problem with the toolkit is that mscvccompiler.py in distutils is
expecting VisualStudio to be installed, not the toolkit. So when it goes
to lookup paths to the installed tools, it doesn't find them.

All that's actually needed to make it work (After installing all 4
required packages) is to add several strings to your registry. You'll
probably have to add all the keys below \Software\Microsoft as well.

Under :
HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\7.1\VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directories

You need to add the strings:
"Include Dirs"(path to toolkit \include; path to platform sdk \include)
"Library Dirs"(path to toolkit \lib; path to platform sdk \lib)
"Path Dirs" (path to toolkit \bin; path to platform sdk \bin)

And it'll be happy.

Of course it'd be nice if msvccompiler.py just fell back to looking for
the toolkit/sdk default dirs (or looked them up via environment vars,
since the toolkit does include a vcvars32.bat that sets appropriate
ones) if the VS lookup failed.
 
M

Mike C. Fletcher

Grumman said:
....

Of course it'd be nice if msvccompiler.py just fell back to looking
for the toolkit/sdk default dirs (or looked them up via environment
vars, since the toolkit does include a vcvars32.bat that sets
appropriate ones) if the VS lookup failed.

Which is what the patch here:
http://www.vrplumber.com/programming/mstoolkit/
does.

Have fun,
Mike

________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top