Need to update scikit learn packages in Azure ML studio RRS feed

  • Question

  • Hi All ,

    I am currently having scikit learn version 0.17 in Azure ML studio. I am currently using scikit learn V 0.20 in my local and have done some coding based on that. Now when I try to execute same python script in Azure ML studio , it displays error because of the difference in scikit learn packages(due to unavailability of few functions) . I have tried downloading the .whl files and zipped and uploaded as data set and tried using it with execute python script, but still facing the error and not able able to proceed further. Please let me know how to resolve this error.

    Monday, October 22, 2018 10:58 AM

All replies

  • Try zipping the folder called sklearn in your local environment (not the wheel file), it should be in your_environment\Lib\site-packages. Then upload the zipped file as a dataset and use it with the Execute Python Script module, it should work.

    Let us know!

    Tuesday, October 23, 2018 2:59 PM
  • Hi Ariel ,

    Thanks for your answer. I tried it , but still I am getting same error saying "truncated svd does not have attribute singular_values". My zipped file contains even truncated_svd.py script as well.

    After uploading it as zip, I have connected to the execute python script and inside script I mentioned name like import scikit-learn. Should I use import statement in the script part or not?  Please let me know.

    Wednesday, October 24, 2018 7:15 AM
  • Hi!

    yes, you must import sklearn within your script in the Execute Python Script module. Probably the sklearn version imported is still being the old one. Try to verify this by using print(sklearn.__version__) in the script after the import.

    One thing you could try to do is upgrading the sklearn version from an azure notebook, you can open a notebook from your AML Studio workspace. Another option could be to delete the current package (using del sys.modules['sklearn']) before importing the one uploaded by you.

    Wednesday, October 24, 2018 9:29 AM
  • Hi Ariel ,

    I have tried as you said and facing below issues:

    • del sys.modules['sklearn']) - Executed this with in execute python script , but it is not getting uninstalled. After running this, still I could see version as 0.17. Due to this , I believe even after importing newer version as .zip , still getting error "Attribute is missing".
    • Coming to Azure notebooks , I could upgrade the version using pip -install scikit-learn -U . scikit-learn is getting updated to 0.20 version. But the issue here is , as long as Azure notebook is open newer version would be present but the moment when we close the Azure notebook  scikit-learn is getting back to older version.
    Wednesday, October 24, 2018 7:44 PM
  • Any resolution to this one? Facing the same issue.
    • Proposed as answer by Hermes Morales Saturday, January 11, 2020 2:44 PM
    Wednesday, April 10, 2019 7:15 AM
  • I am having the same problem. Now with scikit-learn 0.20.1, I need 0.22.1...
    Saturday, January 11, 2020 2:45 PM
  • We are having the same issue as well. I am pretty sure updating Python packages from notebook doesn't have any effect on the Python Script Executer because the latter is running in a different sandbox. The only way to use new version of packages is to download them manually and create a bundled zip, then link that bundle to the third input parameter of Python Script Executer.
    Thursday, January 16, 2020 11:45 PM