MachineLearningNotebooks icon indicating copy to clipboard operation
MachineLearningNotebooks copied to clipboard

i couldnt import AutoMLConfig in my script

Open omnekkanti opened this issue 7 years ago • 7 comments

Traceback (most recent call last): File "c:/Users/Om/Documents/ArcGIS 10.6.1/Automated ML/automl.py", line 9, in from azureml.train.automl import AutoMLConfig File "C:\Users\Om\Anaconda3\envs\myenv\lib\site-packages\azureml\train\automl_init_.py", line 20, in from automl.client.core.common.utilities import extract_user_data, get_sdk_dependencies File "c:\Users\Om\Documents\ArcGIS 10.6.1\Automated ML\automl.py", line 9, in from azureml.train.automl import AutoMLConfig ImportError: cannot import name 'AutoMLConfig'

I created an environment using python 3.6.5. I read azure documentation on setting up dev environment (https://docs.microsoft.com/en-us/azure/machine-learning/service/how-to-configure-environment#local). It says following

any specific python subversions can be chosen. SDK compatibility may not be guaranteed with certain major versions (3.5+ is recommended), and it's recommended to try a different version/subversion in your Anaconda environment if you run into errors. It will take several minutes to create the environment while components and packages are downloaded.

omnekkanti avatar Apr 19 '19 04:04 omnekkanti

I was able to create the environment with python 3.6.5 and had no issues importing AutoMLConfig.

How did you create the environment and install the packages? We have scripts that you can use for setting up the environment on windows, linux and mac. (automl_setup.cmd, automl_setup_linux.sh and automl_setup_mac.sh)

https://github.com/Azure/MachineLearningNotebooks/tree/master/how-to-use-azureml/automated-machine-learning

deeptim123 avatar Apr 22 '19 19:04 deeptim123

I created new environment in conda, activated it, ran the following comands in order shown below conda install notebook ipykernel ipython kernel install --user pip install azureml-sdk[notebooks,automl] pip install azureml-dataprep

I tried importing in azurenotebooks as it comes pre-installed with all azure SDKs and "from azureml.train.automl import AutoMLConfig" failed in notebooks as well.

I ran the automl_setup_mac.sh with corresponding yaml file. It created an environment for me but it showed the following error. Screen Shot 2019-04-22 at 6 40 18 PM

Also, i tried to run my python script in terminal in new environment(azure_automl) created by the script. It gave me following error message Screen Shot 2019-04-22 at 6 46 43 PM

I tried using "from azureml.train.automl import *" in my script instead and ran it again and it gave me this error. Screen Shot 2019-04-22 at 6 47 06 PM

Please let me know what i am missing. This is the github link(https://github.com/omnekkanti/MLSERVICE) for my script. put those 3 files(automl.py,config.json,cuformodel.csv) in one folder to run it.

omnekkanti avatar Apr 22 '19 23:04 omnekkanti

@wchill

skasturi avatar Apr 29 '19 17:04 skasturi

@omnekkanti can you try from azureml.train.automl.automlconfig import AutoMLConfig? I suspect we have some wonky circular imports going on here for some reason.

wchill avatar Apr 29 '19 17:04 wchill

Actually, I just noticed you named your script automl.py. Can you try naming it something else? This is probably causing the circular import.

wchill avatar Apr 29 '19 17:04 wchill

I had the same issue as OP, renaming my oh-so-aptly-named automl.py to something else fixed the issue. Thanks @wchill !

vladiliescu avatar May 05 '19 14:05 vladiliescu

Closed per wchill

kenkadota avatar Jun 20 '19 16:06 kenkadota