Share via

Module not found when custom python package installed via shell script

KT 1 Reputation point
2021-02-07T17:30:50.957+00:00

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
0 comments No comments

1 answer

Sort by: Most helpful
  1. Ramr-msft 17,836 Reputation points
    2021-02-08T13:46:57.837+00:00

    @KT 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 Learn

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.