Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportPythonUDFS throws a run-time error '53' (xlwings 0.6.1) #323

Closed
issatayev opened this issue Dec 10, 2015 · 21 comments
Closed

ImportPythonUDFS throws a run-time error '53' (xlwings 0.6.1) #323

issatayev opened this issue Dec 10, 2015 · 21 comments
Labels
Milestone

Comments

@issatayev
Copy link

I have Anaconda2(32-bit) installed on my computer(Windows 7 Professional, 64-bit), and I am using Microsoft Excel 2010(32-bit). I used ExcelPython previously, and it worked fine. Then I updated everything to xlwings 0.6.1 and deleted ExcelPython because xlwings and ExcelPython merged.

I added necessary xlwings.bas file to VBA as a module. When I press Alt+F8 button, which brings up "Macro" pop-up window, "ImportPythonUDFs" macro appears in the list. However, when I press "Run" button, it throws me "Run-time error '53'" error saying "File not found: xlwings32.dll".

This is what I tried so far:

  1. When I provided path to python.exe file in "PYTHON_WIN" field and executed "ImportPythonUDFs", this error message appeared: "Run-time error '1': Could not load xlwings32.dll from either of the following folders: C:\Users\xyz\AppData\Local\Continuum\Anaconda2, C:\Users\xyz\AppData\Local\Continuum"

  2. I checked that my xlwings32.dll sits next to python.exe file. – Nomad 15 mins ago

  3. I tried uninstalling xlwings from computer by "pip uninstall xlwings". Command Prompt says that xlwings was successfully uninstalled. However, when I want to reinstall xlwings by typing "pip install xlwings", Commad Prompt says "Requirement already satisfied". How is this possible if I just uninstalled xlwings entirely from my computer?

@fzumstein
Copy link
Member

Ok so let's solve this step by step. When you start a command prompt and type where python, what do you get?

@issatayev
Copy link
Author

C:\Users\xyz\AppData\Local\Continuum\Anaconda2\python.exe

@fzumstein
Copy link
Member

Ok cool so is this the installation that you want to use with xlwings? if yes, then I would suggest to set PYTHON_WIN back to ""

@issatayev
Copy link
Author

Yes, this is the installation that I want to use. PYTHON_WIN is set back to ""

@fzumstein
Copy link
Member

OK, then I would suggest you run conda remove xlwings and pip uninstall xlwings. After that, open the Anaconda2 folder and confirm that there is no xlwings32/64.dll in the same folder as the python.exe. Also, navigate to site-packages folder and confirm that there is no xlwings folder and no other things like xlwings.... .egg etc. - If there's something, remove it manually. After that run pip install xlwings. Now check again and confirm that the dlls are now sitting in the same folder as python.exe.

@issatayev
Copy link
Author

I did all the steps and reinstalled xlwings. All dlls are in the same folder as python.exe

@fzumstein
Copy link
Member

OK, so make sure you're using the latest version of the VBA module and try again? same error?

@issatayev
Copy link
Author

Yes, I added again xlwings.bas file, and same error.

@fzumstein
Copy link
Member

When you go into the VBA module Alt-F11, then at the bottom of the module, click into the GetDLLVersion Sub and hit F5 - what happens?

@fzumstein
Copy link
Member

(Make sure you have the Immediate Window open Ctrl+G)

@issatayev
Copy link
Author

It shows same error: "Run-time error '53' File not found: xlwings32.dll"

@fzumstein
Copy link
Member

If you type echo %path% at a command prompt, does the C:\Users\xyz\AppData\Local\Continuum\Anaconda2 directory appear in front of any other python directories?

@issatayev
Copy link
Author

This is what i get when I type echo %path%

C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\Ph
ysX\Common;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS
Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\Syst
em32\WindowsPowerShell\v1.0;C:\Program Files\Intel\Intel(R) Management Engine C
omponents\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C
:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program
Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x
86)\Kaspersky Lab\Kaspersky Endpoint Security 10 for Windows;C:\Program Files (
x86)\GammaTech\TumarCSP\lib;C:\Program Files (x86)\GammaTech\TumarCSP\lib64;C:\b
lp\API;C:\blp\API\dde;C:\Users\xyz\AppData\Local\Continuum\Anaconda2;C
:\Users\xyz\AppData\Local\Continuum\Anaconda2\Scripts;C:\Users\nic_int
ern_01\AppData\Local\Continuum\Anaconda2\Library\bin;C:\Users\xyz\AppD
ata\Local\Continuum\Anaconda2\Lib\site-packages

@fzumstein
Copy link
Member

Looks good - For now 3 more suggestions:

  1. Restart Windows
  2. Try again by setting PYTHON_WIN to C:\Users\xyz\AppData\Local\Continuum\Anaconda2
  3. Try by using creating a conda environment and pointing to it with PYTHON_WIN

@fzumstein
Copy link
Member

Yermek, we found a possible cause in the difference of how we were compiling the dlls for ExcelPython vs. xlwings. Can you please try to replace the dlls that come with xlwings (next to python.exe) with the ones from the link (you should only need xlwings32.dll if you run it with 32-bit Excel)? If that solves your problem, we'll be fixing this with the next release.

xlwings32.dll
xlwings64.dll

@issatayev
Copy link
Author

Wow! Now it works perfectly. I just replaced my 2 dll files with what you provided, and it worked. Thank you so much!

@issatayev
Copy link
Author

Yesterday my colleague installed xlwings 0.6.1 by just entering "pip install xlwings" into Command Prompt, and UDFs worked without any errors. His computer, the version of Anaconda2 and Excel is the same as mine. What is the reason that was causing Run-time error on my computer but not his if we had the same xlwings32.dll file on both machines?

@fzumstein
Copy link
Member

Thanks for the feedback! This will be available with 0.6.2 then. The reason is that on some systems, the xlwings.dlls are not finding the correct version and bitness of the the Microsoft Visual C++ RuntimeDLLs. To fix that, they are now statically linked against C++ runtime.

@issatayev
Copy link
Author

Oh, I see. Thank you for helping me out!

@fzumstein
Copy link
Member

No problem, thanks for reporting!

@fzumstein fzumstein added the bug label Dec 11, 2015
@fzumstein fzumstein added this to the v0.6.2 milestone Dec 11, 2015
@fzumstein
Copy link
Member

Solved by PR #325

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants