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

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".
Can anyone help me to figure out how to fix this error?

xlwings runs against the default Python installation (the one that you can invoke by just typing python at a command prompt) if you do not provide a path to your python.exe under the Function Settings > PYTHON_WIN, see the docs.
So either your default Python installation isn't the one where you have xlwings installed, or there's something wrong with your xlwings installation: Make sure you have the xlwings32.dll sitting next to your python.exe. If that is not the case, uninstall and reinstall xlwings using pip or conda.
If its going against the wrong Python installation, you can either fix your PATH or point to the specific Python interpreter via VBA settings.
Update: This was a bug that happend on certain system configurations and has been fixed with v0.6.2

Related

Problem importing torch in command prompt, but it works directly in VS code / Jupyter

I am trying to run a flask app in my command prompt on Windows 10. Whenever I try to run it, it errors out when trying to import torch. I have created a fresh environment and installed the latest pytorch from this page https://pytorch.org/get-started/locally/ but it still doesn't work in command prompt. Oddly, if I just execute code that says "import torch" in jupyter notebook or VS code, it doesn't error out. It only gives me the error in Command Prompt.
Does anyone know what the issue could be?
Short answer: If possible, use Anaconda Prompt. It's accessible from the Start Menu > Anaconda > Anaconda Prompt.
Long answer: The problem is due to the order of the different Python installations in the PATH variable, as you can see with echo %PATH%. System Python comes first, which can be seen with which python.
The recommendation is to use Anaconda Prompt, since it properly sets up the PATH variable with all required Anaconda paths. More importantly, it avoids interfering with other software in regular command prompt. So, your command prompt won't have any unintended consequences from using Anaconda.
If there is a reason that requires you to use regular command prompt, you can change the order with set PATH=C:\Anaconda\;%PATH% (temporary for this command prompt) or setx PATH=C:\Anaconda\;%PATH% (permanent). There are other libs that may be required to be included as well, which you can check by printing the PATH variable at the Anaconda Prompt.
Another option (Win10): Start Menu > type 'environment' > click 'Edit the system environment variables'. Click Advanced > Environment Variables... Double click Path and change the order between system Python and Anaconda Python.

Cant get pycharm to work get ERROR: The executable C:\Users\tedpo\PycharmProjects\untitled4\venv\Scripts\python.exe is not functioning

I cannot get pycharm to work.
I get the following error:
ERROR: The executable C:\Users\tedpo\PycharmProjects\untitled4\venv\Scripts\python.exe is not functioning
The log box indicated this error may be because it was installed as one user. I re-installed it, but did not see a dialog asking me if I wanted it this user or all users.
The log box has:
Using base prefix 'C:\\Python34'
New python executable in C:\Users\tedpo\PycharmProjects\untitled4\venv\Scripts\python.exe
ERROR: The executable C:\Users\tedpo\PycharmProjects\untitled4\venv\Scripts\python.exe is not functioning
ERROR: It thinks sys.prefix is 'c:\\users\\tedpo\\appdata\\local\\temp\\tmp8dhe0ylepycharm-management\\virtualenv-15.1.0' (should be 'c:\\users\\tedpo\\pycharmprojects\\untitled4\\venv')
ERROR: virtualenv is not compatible with this system or executable
Note: some Windows users have reported this error when they installed Python for "Only this user" or have multiple versions of Python installed. Copying the appropriate PythonXX.dll to the virtualenv Scripts/ directory may fix this problem.
Sorted this out by removing all python programs (I had multiple versions installed) and then reinstalling.
I had the same problem but I fixed it after deleting every older version of python I had and reinstalled pycharm.

Failing to install sqlite3 plugin for electron project on windows

I am trying to include sqlite3 in an electron project I am getting my hands dirty with. I have never used electron, nor Node before, excuse my ignorance. I understand that to do this on Windows, I need Python installed, I need to download sqlite3, and I need to install it.
As per the NPM sqlite3 page, I am trying to install it using npm install --build-from-source
It always fails with
unpack_sqlite_dep
'python' is not recognized as an internal or external command,
operable program or batch file.
I have Python 2.7 installed and the path has been added to environment variable PATH. I can verify that if I type 'python' in cmd, I get the same response. BUT, if I type 'py', it works....
So, my question is: how can I make node-gyp use the 'py' command instead of 'python' when trying to unpack sqlite3?
If this is not possible, how can I make 'python' an acceptable command to use?
I am using Windows 10 if this helps. Also, please let me know if I can do this whole procedure in a different way.
Thanks for any help!
This has been resolved....
Uninstalled Python 2.7.13. Reinstalled, added path to PATH variable again, now command 'python' works just fine...

spyder, numpy, anaconda : cannot import name multiarray

I am on Windows 10, 64bits, use Anaconda 4 and I created an environment with python 2.7 (C:/Anaconda3/envs/python2/python.exe)
In this environment, I successfully installed numpy and when I type "python", enter, "import numpy", enter, it works perfectly in the anaconda prompt window.
In spyder however, when I open a python console and type "import numpy", I get "cannot import name multiarray". I have obviously changed the path of the python interpreter used by spyder to match the python.exe of the environment I created (C:/Anaconda3/envs/python2/python.exe). I also updated the PYTHONSTARTUP to C:/Anaconda3/envs/python2/Lib/site-packages/spyderlib/scientific_startup.py
It's supposed to be the exact same python program running but it's two different behavior. How is it possible and how to fix it ?
PS: I already tried the various solutions to this error like uninstalling numpy and reinstalling it. It shouldn't be a problem with numpy since it works just fine in the python console of the anaconda prompt window.
I solved the problem by executing the spyder version of the python2 environment.
It is located in Anaconda3\envs\python2\Scripts\spyder.exe
I have encountered same issue. I have followed every possible solution, which is stated on stack-overflow. But no luck. The cause of error might be the python console. I have installed a 3.5 Anaconda, and the default console is the python 2.7, which I have installed primarily with pydev. I did this and now it is working absolutely fine. Go to tools>preferences and click on reset to defaults. It might solve the issue. Or another solution is to uninstall the current Anaconda i.e. y.x and installing the correct one according to the default. In my case 2.7 Anaconda instead of 3.5

Installing anaconda to use with windows

I am lost in the installation process of installing anaconda on windows.
I've installed the windows 32bit package (I'm running windows 7 x64)
I have anaconda in the start menu and I can open the python console and use scipy.stats.t.interval(), the function I am interested in.
However, how do I go about including this in another python program? I think it's something like adding it to the path. For instance, I have the scipy.stats.t.interval() function call in my other python file which I run through cygwin via python myscript.py. However it returns the error:
from scipy.stats import t
ImportError: No module named scipy.stats
I think it might be a change of path / add to path issue, but I'm not sure how to fix it :/. While I try to fix it, I figure I will post for help here.
well you might have two installations of python, one inside the anaconda package, and other which you might have installed earlier. try doing :
which python
from CygWin console.
If it returns:
/usr/bin
then it is definitely a add-to-path problem.
to fix it for CygWin,
you have to add the python installation from anaconda to the path.
try this fromn CygWin:
PATH=path-where-anaconda-is-installed/anaconda/bin:$PATH
and then doing:
which python
should give you:
/path-to-anaconda/anaconda/bin
and then it will work.
Cheers