[issue22411] Embedding Python on Windows

2014-09-14 Thread Joakim Karlsson

New submission from Joakim Karlsson:

When I embed Python 3.4 in an existing app, I run in to a few issues when our 
app is built in debug mode. I build against the headers, libs and dlls that I 
get when installing python, I don't build python myself.

1. When I include python.h it will, via pyconfig.h, automatically attempt to 
link to python34_d.lib. This lib, along with its accompanying dll is not 
included in the python installation.

I'd rather explicitly link to the release lib than having header files 
implicitly selecting libs based on the _DEBUG flag. I ended up killing the 
#pragma comment(lib...) statements in pyconfig.h, and I can now link with the 
lib included.

2. Now when I build, I get a linker error telling me that '__imp__Py_RefTotal' 
and '__imp_Py_NegativeRefCount' cannot be found. This seems to be caused by 
Py_DEBUG being defined automatically in pyconfig.h as a result of _DEBUG being 
defined for my application. This causes the reference counting macros to use 
functionality that is only present in the debug version of python34.dll.

I ended up including pyconfig.h first, undefed Py_DEBUG, and then including 
python.h. This seems rather clunky.

Keeping with "explicit is better than implicit", wouldn't it be better to 
having to explicitly link to the desired lib from the embedding app, and 
explicitly set Py_DEBUG without having it inferred from _DEBUG? 

That way the provided headers and libs would work right out of the box while 
still leaving me the option to get the debug behaviour if I need to.

--
components: Windows
messages: 226882
nosy: Joakim.Karlsson
priority: normal
severity: normal
status: open
title: Embedding Python on Windows
type: compile error
versions: Python 3.4

___
Python tracker 
<http://bugs.python.org/issue22411>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22411] Embedding Python on Windows

2015-01-09 Thread Joakim Karlsson

Joakim Karlsson added the comment:

You shouldn't mix headers with and without the _DEBUG symbol defined. At least 
on some versions of MSVC this can lead to errors as some standard headers start 
referencing functions that are not available in both debug and release versions 
of the MSV C runtime.

--

___
Python tracker 
<http://bugs.python.org/issue22411>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22411] Embedding Python on Windows

2015-01-09 Thread Joakim Karlsson

Joakim Karlsson added the comment:

A complicating factor is that the debug and release versions of the dll:s seem 
to behave differently, which makes it hard to replace one with the other.

For instance, in dynload_win.c, the suffix of files looked for are "_d.pyd" in 
debug mode and ".pyd" in release mode. This causes python not to find any .pyd 
files if I link to the debug version.

This might be a separate issue, but it is tighly connected to this as the 
_DEBUG setting of the embedding app changes how the Python interpreter works.

--

___
Python tracker 
<http://bugs.python.org/issue22411>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22411] Embedding Python on Windows

2015-01-10 Thread Joakim Karlsson

Joakim Karlsson added the comment:

Sounds reasonable.

It would also require that all third party packages supply a "*_d.pyd" version 
of any extensions.

Does setuptools and pip have any support for automatically creating debug 
versions of extensions with the correct naming scheme when creating wheels or 
compiling during installation? A (really shallow) search didn't find any info 
on this.

Anyway, thanks for stepping up and taking charge of the windows installers!

--

___
Python tracker 
<http://bugs.python.org/issue22411>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25157] Installing Python 3.5.0 32bit on Windows 8.1 64bit system gives Error 0x80240017

2015-12-23 Thread Joakim Karlsson

Joakim Karlsson added the comment:

I got this working on a Windows 8.1 box with the following mess. Hopefully 
someone more capable than me can piece together a viable fix from this.

I downloaded and executed the Visual C++ Redistributable for VS 2015 here: 
https://www.microsoft.com/en-us/download/details.aspx?id=48145

I then watched that installation fail with the same error as in the python 
installer.

>From the steps described here: http://stackoverflow.com/a/31536998

1. Copy the file "C:\ProgramData\Package 
Cache\FC6260C33678BB17FB8B88536C476B4015B7C5E9\packages\Patch\x64\Windows8.1-KB2999226-x64.msu"
 to c:\temp\

(Note: the guid in the path above is not the same as in the stack overflow 
answer. It seems it may vary)

2. From an elevated (important!) command prompt:

>cd c:\temp
>mkdir extracted
>wusa.exe Windows8.1-KB2999226-x64.msu /extract:extracted

(Make sure files are extracted to the new dir)

>dism.exe /Online /Add-Package 
>/PackagePath:extracted\Windows8.1-KB2999226-x64.cab

3. Run vc_redist.x64.exe again, and choose repair

4. Now, I could finally install Python (3.5.1)

--
nosy: +Joakim.Karlsson

___
Python tracker 
<http://bugs.python.org/issue25157>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25157] Installing Python 3.5.0 32bit on Windows 8.1 64bit system gives Error 0x80240017

2015-12-23 Thread Joakim Karlsson

Joakim Karlsson added the comment:

My previous fix works for me when I install for current user only. When I 
attempt to install for all users, I get an error stating that 
"api-ms-win-crt-runtime-I1-1-0.dll" is missing during the "Precompililng 
standard library" phase.

--

___
Python tracker 
<http://bugs.python.org/issue25157>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25157] Installing Python 3.5.0 32bit on Windows 8.1 64bit system gives Error 0x80240017

2015-12-23 Thread Joakim Karlsson

Joakim Karlsson added the comment:

...and I seem not to have a working installation even when installing for a 
single user. The installation completes without complaining, but running python 
ends up in an error message telling me that "api-ms-win-crt-heap-l1-1-0.dll" is 
missing.

--

___
Python tracker 
<http://bugs.python.org/issue25157>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25157] Installing Python 3.5.0 32bit on Windows 8.1 64bit system gives Error 0x80240017

2015-12-27 Thread Joakim Karlsson

Joakim Karlsson added the comment:

After running a windows update I finally have a working Python 3.5.1 
installation. Updates weren't done automatically on this box, so I was a bit 
behind.

I wish I knew which update fixed this, and I'm sorry to add to any confusion 
regarding this issue.

--

___
Python tracker 
<http://bugs.python.org/issue25157>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com