8

I am trying to install pywin32 for Python 2.6. I have python installed but it's not in the regular c: drive but on the d: drive . The pywin32 installer does not find it and I cannot give the custom path to it.

I checked, thepython folder is the path. Is there a workaround this issue ?

11 Answers 11

16

Update 2017-06-14 Seems like with python 3.6 the same problem re-apeared. But I found a nice suggestion: There is a pip version of pywin32: Just use

pip install pypiwin32

It did not install the latest version (sourceforge has 221 at the moment, it installed 220), but it worked without registry modifications or any other hacks.

Update 2017-02-01: I just tried the installation of build 220 using Python 3.5.2 32 bit on Windows 10 (64 bit), and everything worked nicely without and need to modify the registry. So the best advice might be to use the most recent build instead of build 219.

Old solution (build 219):

I ran into the same issue today when I tried to install pywin32 together with Python 3.5 win32 under Windows 8.1.

All installers (build 219) for py 3.5 failed, and modifying the registry as described in the posts of Jesus Flores and lauren alsina did not solve the problem.

What did the trick for me was to add the registry entrys not in HKEY_LOCAL_MACHINE but in HKEY_CURRENT_USER and change the python version in PythonCorefrom 3.5-32 to 3.5.

Interestingly enough, with the 3.5-32 key, the 64 bit installer works, but of course you will run into problems because the 64 bit libs installed are not compatible with the 32 bit python. Something is very broken in this installer.

So in summary, my working .reg file for Python 3.5 w32 looks like this:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Python]

[HKEY_CURRENT_USER\SOFTWARE\Python\PyLauncher]
"InstallDir"="C:\\Windows\\"
"AssociateFiles"=dword:00000001
@="C:\\Windows\\py.exe"

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore]

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.5]

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.5\Help]

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.5\Help\Main Python Documentation]
@="C:\\Program Files (x86)\\Python 3.5\\Doc\\python350.chm"

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.5\Idle]
@="C:\\Program Files (x86)\\Python 3.5\\Lib\\idlelib\\idle.pyw"

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.5\IdleShortcuts]
@=dword:00000001

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.5\InstalledFeatures]
"dev"="3.5.150.0"
"Shortcuts"="3.5.150.0"
"exe"="3.5.150.0"
"lib"="3.5.150.0"
"test"="3.5.150.0"
"doc_shortcut"="3.5.150.0"
"doc"="3.5.150.0"
"tools"="3.5.150.0"
"tcltk"="3.5.150.0"
"pip"="3.5.150.0"
"path"="3.5.150.0"

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.5\InstallPath]
@="C:\\Program Files (x86)\\Python 3.5\\"
"ExecutablePath"="C:\\Program Files (x86)\\Python 3.5\\python.exe"

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.5\InstallPath\InstallGroup]
@="Python 3.5"

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.5\PythonPath]
@="C:\\Program Files (x86)\\Python 3.5\\Lib\\;C:\\Program Files (x86)\\Python 3.5\\DLLs\\"
4
  • Works on Windows 7, and Windows 10 using Python 3.5 when using the 32bit executable. Thanks.
    – ste_kwr
    Oct 31, 2015 at 1:58
  • This has now been fixed in Python 3.5.1 (Issue #26071).
    – Cito
    Mar 26, 2016 at 18:40
  • Nice! This also works with Python 3.5 64-bit on Windows 7 with Pywin32 2.2.0 (pywin32-220.win-amd64-py3.5.exe) Nov 29, 2016 at 16:14
  • This should be the correct answer. pypiwin32 is the workaround the question asked for. The accepted one is 'incorrect' as pointed out from the comment of FastZhong.
    – Weihui Guo
    Nov 15, 2017 at 16:24
15

From the pywin32 README

If the installation process informs you that Python is not found in the registry, it almost certainly means you have downloaded the wrong version - either for the wrong version of Python, or the wrong "bittedness".

Are you sure you got the right version for your python and your cpu architecture? If you did and that did not work, you might try building from source, I think there might be a command line flag to allow you to specify the python installation location.

4
  • I'm sure I have the right version (Python26) and I didn't find different packages for 64 or 32 architectures (I have 64bit). So I tried to install it from source as you suggested but when I run setup.py install it gives me a bunch of errors
    – Johanna
    Jul 12, 2011 at 10:40
  • So you were right, there was a problem with the architecture. I found a 64-bits version of pywin32 and it worked fine :)
    – Johanna
    Jul 12, 2011 at 12:11
  • 6
    This answer is "incorrect". The problem is the reg key, if python is installed for the user only, look for HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\2.7, instead of HKEY_LOCAL_MACHINE. Make sure the InstallPath and PythonPath are set properly, e.g. InstallPath is C:\Python27, PythonPath is C:\Python27;C:\Python27\Lib;C:\Python27\DLLs.
    – Alan Zhong
    Jan 8, 2015 at 6:42
  • worked for me! Although you have an intel processor (as I do) don't look "amd" and "win" in the package name, just look the number and pick the one that matches your python...
    – user110954
    Apr 8, 2016 at 23:01
8

I had the same problem:

On 64 bit Windows, 32 bit apps are being registered under:

[1] HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python

I reckon the installer is expecting to find Python in:

[2] HKEY_LOCAL_MACHINE\SOFTWARE\Python

With regedit and local admin rights, you can export a .reg file of [1], remove all the "Wow6432Node\" you find, then import it as [2]

0
3

I had the same problem for the latest Python36-32 running on Windows 10 64 bit. All solutions above non worked for me when installed it for all users mode.

Obu's answer above almost worked by replacing 3.5 to 3.6, then pywin32 can detects the registry path but it's still failed with error code can't create pywin32-wininst.log. Try to run as administrator. It just stop installation then exit even though already run it as administrator.

After many trials, it solved like below:

  1. Take Obu's approach above, replacing 3.5 version to 3.6.

  2. Register it.

  3. Rename default installation folder of python36-32, something like this: C:\Program Files (x86)\Python36-32 to C:\Program Files (x86)\Python36
  4. Run pywin32 installer as administrator.

*Apologize i can't reply comment here due reputation limit, so i create this answer in order to help others who has same trouble as mine.

1
  • Works on Windows 10 using Python 3.6 x86. Thanks.
    – Gang YIN
    Jan 2, 2017 at 10:51
2

I had the same issue on Windows 10 64 bit with Python 3.6. It is installed for all users (I guess it uses a different registry hive in case it is installed for current user only).

The problem was that pywin32-220.win32-py3.6.exe searches in registry for HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Python\PythonCore\3.6 whilst python 3.6 setup created HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Python\PythonCore\3.6-32.

Note the different endings! Exporting the 3.6-32 registry to .reg file, modifying the paths to 3.6 and reimporting the file registry again fixed the problem for me.

1
  • And I had the reverse problem. Python 3.6 setup created HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.6 while PyWin needed HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.6-32. I had to temporarily rename the key to key the install to work.
    – Erica Kane
    Feb 22, 2017 at 16:25
0

1) Create a text file with this contents:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.4]

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.4\Help]

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.4\Help\Main Python Documentation] @="C:\\Python34\\Doc\\python342.chm"

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.4\InstallPath] @="C:\\Python34\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.4\InstallPath\InstallGroup] @="Python 3.4"

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.4\Modules]

[HKEY_LOCAL_MACHINE\SOFTWARE\PythonCore\3.4\PythonPath] @="C:\\Python34\\Lib;C:\\Python34\\DLLs"

2) Replace C:\\Python34 part with the path you have installed python.

3) Save the file as *.reg

4) Execute the file to combine with the Registry.

Just tested it to install pywin32 and It Works!

0

I was in a similar situation, trying to install pywin32 but with a Winpython portable install. After quite some googling I've found a link to this huge repository of packages in .whl bins by Christoph Gohlke.

Download the appropriate wheel file for your python version, in my case 3.6.1 on 32bit, and install it via pip :

pip install pywin32‑221‑cp36‑cp36m‑win32.whl
0

This should work for Python 3.5 users:

py -3.5 -m pip install pywin32
0

I ran into this exact problem, but it seemed to me that my situation was a bit different and besides, I didn't want to have to use a registry hack. So I started to post a new question. Here's what I was going to write:


I have both 64-bit and 32-bit versions of Python 3.7 installed on my Windows 7 machine. The 64-bit version is installed in C:\Python37 and the 32-bit version is installed in C:\Python37-32. I have the pywin32 package installed in the 64-bit version but not in the 32-bit version. When I start a command window, switch to C:\Python3y-32, and run "pip install pywin32", I am told that it is already installed in C:\Python37. Yes, I know that. I want it installed somewhere else. I tried downloading a wheel file and installing that, with the same result. I tried renaming my C:\Python37 folder to "C:\Python37 64 bits" and renaming C:\Python37-32 to C:\Python37, but the pip gave me a fatal error:

Fatal error in launcher: Unable to create process using '"c:\python37-32\python.exe"
"C:\Python37\Scripts\pip.exe" install "c:\users\\downloads\ pywin32-223-cp37-cp37m-win32.whl"'

(line breaks added for readability)


But then I looked again at that error message and realized that the quoted string is a command. I copied that string, switched to the C:\Python37-32 folder in my command window, pasted the string, removed the reference to C:\Python37, and ran it. No problem.

0

ManualInstall

Get the WHL file of what you need and rename it to a ZIP.

Extract that ZIP file to a directory.

Here is some batch code for installation:

set /p "S1=Manual Install - Wheel (ZIP) extract directory: "
set /p "S2=Python installation directory: "
RoboCopy %S1% "%S2%\Lib\site-packages"

Copy the code to a BAT or CMD file.

Run the script as admin and accept input.

-1

pywin32 build 219 has a problem in that it looks for the python 3.5 32 bit installation location in the wrong registry key. This problem is fixed in later pywin32 builds - 220 and 221 are the ones I tried - and they correctly find the python installation location in registry. You can see the pywin32 ticket here.

If you need build 219, then you can temporarily rename the registry entry.

I install python for all users on my PC, so the registry entries on my machine are in HKEY_LOCAL_MACHINE. If you install python per user, the registry entries will be in HKEY_CURRENT_USER. Also, my COM object is 32-bit, so we use the 32-bit python.

The 32-bit python registry entries will be located at: \SOFTWARE\Wow6432Node\Python\PythonCore.

The 64-bit python registry entries will be located at: \SOFTWARE\Python\PythonCore.

In my case, I had two entries that needed to be temporarily renamed:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\3.5

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\3.5-32

The Python installation location is found in the InstallPath key, which on my machine is at:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\3.5-32\InstallPath

My \PythonCore\3.5 folder only has the \Help\Pythonwin Reference key, which is duplicated in the \PythonCore\3.5-32 folder, so I am thinking that this key is left over from some previous install and no longer relevant. However, I did not opt to delete it, and I temporarily renamed both as follows:

From:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\3.5

To:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\3.5-temp

From:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\3.5-32

To:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\3.5

Once the pywin32 build 219 install was complete, I restored the keys back to the original names.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.