question

KT-3471 avatar image
0 Votes"
KT-3471 asked ·

Module not found when custom python package installed via shell script

Hi All,

I am using Azure ML designer to run zipped python scripts. But the code is complaining about the 'No module Found' error.
From the main python script where azureml_main() is present I am calling a bash script using following call:

 proc = call(["bash", "Script Bundle/setup.sh"])

 # /bin/bash
 echo "Hello World !!!"
 pip install -r 'Script Bundle/requirement.txt'
 python account_test.py

   

 #account_test.py
 import os
 import json
 import xmltodict
    
 from bankaccount import BankAccount
    
 my_account = BankAccount(50)
 my_account.withdraw(5)
 print (my_account.balance, my_account.overdrawn())
    
 with open('Script Bundle/person.json') as f:
    data = json.load(f)
    print(data)
    
 with open('Script Bundle/sample.xml') as fd:
     doc = xmltodict.parse(fd.read())
     print(doc)

Inside the bash script I am installing the custom module using pip and immediately calling an entry python script(python account_test.py) to call a chain of scripts. But the code is unable to find the module(xmltodict) and is failing eventually.

My assumption is the module is getting installed in a separate process and main process do not have access to that. But I tried with calling the python file from same shell script, still it is not working.

Looking for your help.



azure-machine-learning
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ramr-msft avatar image
0 Votes"
ramr-msft answered ·

@KT-3471 Thanks for the question. Could you please share link to the code to check on this. Here is the doc for supported python packages.
There’s a trouble shooting doc: Troubleshoot designer module errors - Azure Machine Learning | Microsoft Docs


·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.