After running the setup.exe I can't find the two DLLs mentioned anywhere on my computer. Only the .tlb files stay under Program Files (X86). Do the DLLs come with the setup or do I have to compile them by myself?
I am running Win7 64 bit, Python 64 bit and Excel 32 bit. Is this supposed to work with ExcelPython?
Thank you for yours answers.
Cheers, Alex
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The files you refer to are part of the Python distribution (2.6 or 2.7) which you installed on your PC, the Python installer should have put them in C:\Windows\System32 or C:\Windows\SysWOW64 or some similar such folder.
The reason Excel is not finding them is because your Python is 64-bit whereas ExcelPython is compiled for 32-bit.
I am not sure that what you want to do is possible because, at least in ExcelPython, Excel and Python run in the same process so they cannot be one 32-bit and the other 64-bit. I recommend you use 32-bit Python anyway, AFAIK there is little advantage in using 64-bit unless you're doing very intensive floating point computations.
Other Excel-Python interfaces may be able to mix 32 and 64 bits if they run in separate processes and communicate over TCP.
Last edit: Eric Reynolds 2013-11-19
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for your answer. I made a mistake im my first mail, I am not missing python26.dll but ExcelPython26.dll on my harddisk. Do I have to compile it by myself or is this a setup bug.
I thought Python is sort of compiled into the PythonExcel26.dll. So do I have to have a Python installation at all? Or do I need the python26.dll only for compilation and to put it in the same folder as ExcelPython26.dll?
Unfortunately I can't change the setup of the computer. So it will be 64 bit Python. But maybe if a 32bit Python is part of the PythonExcel26.dll or I put a 32bit version in the same folder, I can use it. Or am I wrong?
Thank you very much for your help.
Cheers, Alex
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It should put ExcelPython26.dll in C:\Windows\System32. If it's not there, you can try uninstalling and reinstalling ExcelPython with command line parameter /LOG="C:\Log.txt", then you will be able to see if and where ExcelPython26.dll was installed in that file.
Python is not compiled into ExcelPython, the latter merely references Python through dynamic linking.
There is indeed a way to do what you suggest, i.e. install Python to folder and make Excel and ExcelPython point to that folder. It's a bit complicated however.
As a first try let's do the following: save the attached python26.dll (the 32-bit version) not into the same folder as your workbook but into the same folder as EXCEL.EXE which should be in C:\Program Files\Microsoft Office\Office12 or ...\Office14 etc depending on which version of Excel you have.
Note that the 32-bit version of python26.dll will have trouble loading some of the .pyd files that come with Python because it will find the 64-bit versions: in other words some native python libraries will not work. But if this creates problems we can solve it at a second stage.
Please let me know how you get on, it's valuable feedback for me!
I would really like to test the things you proposed, but the setup does not work properly on my machine. The Logfiles says
2013-11-20 14:15:13.929 Dest filename: C:\Windows\system32\ExcelPython26.dll
2013-11-20 14:15:13.929 Time stamp of our file: 2013-08-09 12:59:36.000
2013-11-20 14:15:13.929 Installing the file.
2013-11-20 14:15:13.934 Successfully installed the file
(complete log see attachment)
but really there is no file ExcelPython26.dll in that folder. (see Log.png)
Could you provide the files without the installer like in version 0.1 please?
Ok, so I have noticed on my 64-bit PC that even though the log file says the destination is C:\Windows\System32 the DLLs have actually ended up in C:\Windows\SysWOW64.
Can you check if they are there?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, there they are. I searched for the file in the explorer before, but he didn't show them. I wonder why, but doesn't matter. So I will copy them to Sytem32 and continue testing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, I think that SysWOW64 is actually (confusingly) the correct place for 32-bit DLLs under 64-bit Windows.
Excel gives you a message saying that it can't find ExcelPython26.dll, but that will give that error even when it can't find a DLL that ExcelPython26.dll depends on, not only ExcelPython26.dll itself.
I believe in this case what it can't find is the 32-bit Python26.dll, so if you place that in the same folder as EXCEL.EXE it may work.
Last edit: Eric Reynolds 2013-11-20
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, that's to be expected because the os module accesses native functions hence has to load additional DLLs or PYDs (PYDs are just DLLs with a different extension, so the 32/64-bit distinction holds).
So to make everything work, it is necessary to do the following:
1) Somehow get hold of a copy of the C:\Python26 folder installed using the 32-bit installer. Either you install it on a PC where you can do this, then copy it over to some folder, otherwise you can try with Portable Python which comes with a load of useful libraries pre-packaged like numpy and scipy.
2) Every time you call PyModule, PyEval or PyExec, you must specify the Path parameter in such a way that all attempts to load libraries get redirected to the path you want. So for example I have a VBA function like this
Take care to put the Path parameter in every call you make otherwise the Python runtime will start mixing up the paths.
Note the Path parameter is distinct from the AddPath parameter. The former replaces the Python path and the latter appends to it (if you specify both, the final path used will be AddPath + ";" + Path).
3) Depending on which libraries you intend to use, the 32-bit versions of the DLLs present in the C:\Python26 and C:\Python26\DLLs folder may have to be directly accessible from Excel, so they must be copied to the same folder as EXCEL.EXE.
Last edit: Eric Reynolds 2013-11-20
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
After running the setup.exe I can't find the two DLLs mentioned anywhere on my computer. Only the .tlb files stay under Program Files (X86). Do the DLLs come with the setup or do I have to compile them by myself?
I am running Win7 64 bit, Python 64 bit and Excel 32 bit. Is this supposed to work with ExcelPython?
Thank you for yours answers.
Cheers, Alex
Hi Alex,
The files you refer to are part of the Python distribution (2.6 or 2.7) which you installed on your PC, the Python installer should have put them in C:\Windows\System32 or C:\Windows\SysWOW64 or some similar such folder.
The reason Excel is not finding them is because your Python is 64-bit whereas ExcelPython is compiled for 32-bit.
I am not sure that what you want to do is possible because, at least in ExcelPython, Excel and Python run in the same process so they cannot be one 32-bit and the other 64-bit. I recommend you use 32-bit Python anyway, AFAIK there is little advantage in using 64-bit unless you're doing very intensive floating point computations.
Other Excel-Python interfaces may be able to mix 32 and 64 bits if they run in separate processes and communicate over TCP.
Last edit: Eric Reynolds 2013-11-19
Hi Eric!
Thank you for your answer. I made a mistake im my first mail, I am not missing python26.dll but ExcelPython26.dll on my harddisk. Do I have to compile it by myself or is this a setup bug.
I thought Python is sort of compiled into the PythonExcel26.dll. So do I have to have a Python installation at all? Or do I need the python26.dll only for compilation and to put it in the same folder as ExcelPython26.dll?
Unfortunately I can't change the setup of the computer. So it will be 64 bit Python. But maybe if a 32bit Python is part of the PythonExcel26.dll or I put a 32bit version in the same folder, I can use it. Or am I wrong?
Thank you very much for your help.
Cheers, Alex
It should put
ExcelPython26.dll
inC:\Windows\System32
. If it's not there, you can try uninstalling and reinstalling ExcelPython with command line parameter/LOG="C:\Log.txt"
, then you will be able to see if and whereExcelPython26.dll
was installed in that file.Python is not compiled into ExcelPython, the latter merely references Python through dynamic linking.
There is indeed a way to do what you suggest, i.e. install Python to folder and make Excel and ExcelPython point to that folder. It's a bit complicated however.
As a first try let's do the following: save the attached
python26.dll
(the 32-bit version) not into the same folder as your workbook but into the same folder asEXCEL.EXE
which should be inC:\Program Files\Microsoft Office\Office12
or...\Office14
etc depending on which version of Excel you have.Note that the 32-bit version of
python26.dll
will have trouble loading some of the.pyd
files that come with Python because it will find the 64-bit versions: in other words some native python libraries will not work. But if this creates problems we can solve it at a second stage.Please let me know how you get on, it's valuable feedback for me!
Thanks, Eric.
Hi Eric!
I would really like to test the things you proposed, but the setup does not work properly on my machine. The Logfiles says
2013-11-20 14:15:13.929 Dest filename: C:\Windows\system32\ExcelPython26.dll
2013-11-20 14:15:13.929 Time stamp of our file: 2013-08-09 12:59:36.000
2013-11-20 14:15:13.929 Installing the file.
2013-11-20 14:15:13.934 Successfully installed the file
(complete log see attachment)
but really there is no file ExcelPython26.dll in that folder. (see Log.png)
Could you provide the files without the installer like in version 0.1 please?
Cheers, Alex
Here's the Log-File
Ok, so I have noticed on my 64-bit PC that even though the log file says the destination is C:\Windows\System32 the DLLs have actually ended up in C:\Windows\SysWOW64.
Can you check if they are there?
Yes, there they are. I searched for the file in the explorer before, but he didn't show them. I wonder why, but doesn't matter. So I will copy them to Sytem32 and continue testing.
Ok, I think that SysWOW64 is actually (confusingly) the correct place for 32-bit DLLs under 64-bit Windows.
Excel gives you a message saying that it can't find ExcelPython26.dll, but that will give that error even when it can't find a DLL that ExcelPython26.dll depends on, not only ExcelPython26.dll itself.
I believe in this case what it can't find is the 32-bit Python26.dll, so if you place that in the same folder as EXCEL.EXE it may work.
Last edit: Eric Reynolds 2013-11-20
It works right now! I did what you proposed. We will see if there are Python functions not working. I will keep you informed.
Thank you very much!
Cheers, Alex
OK, not everythings works. For example I can "import sys" in a module, but a module containing "import os" doesn't work with the PyModule function.
Yes, that's to be expected because the
os
module accesses native functions hence has to load additional DLLs or PYDs (PYDs are just DLLs with a different extension, so the 32/64-bit distinction holds).So to make everything work, it is necessary to do the following:
1) Somehow get hold of a copy of the
C:\Python26
folder installed using the 32-bit installer. Either you install it on a PC where you can do this, then copy it over to some folder, otherwise you can try with Portable Python which comes with a load of useful libraries pre-packaged like numpy and scipy.2) Every time you call
PyModule
,PyEval
orPyExec
, you must specify thePath
parameter in such a way that all attempts to load libraries get redirected to the path you want. So for example I have a VBA function like thisthen I call the functions like this
Take care to put the
Path
parameter in every call you make otherwise the Python runtime will start mixing up the paths.Note the
Path
parameter is distinct from theAddPath
parameter. The former replaces the Python path and the latter appends to it (if you specify both, the final path used will beAddPath + ";" + Path
).3) Depending on which libraries you intend to use, the 32-bit versions of the DLLs present in the
C:\Python26
andC:\Python26\DLLs
folder may have to be directly accessible from Excel, so they must be copied to the same folder as EXCEL.EXE.Last edit: Eric Reynolds 2013-11-20
Thank you very much for your support.
I'll try and give you feedback.
Cheers, Alex