Alteryx Designer Desktop Discussions

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

Python import library error

messi007
15 - Aurora
15 - Aurora

Dear Alteryx Community,

 

I have a pyhton code that's run correctly from jupter.

However when I try to excute the code throw Python component it display the error

ModuleNotFoundError                       Traceback (most recent call last)

It's because I can't import the library 

import openpyxl

I tried  Package.installPackages(['openpyxl']) same error

 

My code is used to connect to an excel workbook and extract each sheet in new a workbook that work fine outside Alteryx.

 

 

import openpyxl
from openpyxl import load_workbook, Workbook
wb = openpyxl.load_workbook(r"My workbook") 
for sheet in wb.worksheets:
new_wb = Workbook()
ws = new_wb.active
for row_data in sheet.iter_rows():
for row_cell in row_data:
ws[row_cell.coordinate].value = row_cell.value
Racine=("My destination")
new_wb.save('{0}.xlsx'.format(Racine+sheet.title))

 

Many thanks in advance for help,

 

Regards,

4 REPLIES 4
wwatson
12 - Quasar

I think you have to run Alteryx in Admin mode to import the Python libraries. Right click on the Alteryx icon and choose Run as administrator.

wwatson_0-1595070870001.png

 

c-lopez
Alteryx
Alteryx

Hi @messi007,

 

@wwatson is correct, you need to run Designer as admin when you run the 

Package.installPackages(['openpyxl']) 

command. After you run it as admin you should be able to use it in non-admin mode after.

 

 

messi007
15 - Aurora
15 - Aurora

Hello,

 

Thanks @c-lopez and @wwatson  for the answers,

I succeeded to install the package 🙂 

 

Regards,

snigdha25
7 - Meteor

Hi,

 

I am getting the same error. I am running the packages in trail version of Alteryx does that create issue? I executed Alteryx as administrator still the issue exists. 

Labels