Visual Studio 2005 Build of Python with Debug .lib - python

I am looking for the Visual Studio 2005 build of Python 2.4, 2.5 or 2.6, I also need the python2x_d.lib (the debug version of the .lib) since I embed the interpreter into my app and the python libs implicitly link to the python2x_d.lib with pragmas (grrr).
Any hints where I can find those builds ?
Regards,
Paul

I would recommend that you download the Python source (tgz and tar.bz2 zipped versions available) and compile it yourself. It comes with a VS2005 solution so it isn't difficult. I had to do this for a SWIG project I was working on.

If you have trouble finding the debug builds, you can try and build your own. Browse the build directory, for project files like python.vcproj - to locate versions that will work with Visual Studio 2005.

I recall, some time ago, giving IronPython a 'whirl' in VS2005. I ran into all kinds of 'esoteric' errors until I figured out that to compile and run I had to add the C++ libraries and tools of VS2005 as well (add/remove).
Maybe this is something similar ?

Related

Preload custom module python vscode

Does the new python language server available in Visual Studio Code based on the Visual Studio one allows for the preload module option.
"python.autoComplete.preloadModules": []
And if it does indeed work with it, does it work with project modules or only modules installed in the virtualenv?
Doing something like "python.autoComplete.preloadModules": ["/path/to/module"] would work on the any of both implementations?
You can add them like below
"python.autoComplete.preloadModules": ["numpy", "pandas", "matplotlib"],
also, check the docs! :)
https://code.visualstudio.com/docs/python/editing#_autocomplete-and-intellisense

Can I develop C extensions for Python 2.7 through 3.1 on Windows *without* installing Visual Studio 2008?

I'm aware that Python extensions on Windows typically have to be built with the same version of Visual Studio used to compile Python itself, and I'm further aware that Python 2.7 through 3.1 are built using Visual Studio 2008. But the machine I'm on already has VS 2013 installed, and, as I've discovered countless times, one way to rapidly mess up your Windows development environments is to install Visual Studio in any order than from oldest to newest. Besides which, install VS2008 on a brand-new Windows 8.1 box seems silly. Python extensions are the only thing I have that needs 2008; if I can avoid installing it, I'd really prefer not to.
Can I avoid installing VS 2008 and still build against the official Python distributions, perhaps by installing a specific Platform SDK? If not, is there an alternative build of Python that might go with e.g. MinGW, or something that does not require I install VS 2008?
I can suggest a few possible solutions to your problem. From potentially the easiest, to probably the hardest:
Just use Visual Studio 2013 to compile your extension modules. For this to work your extension module mustn't access any C runtime objects created by the Python interpreter, nor may it pass any C runtime objects it creates to the interpreter. In particular you can't use any FILE * or file descriptor objects provided by Python. You can still read and write to files in your module, just not files that Python has opened.
Uninstall Visual Studio 2013, install Visual Studio 2008, reinstall Visual Studio 2013. As silly as this sounds it's probably going to be a quicker and lot less frustrating than either of the following solutions. This will let you build extension modules pretty much normally and you won't have to worry about what C runtime objects you use.
Use mingw32 and employ various hacks to get it to work. This page explains how one person got it to work: https://lists.launchpad.net/kicad-developers/msg09473.html
Copy the appropriate msvcrt*.lib file from VS 2008 installed on another machine. Manually edit your linker options to use this library instead of VS 2013's msvcrt*.lib of the same name. If that doesn't work, copy the include files and other libraries as well, and modify your compiler and linker options to use them instead. If that still doesn't work, copy the VS 2008 command line compiler and all of its dependent DLLs, set the PATH correctly, and then modify your build process to use that compiler instead.

How to obtain pre-built *debug* version of Python library (e.g. Python27_d.dll) for Windows

Firstly, I should state that my current development environment is MSYS + mingw-w64 + ActivePython under Windows 7 and that on a normal day I am primarily a Linux developer. I am having no joy obtaining, or compiling, a version of the Python library with debug symbols.
I need both 32bit and 64bit debug versions of the Python27.dll file, ideally. I want to be able to embed Python and implement Python extensions in C++, and be able to call upon a seamless debugging facility using the gdb-7.4 I have built for mingw-w64, and WingIDE for the pure Python side of things.
Building Python 2.7.3 from source with my mingw-w64 toolchain is proving too problematic -- and before anyone flames me for trying: I acknowledge that this environment is unsupported, but I thought I might be able to get this working with a few judicious patches (hacks) and:
make OPT='-g -DMS_WIN32 -DWIN32 -DNDEBUG -D_WINDOWS -DUSE_DL_EXPORT'
I was wrong... I gave up at posixmodule.c since the impact of my changes became uncertain; ymmv.
I have tried building with Visual C++ 2010 Express but being primarily a Linux developer the culture-shock is too much for me to bear today; the Python project does not even import successfully. Apparently, I need Visual C++ 2008, yet I am already convinced I don't want to go down this road if at all possible...
It's really surprising to me that there is not a zip-file providing the requisite .dlls somewhere on the Internet. ActiveState should really provide these as an optional download with each release of ActivePython that they make -- perhaps that's where the paid support comes in ;-).
What is the best way to obtain the Python debug library files given my environment?
I've just built CPython 2.7.5 in debug mode with Visual Studio 2012 Express (free).
I documented the process via wiki page: https://wiki.python.org/moin/VS2012
The best way to create a debug version of Python under Windows is to use the Debug build in the Visual Studio projects that come with the Python source, using the compiler version needed for the specific Python release, i.e. VS 2008.
There may be other ways, but this is certainly the best way.
If you really need a 64-bit debug build also, the best way is to buy a copy of VS 2008 (i.e. not use the Express version). It may be possible to create an AMD64 debug build using the SDK 64-bit compiler, but again, using the officially-supported procedures is the best way.
The libs can be aquired from the official Python site https://www.python.org/ftp/python/. Just navigate to the specific version you like and then download the respective installer.
For installation you can call the installers like this :
your_installer.msi targetdir="the_path_to_your_directory_of_choice"
or simply Run them as Administrator.
You may also use the Python installer to download the debug symbols as well(use the webinstall version).

How do I get cx_Oracle to work on 64-bit Itanium Windows?

I'm running Windows Server 2003 on a 64-bit Itanium server which is also running 64-bit Oracle 10.2, and I'd like to install cx_Oracle for Python 2.5. I've used cx_Oracle before many times on both Windows and Linux, and I've also compiled it before on 32 bit versions of those platforms, but I've never tried an IA64 compile.
None of the binary builds of cx_Oracle at http://cx-oracle.sourceforge.net/ are 64 bit, and I get an error after installing any of them when trying to run import cx_Oracle so I figure the thing to do is to compile it from source.
When running python setup.py build then I get the error that Python was built with Visual Studio 2003 and that I need something which can produce compatible binaries. I have Visual Studio 2005, which apparently doesn't fit the bill due to linking against a different version of the C standard library, and probably for other reasons as well. Unfortunately, Visual Studio 2003 is no longer available for download, and I'm not sure where to get it.
So I download MinGW from http://sourceforge.net/projects/mingw/files/ but this is also only available in 32 bit form. I go ahead and give it a try anyway, but it gives me an error during compilation about one of the Oracle DLLs I'm linking against having an invalid file format.
At this point I've got a lot of options, and I'm not sure where to place my efforts:
I could download the 64 bit MinGW from http://sourceforge.net/projects/mingw-w64/ and try using that, except that it only seems to be available as source, so I'd have to compile the compiler, probably using Visual Studio 2005.
I could try using an x86 32 bit build of Python and then download the Oracle Instant Client SDK from http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html and then use that to build cx_Oracle. I'd probably have to set my ORACLE_HOME to the client so that it didn't try linking against the 64 bit server DLLs, but this seems like it might work.
I could try compiling Python itself from source, using Visual Studio 2005, so that I could then use Visual Studio 2005 to build cx_Oracle and not worry about binary compatibility issues. I've compiled Python from source many times on Linux and never had any problems, so I'd like to believe that it's just as simple on Windows.
I could try to figure out how to make Visual Studio 2005 link against the right DLLs and thus produce compatible binaries in that manner without needing Visual Studio 2003. Intuitively it seems like Visual Studio should be able to produce compatible binaries with older versions of itself, but almost all of my compiler experience is with gcc so I don't really know.
I'm just really not sure where to direct my efforts. Does anyone have any suggestions about where to go next? I can copy/paste some of the specific error messages I've gotten if that would be helpful.
I'd especially love to hear from anyone who's ever gotten cx_Oracle to work on a 64 bit Itanium version of Windows - I can't be the first to try this.
I ended up going with Option #2: I downloaded the 32-bit Oracle Instant Client, then compiled cx_Oracle for 32-bit Python with the instant client. So everything involved is 32-bit, and I'm just not using any IA64-bit executables, and this works just fine.
If I had an IA64 compiler, I'd try Option #3, but it turns out that Visual Studio Pro doesn't support the IA64 platform, and we'd need to spend a lot of money to upgrade to whatever's higher than Pro.
I read this yesterday and am not suprised to see that nobody has answered. It is a very specific and complex question. While I do not have direct experience with many of the tools you are dealing with I have delt with the issues surrounding incompatabilities with different compilers and binaries. For what its worth 3. sounds like your best bet.

Can I use VS2005 to build extensions for a Python system built with VS2003

RDFLib needs C extensions to be compiled to install on ActiveState Python 2.5; as far as I can tell, there's no binary installer anywhere obvious on the web. On attempting to install with python setup.py install, it produces the following message:
error: Python was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible binaries.
Visual Studio 2003 was not found on this system. If you have Cygwin installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.
There are various resources on the web about configuring a compiler for distutils that discuss using MinGW, although I haven't got this to work yet. As an alternative I have VS2005.
Can anyone categorically tell me whether you can use the C compiler in VS2005 to build Python extension modules for a VS2003 compiled Python (in this case ActiveState Python 2.5). If this is possible, what configuration is needed?
The main problem is C run-time library. Python 2.4/2.5 linked against msvcr71.dll and therefore all C-extensions should be linked against this dll.
Another option is to use gcc (mingw) instead of VS2005, you can use it to compile python extensions only. There is decent installer that allows you to configure gcc as default compiler for your Python version:
http://www.develer.com/oss/GccWinBinaries
I can't tell you categorically, but I don't believe you can. I've only run into this problem in the inverse situation (Python built with VS2005, trying to build with VS2003). Searching the web did not turn up any way to hack around it. My eventual solution was to get VC Express, since VC2005 is when Microsoft started releasing the free editions. But that's obviously not an option for you.
I don't use ActiveState Python, but is there a newer version you could use? The source ships with project files for VS2008, and I'm pretty sure the python.org binary builds stopped using VS2003 a while ago.
As of today Mar 2012, I can categorically say it is possible with Python2.4.4 (only one I've tested) and Visual Studio 2005 and 2008. Just installing VS10 to check that. I don't know why it works and I have problems using distutils so I have to compile manually.

Categories

Resources