Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

pandas read_excel from outside file (xlrd needed?)

DanWhalen
7 - Meteor

I'm trying to use the Python tool to bring in data using pd.read_excel("/path/"). However, when I do, I get an error:

 

ModuleNotFoundError Traceback (most recent call last)
c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\pandas\io\excel.py in __init__(self, io, **kwds)
351 try:
--> 352 import xlrd
353 except ImportError:

ModuleNotFoundError: No module named 'xlrd'


Does that mean xlrd is a dependency for pandas when trying to use read_excel?  If that's the case, is there any way to use pandas for reading in outside data files?

17 REPLIES 17
EricPatterson
5 - Atom

Hi Andrew,

 

Thank you for the helpful responses and discussion. I am going through the same process as Dan and I am getting a 'Called Process Error' when I try to install the xlrd package. 

 

Here is the full error message: 

CalledProcessError: Command '['c:\\program files\\alteryx\\bin\\miniconda3\\pythontool_venv\\scripts\\python.exe', '-m', 'pip', 'install', 'xlrd']' returned non-zero exit status 2

 

AndrewKramer
Alteryx Alumni (Retired)

Can you post your entire log? The traceback that comes after the error message explains why the command failed.

 

Are you running Alteryx in administrator mode?

EricPatterson
5 - Atom

Thank you for your response!

 

Here is the full log:

 

Python (21) ---------------------------------------------------------------------------¶CalledProcessError Traceback (most recent call last)¶<ipython-input-1-36bb2af59858> in <module>¶ 2 # script here (only missing packages will be installed)¶ 3 from ayx import Package¶----> 4 Package.installPackages(['xlrd'])¶ 5 #Package.installPackages(['pandas','numpy'])¶c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\ayx\Package.py in installPackages(package, install_type, debug)¶ 112 print(pip_install_result['msg'])¶ 113 if not pip_install_result['success']:¶--> 114 raise pip_install_result['err']¶c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\ayx\Utils.py in runSubprocess(args_list, debug)¶ 39 result = subprocess.check_output(¶ 40 args_list,¶---> 41 stderr = subprocess.STDOUT¶ 42 )¶ 43 if debug:¶C:\Program Files\Alteryx\bin\Miniconda3\lib\subprocess.py in check_output(timeout, *popenargs, **kwargs)¶ 334 ¶ 335 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,¶--> 336 **kwargs).stdout¶ 337 ¶ 338 ¶C:\Program Files\Alteryx\bin\Miniconda3\lib\subprocess.py in run(input, timeout, check, *popenargs, **kwargs)¶ 416 if check and retcode:¶ 417 raise CalledProcessError(retcode, process.args,¶--> 418 output=stdout, stderr=stderr)¶ 419 return CompletedProcess(process.args, retcode, stdout, stderr)¶ 420 ¶CalledProcessError: Command '['c:\\program files\\alteryx\\bin\\miniconda3\\pythontool_venv\\scripts\\python.exe', '-m', 'pip', 'install', 'xlrd']' returned non-zero exit status 2.¶

 

The relevant cell that is failing is this:

from ayx import Package
Package.installPackages(['xlrd']) #I tried removing the brackets as well

 

I am running as administrator.

 

AndrewKramer
Alteryx Alumni (Retired)

What do you have above the calledprocesserror? Can you post that part of the log?

EricPatterson
5 - Atom

Hi Andrew,

 

The issue appears to have resolved itself after stepping away for the night and coming back this morning. I'm not sure as to why.

Thank you for your help

oneillp111
9 - Comet

I am able to do it via this line

 

!pip install --proxy=https://NTUser:NTPassword@proxyserver:port openpyxl

 

Promydia
5 - Atom

I have had the same problem. I noticed that it fails then it tries to create a folder in the Alteryx Miniconda Env folder. 

When I tried to do it manually it required me to continue as admin.

Promydia_1-1651068899449.png

 

When I restarted the Alteryx app in admin mode:

 

Promydia_0-1651068749464.png

 

Then I ran:

from ayx import Package
Package.installPackages(['xlrd', '-q'])

 

and it works!

 

Promydia_3-1651069057555.png

PhaniV
8 - Asteroid

Agree with you!

 

Here is the explanation and solution that I came across, adding the reference link below , it would help users like me who lands on this discussion.

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Reading-entire-folder-of-Excel-files-a...

Labels