user8579066
user8579066

Reputation: 31

How to import "scikit-multilearn" python library in Azure Machine learning

  1. We are trying to import "scikit-multilearn" library in python script and we are using this python script in Azure machine learning algorithm to achieve our goal.

    We have written our script in jupyter notebook and running our script in algorithm.

    while run the python script we are getting below error,

    ImportError Traceback (most recent call last) in () ----> 1 from skmultilearn.problem_transform import LabelPowerset 2

    ImportError: No module named 'skmultilearn'

    Need help in getting solution on the same.


Edited:

We have followed the steps mention above and through it successfully. Refer below image for details. enter image description here

But after adding the DataSet List, dragging it to the third node of the Execute Python Script in Machine learning experiment, we ran it and it throws the below error:

Error 0085: The following error
occurred during script evaluation, please view the output log for
more information:

---------- Start of error message from Python interpreter ---------- Caught exception while executing function: Traceback (most recent
call last):   File "C:\server\invokepy.py", line 189, in batch
    mod = import_module(moduleName)   File "C:\pyhome\lib\importlib\__init__.py", line 37, in import_module
    __import__(name)   File "C:\temp\f99d826a21174a1a87b0dfd39e10fcb5.py", line 16, in <module>
    from skmultilearn.adapt import MLkNN ImportError: No module named skmultilearn.adapt Process returned with non-zero exit code 1

---------- End of error message from Python  interpreter  ---------- Start time: UTC 12/21/2017 07:26:59 End time: UTC 12/21/2017 07:27:13

Also, we have written just “from skmultilearn.adapt import MLkNN” statement in the python script to check library import.

enter image description here

Upvotes: 0

Views: 4638

Answers (1)

Jay Gong
Jay Gong

Reputation: 23782

ImportError: No module named 'skmultilearn'

It seems that you did not import scikit-multilearn package successfully.

I offer the below steps for you to show how to import skmultilearn package in Execute Python Script.

Step 1 : Use the virtualenv component to create an independent python runtime environment in your system.Please install it first with command pip install virtualenv if you don't have it.

enter image description here

If you installed it successfully ,you could see it in your python/Scripts file.

enter image description here

Step2 : Run the commad to create independent python runtime environment.

enter image description here

Step 3 : Then go into the created directory's Scripts folder and activate it (this step is important , don't miss it)

enter image description here

Please don't close this command window and use pip install scikit-multilearn to download external libraries in this command window.

enter image description here

Step 4 : Compress all of the files in the Lib/site-packages folder into a zip package (I'm calling it scikit-multilearn- package here)

enter image description here

Step 5 :Upload the zip package into the Azure Machine Learning WorkSpace DataSet.

enter image description here

specific steps please refer to the Technical Notes.

After success, you will see the uploaded package in the DataSet List

enter image description here

Step 6 : After success, you will see the uploaded package in the DataSet List, dragging it to the third node of the Execute Python Script.

![enter image description here

Hope it helps you.

Upvotes: 1

Related Questions