ericremoreynolds / excelpython

An open source, easy to use interface for calling Python code from Excel
http://ericremoreynolds.github.io/excelpython
BSD 2-Clause "Simplified" License
234 stars 58 forks source link

Portable Python #1

Closed dhenryFabrice closed 10 years ago

dhenryFabrice commented 10 years ago

Hi,

Excel shows ans error when I try type ?PyStr(PyEval("1+2")) in the immediate window : File not found: ExcelPython26.dll Regards.

dhenryFabrice commented 10 years ago

Shame on me ... I was working on a virtual machine with no python installed... sorry. By the way, it possible to blundel an excel file with python and your dll?

ericremoreynolds commented 10 years ago

You mean like examples?

dhenryFabrice commented 10 years ago

In the page : http://www.codeproject.com/Articles/639887/Calling-Python-code-from-Excel-with-ExcelPython it is written : highly embeddable: it's possible to use a packaged up Python distribution so that the spreadsheet can be distributed without installing Python.

ericremoreynolds commented 10 years ago

You are right, I did indeed write that, I will put up an example as soon as I have time.

ericremoreynolds commented 10 years ago

Just to be clear, it is possible to set everything up in such a way that you do not need to install Python and ExcelPython, it is recommended to use the installer where possible as it's simpler and less prone to subtle configuration issues. However installers are sometimes not an option and in these cases the "portable" setup is useful.

dhenryFabrice commented 10 years ago

Is it like unsing a "portable" python (with python27.dll in the python folder for example) and adding the ExcelPython27.dll in the same folder and target it with the browse button from the references windows?

ericremoreynolds commented 10 years ago

I wish it were that simple... unfortunately you need to do a bit more setup. I will post an example as soon as I have a moment.

nmaravich commented 10 years ago

Hi all - sorry for the Noob complaint, but I am getting the dreadful .dll not found at the py - immediate window test. I have anaconda 64 bit and excel 2010 also 64 bit. I removed the .dll and tried all of the updated .exe as well as manually drooped the .dlll in the sys/32 folder. Let me now if there are a series of steps that I can take to double check that I did not do something wrong. Thanks!

ericremoreynolds commented 10 years ago

Hi @nmaravich I have opened a new issue please see #2

ericremoreynolds commented 10 years ago

Hi @dhenryFabrice, you might want to look into ExcelPython v2 that I have just released. It's a complete rewrite and it's much easier to target a portable python installation. The only problem is there's not much documentation just yet, but all you have to do really is edit .xlpy\xlpython.cfg and it should be fairly self-explanatory.

Let me know how you get on!

Eric.

dhenryFabrice commented 10 years ago

Hi, Thanks a lot. I just had a look and I wonder if the dlls : xlpython32-2.0.0.dll or xlpython64-2.0.0.dll are needed because I couldn't find them.

ericremoreynolds commented 10 years ago

They're in the release zip, no? Are you getting it from here?

Your folder structure should look like this:

+ ProjectFolder
|-+ .xlsm
| |-- xlpython.cfg
| |-- xlpython.py
| |-- xlpython.bas
| |-- xlpython32-2.0.0.dll
| +-- xlpython64-2.0.0.dll
|-- YourWorkbook.xlsm
+-- YourScript.py

Is Excel giving you an error?

dhenryFabrice commented 10 years ago

Ok I was downloading the master folder from the download zip link in the project front page.

dhenryFabrice commented 10 years ago

it find the dll now but I got an error but I have to check my python installation so don't bother. Thank a lot for your work!

untitled

ericremoreynolds commented 10 years ago

you can try running

pythonw.exe -u "c:\users\fabrice\downloads\excelpython-2.0.0\.xlpy\xlpython.py" {27660497-383e-46c3-82e7-b0d2bf0a7fef}

from the command line... if that works then so should ExcelPython

thanks for already for your feedback, any help is very much appreciated for improving the project -- v2 is very new, there are bound to be some hiccups!

ciao

imxde commented 10 years ago

Eric, I have the same problem mentioned by dhenryFabrice commented on 17 Jul... I am using ExcelPython V2.. after I install the XL-AddIn, I created the worksheet (.xlsm) and set up the ExcelPython for the file (no errors), looking at the directory where the project is created, there is not any .dll. When I tried to import the "Python UDFs" I received the error : "file not found xlpython32-2.0.7.dll"

I am using :

without admin rights or any chance to install anything in my computer ;)

I would appreciate any hint that you can provide me...

Thanks

ericremoreynolds commented 10 years ago

Sure, happy to help.

So after setup there is no folder named 'xlpython' contained in the same folder as your workbook?

imxde commented 10 years ago

thanks for the quick answer Eric...yes, there is a folder "xlpython" but without any *.dll (please see attached screenshot : Screenshot - 11_11_2014 , 11_16_07.png)I generated other screenshots of my installation... attached in this mail.

BR Igor.

ericremoreynolds commented 10 years ago

Igor, I'm afraid GitHub deletes image attachments when you reply by mail. You need to reply on the GitHub site.

imxde commented 10 years ago

..no change to upload any images here (at least for me at this moment)... I tried : drag&drop, upload from my pc and paste none of them worked...

as mentioned before, the folder xlpython is created but without any dll file inside..what do you suggest ?

ericremoreynolds commented 10 years ago

Ok so what the add-in does is it just copies its own local xlpython folder to your workbook folder. So that suggests that the DLLs are missing from the original folder, for some reason.

The add-in should be located in %APPDATA%\Microsoft\Excel\XLSTART, or alternatively if it's not there you can check where it is by typing ?Workbooks("xlpython.xlam").Path in the VBA immediate window.

Could you please check if the xlpython folder located next to the xlpython.xlam file contains some DLLs?

imxde commented 10 years ago

I did it... the xlpython folder just contains: 5 files:

init.py (3KB) xlpyserver.py (8KB) xlpython.bas (3KB) xlpython.cfg (2KB) xlpython_v1back.bas (3KB)

I checked the file that I download from github (https://github.com/ericremoreynolds/excelpython/releases/tag/v2.0.7) - I took the zip version and doesn´t contains any dll file.

imxde commented 10 years ago

version 2.06 contains the dlls.

total of files : 8

init.py (3KB) fix_anaconda_pywin32.py (1KB) xlpyserver.py (7KB) xlpython.bas (3KB) xlpython.cfg (2KB) xlpython_v1back.bas (3KB) xlpython32-2.0.6.dll (84KB) xlpython64-2.0.6.dll (101KB)

ericremoreynolds commented 10 years ago

I see, the reason is that you are downloading the source zip which is basically just an image of the GitHub repository, not a release package.

Does the installer not work on your PC? It shouldn't require any admin privileges.

imxde commented 10 years ago

thanks a lot for your time and help. I downloaded the version 2.0.6 (zip version - remember I don´t have have admin rights in my PC and the installed policies doesn´t let me to install anything - I tried the install for 2.0.7 and didn´t work). :( but the version 2.0.6. works like a charm !! - I copied your example (matrix mult) and worked ( using WinPython-32bit-3.3.5.0). As far I understood, the differences between 2.0.6 and 2.0.7 is : dimensionality the arguments. Thanks again for your great work !

ericremoreynolds commented 10 years ago

Yes that's the only difference it's a very minor change

However thanks for letting me know, it's important for me to know that there are people whose situation is like yours and who therefore need a zip instead of an installer!

Thanks, regards

Eric.

imxde commented 10 years ago

then...

users_needZIP += 1

regards