[python-win32] building a complicated Python application on Windows

Trent Nelson trent at trent.me
Sat Dec 19 06:47:33 EST 2015


Heh, yeah, it's one of those things that's painful when you're going through it the first time, but once you get over the hump, everything generally just works.  It really comes down to the different C runtimes and needing to make sure what Python thinks is a FILE* is the same thing some C extension module things is a FILE*, the thing that calls free() matches with the thing that called malloc(), etc.

It'd be neat if we didn't link to the C runtime at all and just used all the functionality provided by Rtl/kernel32/ntdll, as it would avoid all of this, and you could use any compiler you want.  But it's a bit late for that ;-)

	Trent.

-----Original Message-----
From: Bill Janssen [mailto:janssen at parc.com] 
Sent: Friday, December 18, 2015 9:12 PM
To: Trent Nelson <trent at trent.me>
Cc: python-win32 at python.org; janssen at parc.com
Subject: Re: [python-win32] building a complicated Python application on Windows

Trent Nelson <trent at trent.me> wrote:

> Ah, so that's just the error that `python setup.py build` would have returned, it's not specific to conda-build.
> 
> As for what version you need, that's where things get fun:
> 	- Python 2.7		= Visual Studio 2008
> 	- Python 3.0->3.4	= Visual Studio 2010
> 	- Python 3.5+		= Visual Studio 2015
> 
> For 2.7, Microsoft released this handy little bundle (thanks Steve 
> Dower!): 
> https://www.microsoft.com/en-us/download/details.aspx?id=44266

I installed this and it still doesn't work.  Just spent an hour researching it, and I've got to tell you, I can't believe we let ourselves into this situation.  It's really bad.  The code in distutils/msvc9compiler.py insists that even if you set the env var VS90COMNTOOLS to point to your installation, it still has to be in a subdirectory called "VC", which the the Microsoft bundle doesn't do.
"vcvarsall.bat" winds up in
"~/AppData/Local/Programs/Common/Microsoft/Visual C++ for Python/9.0/vcvarsall.bat".

And the Microsoft bundle doesn't set any of the registry keys msvc9compiler.py looks for, so it can't find it that way.

I went down into the installed VC, copied vcvarsall.bat to be where msvc9compiler.py wanted to find it, set the env var, and finally got it.

This is nasty.

Bill

> 
> I've been lucky enough to always have MSDN subscriptions and full VS installations so I'm not sure how your mileage will fair with the community/free editions.  You could sign up for an AppVeyor or Anaconda account if procuring VS proves problematic.
> 
> 	Trent.
> 
> -----Original Message-----
> From: Bill Janssen [mailto:janssen at parc.com]
> Sent: Friday, December 18, 2015 8:02 PM
> To: Trent Nelson <trent at trent.me>
> Cc: python-win32 at python.org; janssen at parc.com
> Subject: Re: [python-win32] building a complicated Python application 
> on Windows
> 
> Hmmm, I'm getting an error message from 'conda build':
> 
> Warning: Couldn't find Visual Studio: 'C:\\Program Files (x86)\\Common Files\\Microsoft\\Vi...'
> 
> So I guess installing conda-build doesn't do everything it needs to?
> How would I know which version of Visual Studio to install, and where to find it?
> 
> Bill
> 
> Trent Nelson <trent at trent.me> wrote:
> 
> > Conda is well suited to this.  I use it to bundle all sorts of stuff on Windows.  (You write recipes (see https://github.com/conda/conda-recipes for examples), then 'conda build' them, which produces a package that can be subsequently installed with conda install.  Can sign up to anaconda.org and then upload the package into your own channel, such that a plain 'conda install -c janssen foobar' will install your package and all the deps (which were specified in the recipe/meta.yaml).
> > 
> > Sent from my iPhone
> > 
> > > On Dec 16, 2015, at 13:00, Bill Janssen <janssen at parc.com> wrote:
> > > 
> > > I'd like to build a Python-based deliverable for Windows.  It 
> > > includes many gnarly packages, like numpy, scipy, statsmodel, 
> > > ggplot, kivy, ZODB, ZEO, etc.  They include Cython modules (and 
> > > scipy may even require Fortran, for all I know).
> > > 
> > > On OS X, I build this all from source by starting with Kivy, which 
> > > is packaged as a venv inside an OS X application, and add in the 
> > > other stuff.  But I'm not sure this is the best way to proceed on 
> > > Windows (7, 8, and 10).  I'm also used to using mingw on Windows, 
> > > but again, I'm not sure that's appropriate.
> > > 
> > > Any advice would be appreciated...
> > > 
> > > Bill
> > > _______________________________________________
> > > python-win32 mailing list
> > > python-win32 at python.org
> > > https://mail.python.org/mailman/listinfo/python-win32


More information about the python-win32 mailing list