mhammond / pywin32

Python for Windows (pywin32) Extensions
5.06k stars 799 forks source link

Cannot install on Python 3.6 (32 bit) #739

Closed ghost closed 8 months ago

ghost commented 7 years ago

Not sure if this is python's or pywin32's fault, but either way, trying to install pywin32 in python 3.6 (32 bit) leads to the following...

C:\Users\Samuel\Downloads\pywin32-220\pywin32-220>C:\Users\Samuel\AppData\Local\Programs\Python\Python36-32\python.exe setup3.py install Converting... Executing... Building pywin32 3.6.220.0 Traceback (most recent call last): File "setup3.py", line 16, in exec(str(got)) File "", line 1944, in File "", line 594, in init File "C:\Users\Samuel\AppData\Local\Programs\Python\Python36-32\lib\ntpath.py", line 75, in join path = os.fspath(path) TypeError: expected str, bytes or os.PathLike object, not NoneType

Reported by: timothygrove

Original Ticket: pywin32/bugs/739

ghost commented 7 years ago

That error message has to do with setup.py not being able to find the windows SDK. I'm using Visual C++ Build Tools 2015 on Windows 7, running 64 bit Python 3.6. I didn't spend enough time on this to fix it, I ran into other issues with SWIG in the build later and punted.

The reason I am trying to install from source is the binary installer does not seem to work on my system. Mine errors out claiming one needs Python 3.6-32 even though I am using the 64 bit installer on 64 bit Python.

Original comment by: kvnhlzr

ghost commented 7 years ago

All:

I have set up a repository on GitHub and am currently working on a pull request to resolve these issues. The failure to set the SDK directory is only a surface problem. There are far greater problems and they mostly stem from using distuitls, which is literally from 2000. Any contributions to resolve these issues would be welcome, as I am already pretty busy.

https://github.com/pywin32/pypiwin32/pull/2

Original comment by: xaav

ghost commented 7 years ago

Thank you for looking into this further. I'm not sure what help I can offer, but I can add a little more about my situation...

My system is 64bit but I'm using 32bit Python.

I also tried the installer for Python 3.6 but that failed saying that Python 3.6 couldn't be found in the registry.

Running the setup3.py script for Python 3.5 resulted in the same error as given below for 3.6, although the installer for 3.5 worked fine.

Best regards, Tim

On 02/01/2017 02:36, Xaav wrote:

All:

I have set up a repository on GitHub and am currently working on a pull request to resolve these issues. The failure to set the SDK directory is only a surface problem. There are far greater problems and they mostly stem from using distuitls, which is literally from

  1. Any contributions to resolve these issues would be welcome, as I am already pretty busy.

https://github.com/pywin32/pypiwin32/pull/2


[bugs:#739] https://sourceforge.net/p/pywin32/bugs/739/ Cannot install on Python 3.6 (32 bit)

Status: open Group: v1.0 (example) Created: Sat Dec 31, 2016 12:17 AM UTC by Timothy Grove Last Updated: Sat Dec 31, 2016 05:17 AM UTC Owner: nobody

Not sure if this is python's or pywin32's fault, but either way, trying to install pywin32 in python 3.6 (32 bit) leads to the following...

C:\Users\Samuel\Downloads\pywin32-220\pywin32-220>C:\Users\Samuel\AppData\Local\Programs\Python\Python36-32\python.exe setup3.py install Converting... Executing... Building pywin32 3.6.220.0 Traceback (most recent call last): File "setup3.py", line 16, in exec(str(got)) File "", line 1944, in File "", line 594, in init File "C:\Users\Samuel\AppData\Local\Programs\Python\Python36-32\lib\ntpath.py", line 75, in join path = os.fspath(path) TypeError: expected str, bytes or os.PathLike object, not NoneType


Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/pywin32/bugs/739/

To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

Original comment by: timothygrove

ghost commented 7 years ago

You can force the installers to find the 3.6 version with a hack. See https://sourceforge.net/p/pywin32/bugs/738/#e8e8 .

Original comment by: efotinis

ghost commented 7 years ago

Tim:

As of now it's not looking good. Here is the problem that I have run into that I found on the mailing list:

Hi!

So I'm having trouble rebuilding pywin32. It seems like the Windows 10 SDK is different from what is expected by the latest version of pywin32. Is that correct? Should I just attempt to fix it myself, or is there something obvious I'm doing wrong? Here's what happens if I build normally.

Found version 0xa00 in C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\shared\SDKDDKVER.H setup.py:1207: ResourceWarning: unclosed file <_io.TextIOWrapper name='C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.10586.0\\shared\\SDKDDKVER.H' mode='r' encoding='cp1252'> why = self._why_cant_build_extension(ext) building 'win32job' extension swigging win32/src/win32job.i to win32/src/win32job_swig.cpp D:\projects\ctg\python3\ctg\src\vendor\PythonExtensions\pywin32\swig\swig.exe -python -c++ -dnone -DSWIG_PY64BIT -o D:\projects\ctg\python3\ctg\src\vendor\PythonExtensions\pywin32\win32\src\win32job_swig.cpp D:\projects\ctg\python3\ctg\src\vendor\PythonExtensions\pywin32\win32\src\win32job.i Generating wrappers for Python C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nologo /Od /MDd /W3 /GS- /Z7 /D_DEBUG -DDISTUTILS_BUILD -D_CRT_SECURE_NO_WARNINGS -Icom/win32com/src/include -Iwin32/src -Id:\projects\ctg\python3\ctg\publish\python\include -Id:\projects\ctg\python3\ctg\publish\python\include /TpD:\projects\ctg\python3\ctg\src\vendor\PythonExtensions\pywin32\win32\src\win32job_swig.cpp /Fobuild\temp.win-amd64-3.5-pydebug\Debug\win32/src/win32job_swig.obj /Fdbuild\temp.win-amd64-3.5-pydebug\Debug\win32job_vc.pdb /EHsc /DUNICODE /D_UNICODE /DWINNT win32job_swig.cpp D:\projects\ctg\python3\ctg\src\vendor\PythonExtensions\pywin32\win32\src\win32job_swig.cpp(1247): error C2065: 'JOB_OBJECT_RESERVED_LIMIT_VALID_FLAGS': undeclared identifier D:\projects\ctg\python3\ctg\src\vendor\PythonExtensions\pywin32\win32\src\win32job_swig.cpp(1247): error C2660: 'PyDict_SetItemString': function does not take 2 arguments error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe' failed with exit status 2xc

If I delete the following line (462) from win32job.i, I can get a fair bit further:

define JOB_OBJECT_RESERVED_LIMIT_VALID_FLAGS JOB_OBJECT_RESERVED_LIMIT_VALID_FLAGS

Then, I get a bunch of errors that look like this:

building 'axdebug' extension C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nologo /Od /W3 /GS- /Z7 /D_DEBUG /MDd -DDISTUTILS_BUILD -D_CRT_SECURE_NO_WARNINGS -Icom/win32com/src/include -Iwin32/src -Id:\projects\ctg\python3\ctg\publish\python\include -Id:\projects\ctg\python3\ctg\publish\python\include /TpD:\projects\ctg\python3\ctg\src\vendor\PythonExtensions\pywin32\com\win32comext\axdebug\src\AXDebug.cpp /Fobuild\temp.win-amd64-3.5-pydebug\Debug\com/win32comext/axdebug/src/AXDebug.obj /Fpbuild\temp.win-amd64-3.5-pydebug\Debug\axdebug.pch /Fdbuild\temp.win-amd64-3.5-pydebug\Debug\axdebug_vc.pdb /EHsc /DUNICODE /D_UNICODE /DWINNT AXDebug.cpp d:\projects\ctg\python3\ctg\src\vendor\pythonextensions\pywin32\com\win32comext\axdebug\src\stdafx.h(32): error C2365: 'DBGPROP_ATTRIB_NO_ATTRIB': redefinition; previous definition was 'enumerator' C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\um\dbgprop.h(137): note: see declaration of 'DBGPROP_ATTRIB_NO_ATTRIB' d:\projects\ctg\python3\ctg\src\vendor\pythonextensions\pywin32\com\win32comext\axdebug\src\stdafx.h(33): error C2365: 'DBGPROP_ATTRIB_VALUE_IS_INVALID': redefinition; previous definition was 'enumerator'

If I go into com/win32comext/AXDebug/src/stdafx.h, and change line 29 from:

if defined(__REQUIRED_RPCNDR_H_VERSION__)

To

if 0

Then I can get even further. But then it dies again later, complaining about undefined symbols. I can fix that by going to line 369 of AXDebug.cpp, and changing them from this: ADD_CONSTANT(EX_DBGPROP_INFO_ID); // @const axdebug|EX_DBGPROP_INFO_ID| ADD_CONSTANT(EX_DBGPROP_INFO_NTYPE); // @const axdebug|EX_DBGPROP_INFO_NTYPE| ADD_CONSTANT(EX_DBGPROP_INFO_NVALUE); // @const axdebug|EX_DBGPROP_INFO_NVALUE| ADD_CONSTANT(EX_DBGPROP_INFO_LOCKBYTES); // @const axdebug|EX_DBGPROP_INFO_LOCKBYTES| ADD_CONSTANT(EX_DBGPROP_INFO_DEBUGEXTPROP); // @const axdebug|EX_DBGPROP_INFO_DEBUGEXTPROP| To this: ADD_CONSTANT(EX_PROP_INFO_ID); // @const axdebug|EX_PROP_INFO_ID| ADD_CONSTANT(EX_PROP_INFO_NTYPE); // @const axdebug|EX_PROP_INFO_NTYPE| ADD_CONSTANT(EX_PROP_INFO_NVALUE); // @const axdebug|EX_PROP_INFO_NVALUE| ADD_CONSTANT(EX_PROP_INFO_LOCKBYTES); // @const axdebug|EX_PROP_INFO_LOCKBYTES| ADD_CONSTANT(EX_PROP_INFO_DEBUGEXTPROP); // @const axdebug|EX_PROP_INFO_DEBUGEXTPROP|

Fixing that, it dies in linking axdebug. And at this point, I have to ask if I'm doing something wrong. We should be on the latest published version of pywin32, so I'm a bit surprised that I'm needing to fix all these compile errors. Is that expected?

Thanks for any assistance!

Chris

I have attempted to resolve this problem by upgrading to a newer SWIG version but have run into other problems on that front. You can see the reults of the build at https://ci.appveyor.com/project/pywin32/pypiwin32/build/1.0.10

At this point I'm probably going to investgate the problems with AxDebug, but I don't think there is a particularly encouraging chance of success. Let me know if you have any other ideas.

Original comment by: xaav

ghost commented 7 years ago

Thank you; this appears to have worked. In addition, I also needed to add a subkey 'InstallPath' , modelled after the same subkey for Python 3.5.

Original comment by: timothygrove

ghost commented 7 years ago

I've made some (limited) progress, but I am now stuck here:

   C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:c:\python36-x64\libs /LIBPATH:c:\python36-x64\PCbuild\amd64 /LIBPATH:build\temp.win-amd64-3.6\Release "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\lib\x64" propsys.lib oleaut32.lib ole32.lib shell32.lib delayimp.lib python36.lib /EXPORT:PyInit_propsys build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/propsys.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyIInitializeWithFile.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyIInitializeWithStream.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyINamedPropertyStore.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyIPropertyDescription.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyIPropertyDescriptionAliasInfo.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyIPropertyDescriptionList.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyIPropertyDescriptionSearchInfo.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyIPropertyEnumType.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyIPropertyEnumTypeList.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyIPropertyStore.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyIPropertyStoreCache.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyIPropertyStoreCapabilities.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyIPropertySystem.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyPROPVARIANT.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyIPersistSerializedPropStorage.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyIObjectWithPropertyKey.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyIPropertyChange.obj build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src/PyIPropertyChangeArray.obj /OUT:build\lib.win-amd64-3.6\win32comext/propsys\propsys.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\com/win32comext/propsys/src\propsys.lib /MANIFEST:NO /MACHINE:amd64 /BASE:0x1e6b0000 /DEBUG /PDB:build\temp.win-amd64-3.6\Release\propsys.pdb /delayload:shell32.dll /IMPLIB:build\temp.win-amd64-3.6\Release\pypropsys.lib
    uuid.lib(guids.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
    propsys.obj : warning LNK4197: export 'PyInit_propsys' specified multiple times; using first specification
       Creating library build\temp.win-amd64-3.6\Release\pypropsys.lib and object build\temp.win-amd64-3.6\Release\pypropsys.exp
    propsys.obj : error LNK2001: unresolved external symbol CLSID_PropertyChangeArray
    build\lib.win-amd64-3.6\win32comext/propsys\propsys.pyd : fatal error LNK1120: 1 unresolved externals
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64\\link.exe' failed with exit status 1120

    ----------------------------------------
Command

Mr. Hammond appears to have used an option that is not well supported and has likely been removed on the newer compiler: CLSID_PropertyChangeArray

Original comment by: xaav

ghost commented 7 years ago

In case anyone is interested, I've managed to get the bulk of pywin32 building on MS Build Tools 2015 (minus Scintilla, winxp, and the python service executable) after some painful refactoring.

Original comment by: xaav

ghost commented 7 years ago

I'm having this issue right now as well. I'm on Windows Server 2012 and visual Studio 2012 trying to build this for a custom-built Python 2.7. It gets pretty far but fails just like this. I'm very unclear on where to get all of these things. I used the Windows 7 SDK download from the link in the documentation and it wouldn't install complaining about .NET 4 or something. So I got the Windows 10 SDK because it said it can be used to build stuff for Windows Server 2012. The setup.py couldn't find my SDK (I got that Nonetype error on ntpath above but commented out some lines in setup.py to get around it). Where should I be getting an SDK for this? because clearly the Windows 10 SDK isn't compatible.

Original comment by: funkyelf

AlreadyAsleep commented 6 years ago

Did you ever get the install on Python 3.6? I am having the same issue as you were I believe

ghost commented 6 years ago

What's the issue?

ghost commented 6 years ago

BTW, you cannot compile pywin32 on a default Python/MSVC installation. Would highly recommend:

pip install pypiwin32
AlreadyAsleep commented 6 years ago

Oh my goodness you are a lifesaver. That did it. Why is this not in the README?

ghost commented 6 years ago

No idea. I'm not the decision-maker here.

AlreadyAsleep commented 6 years ago

Well thank you anyway, I'm still a noob so it really goes a long way

Avasam commented 8 months ago

@mhammond Given this issue was specifically about installing on Python 3.6, which pywin32 no longer supports, should it be closed?

Other comments mentioning Python 2, non-pip installers, SDK path, are also no longer relevant anyway.