Install Python Packages in Azure ML?

hhh picture hhh · Jun 5, 2017 · Viewed 8.1k times · Source

Similar question as here but now on Python packages. Currently, the CVXPY is missing in Azure ML. I am also trying to get other solvers such as GLPK, CLP and COINMP working in Azure ML.

How can I install Python packages in Azure ML?


Update about trying to install the Python packages not found in Azure ML.

I did as instructed by Peter Pan but I think the 32bits CVXPY files are wrong for the Anaconda 4 and Python 3.5 in Azure ML, logs and errors are here.

[Information]         Running with Python 3.5.1 |Anaconda 4.0.0 (64-bit)| (default, Feb 16 2016, 09:49:46) [MSC v.1900 64 bit (AMD64)]

enter image description here

enter image description here

enter image description here

Update 2 with win_amd64 files (paste here)

[Information]         Extracting Script Bundle.zip to .\Script Bundle
[Information]         File Name                                             Modified             Size
[Information]         cvxopt-1.1.9-cp35-cp35m-win_amd64.whl          2017-06-07 01:03:34      1972074
[Information]         __MACOSX/                                      2017-06-07 01:26:28            0
[Information]         __MACOSX/._cvxopt-1.1.9-cp35-cp35m-win_amd64.whl 2017-06-07 01:03:34          452
[Information]         cvxpy-0.4.10-py3-none-any.whl                  2017-06-07 00:25:36       300880
[Information]         __MACOSX/._cvxpy-0.4.10-py3-none-any.whl       2017-06-07 00:25:36          444
[Information]         ecos-2.0.4-cp35-cp35m-win_amd64.whl            2017-06-07 01:03:40        56522
[Information]         __MACOSX/._ecos-2.0.4-cp35-cp35m-win_amd64.whl 2017-06-07 01:03:40          450
[Information]         numpy-1.13.0rc2+mkl-cp35-cp35m-win_amd64.whl   2017-06-07 01:25:02    127909457
[Information]         __MACOSX/._numpy-1.13.0rc2+mkl-cp35-cp35m-win_amd64.whl 2017-06-07 01:25:02          459
[Information]         scipy-0.19.0-cp35-cp35m-win_amd64.whl          2017-06-07 01:05:12     12178932
[Information]         __MACOSX/._scipy-0.19.0-cp35-cp35m-win_amd64.whl 2017-06-07 01:05:12          452
[Information]         scs-1.2.6-cp35-cp35m-win_amd64.whl             2017-06-07 01:03:34        78653
[Information]         __MACOSX/._scs-1.2.6-cp35-cp35m-win_amd64.whl  2017-06-07 01:03:34          449
[Information]         [ READING ] 0:00:00
[Information]         Input pandas.DataFrame #1:
[Information]         Empty DataFrame
[Information]         Columns: [1]
[Information]         Index: []
[Information]         [ EXECUTING ] 0:00:00
[Information]         [ WRITING ] 0:00:00

where import cvxpy, import cvxpy-0.4.10-py3-none-any.whl or cvxpy-0.4.10-py3-none-any do not work so

How can I use the following wheel files downloaded from here to use the external Python packages not found in Azure ML?

Update about permission problem about importing cvxpy (paste here)

 [Error]         ImportError: No module named 'canonInterface'

where the ZIP Bundle is organised a bit differently, the content of each wheel downloaded to a folder and the content having all zipped as a ZIP Bundle.

Answer

Peter Pan picture Peter Pan · Jun 6, 2017

According to the Limitations and Technical Notes of Execute Python Script tutorial, the only way to add custom Python modules is via the zip file mechanism to package the modules and all dependencies.

For example to install CVXPY, as below.

  1. Download the wheel file of CVXPY and its dependencies like CVXOPT.
  2. Decompress these wheel files, and package these files in the path cvxpy and cvxopt, etc as a zipped file with your script.
  3. Upload the zip file as a dataset and use it as the script bundle.

If you were using IPython, you also can try to install the Python Package via the code !pip install cvxpy.

And there are some similar SO threads which may be helpful for you, as below.

  1. Azure ML Python with Script Bundle cannot import module
  2. How to install a Python package from within IPython?

Hope it helps.


Update:

For IPython interface of Azure ML, you move to the NOTEBOOKS tab to create a notebook via ADD TO PROJECT button at the bottom of the page, as the figure below.

enter image description here

Or you can directly login to the website https://notebooks.azure.com to use it.