在Azure ML中安装Python包?

时间:2017-06-05 14:52:19

标签: python azure azure-machine-learning-studio cvxpy

here类似的问题,但现在在Python包上。目前,Azure ML中缺少CVXPY。我也试图让其他解决方案,如GLPK,CLP和COINMP在Azure ML中工作。

如何在Azure ML中安装Python包?

有关尝试安装Azure ML中未找到的Python软件包的更新。

  

我是按照Peter Pan的指示做的,但我认为32位CVXPY文件对于Azure ML中的Anaconda 4和Python 3.5是错误的,日志和错误是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

使用win_amd64文件更新2(粘贴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
     

其中import cvxpyimport cvxpy-0.4.10-py3-none-any.whlcvxpy-0.4.10-py3-none-any不起作用

     

如何使用从here下载的以下滚轮文件来使用Azure ML中未找到的外部Python包?

有关导入cvxpy的权限问题的更新(粘贴here

 [Error]         ImportError: No module named 'canonInterface'
     

其中ZIP Bundle的组织方式略有不同,每个轮子的内容都下载到一个文件夹,而所有内容都压缩为ZIP捆绑包。

3 个答案:

答案 0 :(得分:2)

根据Count(CASE WHEN c.status = 'PRESENT' THEN 1 END)教程的LimitationsTechnical Notes,添加自定义Python模块的唯一方法是通过zip文件机制打包模块和所有依赖项。

例如,安装Execute Python Script,如下所示。

  1. 下载CVXPY及其依赖项(例如CVXOPT
  2. 的wheel文件
  3. 解压缩这些轮文件,并将这些文件打包在路径CVXPYcvxpy等中,并将其作为压缩文件与脚本一起打包。
  4. 将zip文件上传为数据集,并将其用作脚本包。
  5. 如果您使用的是IPython,您也可以尝试通过代码cvxopt安装Python包。

    并且有一些类似的SO主题可能会对您有所帮助,如下所示。

    1. Azure ML Python with Script Bundle cannot import module
    2. How to install a Python package from within IPython?
    3. 希望它有所帮助。

      更新

      对于Azure ML的IPython界面,您可以移至!pip install cvxpy标签,通过页面底部的NOTEBOOKS按钮创建笔记本,如下图所示。

      enter image description here

      或者您可以直接登录网站ADD TO PROJECT来使用它。

答案 1 :(得分:1)

我将演示Peter Pan的答案here,然后我首先展示一个外部包装的实验实验。为外部软件包CVXPY构建ZIP Bundle并不是那么简单但有教育意义。

使用Azure ML中的ZIP Bundle演示外部包

这是一个关于在Smit Shah提供的Python脚本模块中使用附加包的工作示例

  

https://gallery.cortanaintelligence.com/Experiment/Python-additional-package

其中

enter image description here

[Information]         Extracting Script Bundle.zip to .\Script Bundle
[Information]         File Name                                             Modified             Size
[Information]         adal/__init__.py                               2017-05-01 10:03:04         1822
[Information]         adal/__init__.pyc                              2017-05-01 10:03:12          629
[Information]         adal/adal_error.py                             2017-05-01 10:03:04         1553
[Information]         adal/adal_error.pyc                            2017-05-01 10:03:12          685
[Information]         adal/argument.py                               2017-05-01 10:03:04         2023
[Information]         adal/argument.pyc                              2017-05-01 10:03:12          837
[Information]         adal/authentication_context.py                 2017-05-01 10:03:04        13766
[Information]         adal/authentication_context.pyc                2017-05-01 10:03:12        14198
[Information]         adal/authentication_parameters.py              2017-05-01 10:03:04         8195
[Information]         adal/authentication_parameters.pyc             2017-05-01 10:03:12         4820
[Information]         adal/authority.py                              2017-05-01 10:03:04         6908
[Information]         adal/authority.pyc                             2017-05-01 10:03:12         6091
[Information]         adal/cache_driver.py                           2017-05-01 10:03:04         9773
[Information]         adal/cache_driver.pyc                          2017-05-01 10:03:12         9293
[Information]         adal/code_request.py                           2017-05-01 10:03:04         2744
[Information]         adal/code_request.pyc                          2017-05-01 10:03:12         2225
[Information]         adal/constants.py                              2017-05-01 10:03:04         7359
[Information]         adal/constants.pyc                             2017-05-01 10:03:12         9305
[Information]         adal/log.py                                    2017-05-01 10:03:04         4058
[Information]         adal/log.pyc                                   2017-05-01 10:03:12         3699
[Information]         adal/mex.py                                    2017-05-01 10:03:04        11186
[Information]         adal/mex.pyc                                   2017-05-01 10:03:12         8804
[Information]         adal/oauth2_client.py                          2017-05-01 10:03:04        14196
[Information]         adal/oauth2_client.pyc                         2017-05-01 10:03:12        11619
[Information]         adal/self_signed_jwt.py                        2017-05-01 10:03:04         4823
[Information]         adal/self_signed_jwt.pyc                       2017-05-01 10:03:12         5301
[Information]         adal/token_cache.py                            2017-05-01 10:03:04         4761
[Information]         adal/token_cache.pyc                           2017-05-01 10:03:12         4883
[Information]         adal/token_request.py                          2017-05-01 10:03:04        17703
[Information]         adal/token_request.pyc                         2017-05-01 10:03:12        15096
[Information]         adal/user_realm.py                             2017-05-01 10:03:04         6362
[Information]         adal/user_realm.pyc                            2017-05-01 10:03:12         5325
[Information]         adal/util.py                                   2017-05-01 10:03:04         3567
[Information]         adal/util.pyc                                  2017-05-01 10:03:12         2723
[Information]         adal/wstrust_request.py                        2017-05-01 10:03:04         8402
[Information]         adal/wstrust_request.pyc                       2017-05-01 10:03:12         6816
[Information]         adal/wstrust_response.py                       2017-05-01 10:03:04         8751
[Information]         adal/wstrust_response.pyc                      2017-05-01 10:03:12         5467
[Information]         adal/xmlutil.py                                2017-05-01 10:03:04         2806
[Information]         adal/xmlutil.pyc                               2017-05-01 10:03:12         2309
[Information]         cryptography/__about__.py                      2017-04-27 17:51:38          817
[Information]         cryptography/__about__.pyc                     2017-04-27 17:51:50          892
[Information]         cryptography/__init__.py                       2017-04-27 17:51:38          829
[Information]         cryptography/__init__.pyc                      2017-04-27 17:51:50          962
[Information]         cryptography/exceptions.py                     2017-04-27 17:51:38         1234
[Information]         cryptography/exceptions.pyc                    2017-04-27 17:51:50         3406
[Information]         cryptography/fernet.py                         2017-04-27 17:51:38         4305
[Information]         cryptography/fernet.pyc                        2017-04-27 17:51:50         5670
[Information]         cryptography/hazmat/                           2017-04-27 17:51:50            0
[Information]         cryptography/hazmat/__init__.py                2017-04-27 17:51:38          483
[Information]         cryptography/hazmat/__init__.pyc               2017-04-27 17:51:50          560
[Information]         cryptography/hazmat/backends/                  2017-04-27 17:51:50            0
[Information]         cryptography/hazmat/backends/__init__.py       2017-04-27 17:51:38         2403
[Information]         cryptography/hazmat/backends/__init__.pyc      2017-04-27 17:51:50         1783
[Information]         cryptography/hazmat/backends/commoncrypto/     2017-04-27 17:51:50            0
[Information]         cryptography/hazmat/backends/commoncrypto/__init__.py 2017-04-27 17:51:38          341
[Information]         cryptography/hazmat/backends/commoncrypto/__init__.pyc 2017-04-27 17:51:50          448
[Information]         cryptography/hazmat/backends/commoncrypto/backend.py 2017-04-27 17:51:38         8840
[Information]         cryptography/hazmat/backends/commoncrypto/backend.pyc 2017-04-27 17:51:50         9402
[Information]         cryptography/hazmat/backends/commoncrypto/ciphers.py 2017-04-27 17:51:38         9362
[Information]         cryptography/hazmat/backends/commoncrypto/ciphers.pyc 2017-04-27 17:51:50         8265
[Information]         cryptography/hazmat/backends/commoncrypto/hashes.py 2017-04-27 17:51:38         2040
[Information]         cryptography/hazmat/backends/commoncrypto/hashes.pyc 2017-04-27 17:51:50         2884
[Information]         cryptography/hazmat/backends/commoncrypto/hmac.py 2017-04-27 17:51:38         2188
[Information]         cryptography/hazmat/backends/commoncrypto/hmac.pyc 2017-04-27 17:51:50         3231
[Information]         cryptography/hazmat/backends/interfaces.py     2017-04-27 17:51:38        10493
[Information]         cryptography/hazmat/backends/interfaces.pyc    2017-04-27 17:51:50        21555
[Information]         cryptography/hazmat/backends/multibackend.py   2017-04-27 17:51:38        19700
[Information]         cryptography/hazmat/backends/multibackend.pyc  2017-04-27 17:51:50        25269
[Information]         cryptography/hazmat/backends/openssl/          2017-04-27 17:51:50            0
[Information]         cryptography/hazmat/backends/openssl/__init__.py 2017-04-27 17:51:38          336
[Information]         cryptography/hazmat/backends/openssl/__init__.pyc 2017-04-27 17:51:50          438
[Information]         cryptography/hazmat/backends/openssl/backend.py 2017-04-27 17:51:38        68646
[Information]         cryptography/hazmat/backends/openssl/backend.pyc 2017-04-27 17:51:50        64293
[Information]         cryptography/hazmat/backends/openssl/ciphers.py 2017-04-27 17:51:38         7665
[Information]         cryptography/hazmat/backends/openssl/ciphers.pyc 2017-04-27 17:51:50         6101
[Information]         cryptography/hazmat/backends/openssl/cmac.py   2017-04-27 17:51:38         2797
[Information]         cryptography/hazmat/backends/openssl/cmac.pyc  2017-04-27 17:51:50         3668
[Information]         cryptography/hazmat/backends/openssl/decode_asn1.py 2017-04-27 17:51:38        29210
[Information]         cryptography/hazmat/backends/openssl/decode_asn1.pyc 2017-04-27 17:51:50        28941
[Information]         cryptography/hazmat/backends/openssl/dh.py     2017-04-27 17:51:38         9945
[Information]         cryptography/hazmat/backends/openssl/dh.pyc    2017-04-27 17:51:50        10966
[Information]         cryptography/hazmat/backends/openssl/dsa.py    2017-04-27 17:51:38        10044
[Information]         cryptography/hazmat/backends/openssl/dsa.pyc   2017-04-27 17:51:50        12467
[Information]         cryptography/hazmat/backends/openssl/ec.py     2017-04-27 17:51:38         9914
[Information]         cryptography/hazmat/backends/openssl/ec.pyc    2017-04-27 17:51:50        12615
[Information]         cryptography/hazmat/backends/openssl/encode_asn1.py 2017-04-27 17:51:38        22285
[Information]         cryptography/hazmat/backends/openssl/encode_asn1.pyc 2017-04-27 17:51:50        22267
[Information]         cryptography/hazmat/backends/openssl/hashes.py 2017-04-27 17:51:38         2532
[Information]         cryptography/hazmat/backends/openssl/hashes.pyc 2017-04-27 17:51:50         3185
[Information]         cryptography/hazmat/backends/openssl/hmac.py   2017-04-27 17:51:38         2980
[Information]         cryptography/hazmat/backends/openssl/hmac.pyc  2017-04-27 17:51:50         3732
[Information]         cryptography/hazmat/backends/openssl/rsa.py    2017-04-27 17:51:38        18610
[Information]         cryptography/hazmat/backends/openssl/rsa.pyc   2017-04-27 17:51:50        17931
[Information]         cryptography/hazmat/backends/openssl/utils.py  2017-04-27 17:51:38          862
[Information]         cryptography/hazmat/backends/openssl/utils.pyc 2017-04-27 17:51:50         1088
[Information]         cryptography/hazmat/backends/openssl/x509.py   2017-04-27 17:51:38        15804
[Information]         cryptography/hazmat/backends/openssl/x509.pyc  2017-04-27 17:51:50        23091
[Information]         cryptography/hazmat/bindings/                  2017-04-27 17:51:50            0
[Information]         cryptography/hazmat/bindings/__init__.py       2017-04-27 17:51:38          246
[Information]         cryptography/hazmat/bindings/__init__.pyc      2017-04-27 17:51:50          313
[Information]         cryptography/hazmat/bindings/_constant_time.pyd 2017-04-27 17:51:38         8192
[Information]         cryptography/hazmat/bindings/_openssl.pyd      2017-04-27 17:51:38      2754560
[Information]         cryptography/hazmat/bindings/_padding.pyd      2017-04-27 17:51:38         8704
[Information]         cryptography/hazmat/bindings/commoncrypto/     2017-04-27 17:51:50            0
[Information]         cryptography/hazmat/bindings/commoncrypto/__init__.py 2017-04-27 17:51:38          246
[Information]         cryptography/hazmat/bindings/commoncrypto/__init__.pyc 2017-04-27 17:51:50          326
[Information]         cryptography/hazmat/bindings/commoncrypto/binding.py 2017-04-27 17:51:38          410
[Information]         cryptography/hazmat/bindings/commoncrypto/binding.pyc 2017-04-27 17:51:50          785
[Information]         cryptography/hazmat/bindings/openssl/          2017-04-27 17:51:50            0
[Information]         cryptography/hazmat/bindings/openssl/__init__.py 2017-04-27 17:51:38          246
[Information]         cryptography/hazmat/bindings/openssl/__init__.pyc 2017-04-27 17:51:50          321
[Information]         cryptography/hazmat/bindings/openssl/_conditional.py 2017-04-27 17:51:38         8854
[Information]         cryptography/hazmat/bindings/openssl/_conditional.pyc 2017-04-27 17:51:50         8138
[Information]         cryptography/hazmat/bindings/openssl/binding.py 2017-04-27 17:51:38         5067
[Information]         cryptography/hazmat/bindings/openssl/binding.pyc 2017-04-27 17:51:50         5118
[Information]         cryptography/hazmat/primitives/                2017-04-27 17:51:50            0
[Information]         cryptography/hazmat/primitives/__init__.py     2017-04-27 17:51:38          246
[Information]         cryptography/hazmat/primitives/__init__.pyc    2017-04-27 17:51:50          315
[Information]         cryptography/hazmat/primitives/asymmetric/     2017-04-27 17:51:50            0
[Information]         cryptography/hazmat/primitives/asymmetric/__init__.py 2017-04-27 17:51:38         1020
[Information]         cryptography/hazmat/primitives/asymmetric/__init__.pyc 2017-04-27 17:51:50         2305
[Information]         cryptography/hazmat/primitives/asymmetric/dh.py 2017-04-27 17:51:38         5093
[Information]         cryptography/hazmat/primitives/asymmetric/dh.pyc 2017-04-27 17:51:50        10298
[Information]         cryptography/hazmat/primitives/asymmetric/dsa.py 2017-04-27 17:51:38         6890
[Information]         cryptography/hazmat/primitives/asymmetric/dsa.pyc 2017-04-27 17:51:50        13468
[Information]         cryptography/hazmat/primitives/asymmetric/ec.py 2017-04-27 17:51:38         9570
[Information]         cryptography/hazmat/primitives/asymmetric/ec.pyc 2017-04-27 17:51:50        18550
[Information]         cryptography/hazmat/primitives/asymmetric/padding.py 2017-04-27 17:51:38         2261
[Information]         cryptography/hazmat/primitives/asymmetric/padding.pyc 2017-04-27 17:51:50         4322
[Information]         cryptography/hazmat/primitives/asymmetric/rsa.py 2017-04-27 17:51:38        10226
[Information]         cryptography/hazmat/primitives/asymmetric/rsa.pyc 2017-04-27 17:51:50        15084
[Information]         cryptography/hazmat/primitives/asymmetric/utils.py 2017-04-27 17:51:38         1704
[Information]         cryptography/hazmat/primitives/asymmetric/utils.pyc 2017-04-27 17:51:50         2984
[Information]         cryptography/hazmat/primitives/ciphers/        2017-04-27 17:51:50            0
[Information]         cryptography/hazmat/primitives/ciphers/__init__.py 2017-04-27 17:51:38          574
[Information]         cryptography/hazmat/primitives/ciphers/__init__.pyc 2017-04-27 17:51:50          654
[Information]         cryptography/hazmat/primitives/ciphers/algorithms.py 2017-04-27 17:51:38         3424
[Information]         cryptography/hazmat/primitives/ciphers/algorithms.pyc 2017-04-27 17:51:50         7930
[Information]         cryptography/hazmat/primitives/ciphers/base.py 2017-04-27 17:51:38         7663
[Information]         cryptography/hazmat/primitives/ciphers/base.pyc 2017-04-27 17:51:50        12557
[Information]         cryptography/hazmat/primitives/ciphers/modes.py 2017-04-27 17:51:38         5517
[Information]         cryptography/hazmat/primitives/ciphers/modes.pyc 2017-04-27 17:51:50         9165
[Information]         cryptography/hazmat/primitives/cmac.py         2017-04-27 17:51:38         2235
[Information]         cryptography/hazmat/primitives/cmac.pyc        2017-04-27 17:51:50         3192
[Information]         cryptography/hazmat/primitives/constant_time.py 2017-04-27 17:51:38          798
[Information]         cryptography/hazmat/primitives/constant_time.pyc 2017-04-27 17:51:50         1237
[Information]         cryptography/hazmat/primitives/hashes.py       2017-04-27 17:51:38         5081
[Information]         cryptography/hazmat/primitives/hashes.pyc      2017-04-27 17:51:50         9263
[Information]         cryptography/hazmat/primitives/hmac.py         2017-04-27 17:51:38         2353
[Information]         cryptography/hazmat/primitives/hmac.pyc        2017-04-27 17:51:50         3322
[Information]         cryptography/hazmat/primitives/interfaces/     2017-04-27 17:51:50            0
[Information]         cryptography/hazmat/primitives/interfaces/__init__.py 2017-04-27 17:51:38          884
[Information]         cryptography/hazmat/primitives/interfaces/__init__.pyc 2017-04-27 17:51:50         1961
[Information]         cryptography/hazmat/primitives/kdf/            2017-04-27 17:51:50            0
[Information]         cryptography/hazmat/primitives/kdf/__init__.py 2017-04-27 17:51:38          771
[Information]         cryptography/hazmat/primitives/kdf/__init__.pyc 2017-04-27 17:51:50         1473
[Information]         cryptography/hazmat/primitives/kdf/concatkdf.py 2017-04-27 17:51:38         4109
[Information]         cryptography/hazmat/primitives/kdf/concatkdf.pyc 2017-04-27 17:51:50         5908
[Information]         cryptography/hazmat/primitives/kdf/hkdf.py     2017-04-27 17:51:38         3674
[Information]         cryptography/hazmat/primitives/kdf/hkdf.pyc    2017-04-27 17:51:50         4986
[Information]         cryptography/hazmat/primitives/kdf/kbkdf.py    2017-04-27 17:51:38         5017
[Information]         cryptography/hazmat/primitives/kdf/kbkdf.pyc   2017-04-27 17:51:50         5610
[Information]         cryptography/hazmat/primitives/kdf/pbkdf2.py   2017-04-27 17:51:38         2185
[Information]         cryptography/hazmat/primitives/kdf/pbkdf2.pyc  2017-04-27 17:51:50         2813
[Information]         cryptography/hazmat/primitives/kdf/scrypt.py   2017-04-27 17:51:38         2252
[Information]         cryptography/hazmat/primitives/kdf/scrypt.pyc  2017-04-27 17:51:50         2957
[Information]         cryptography/hazmat/primitives/kdf/x963kdf.py  2017-04-27 17:51:38         2363
[Information]         cryptography/hazmat/primitives/kdf/x963kdf.pyc 2017-04-27 17:51:50         3296
[Information]         cryptography/hazmat/primitives/keywrap.py      2017-04-27 17:51:38         3050
[Information]         cryptography/hazmat/primitives/keywrap.pyc     2017-04-27 17:51:50         3136
[Information]         cryptography/hazmat/primitives/padding.py      2017-04-27 17:51:38         5736
[Information]         cryptography/hazmat/primitives/padding.pyc     2017-04-27 17:51:50        10471
[Information]         cryptography/hazmat/primitives/serialization.py 2017-04-27 17:51:38         5288
[Information]         cryptography/hazmat/primitives/serialization.pyc 2017-04-27 17:51:50         8668
[Information]         cryptography/hazmat/primitives/twofactor/      2017-04-27 17:51:50            0
[Information]         cryptography/hazmat/primitives/twofactor/__init__.py 2017-04-27 17:51:38          288
[Information]         cryptography/hazmat/primitives/twofactor/__init__.pyc 2017-04-27 17:51:50          607
[Information]         cryptography/hazmat/primitives/twofactor/hotp.py 2017-04-27 17:51:38         2589
[Information]         cryptography/hazmat/primitives/twofactor/hotp.pyc 2017-04-27 17:51:50         3808
[Information]         cryptography/hazmat/primitives/twofactor/totp.py 2017-04-27 17:51:38         1594
[Information]         cryptography/hazmat/primitives/twofactor/totp.pyc 2017-04-27 17:51:50         2637
[Information]         cryptography/hazmat/primitives/twofactor/utils.py 2017-04-27 17:51:38          954
[Information]         cryptography/hazmat/primitives/twofactor/utils.pyc 2017-04-27 17:51:50         1208
[Information]         cryptography/utils.py                          2017-04-27 17:51:38         4130
[Information]         cryptography/utils.pyc                         2017-04-27 17:51:50         6969
[Information]         cryptography/x509/                             2017-04-27 17:51:50            0
[Information]         cryptography/x509/__init__.py                  2017-04-27 17:51:38         6857
[Information]         cryptography/x509/__init__.pyc                 2017-04-27 17:51:50         6944
[Information]         cryptography/x509/base.py                      2017-04-27 17:51:38        23315
[Information]         cryptography/x509/base.pyc                     2017-04-27 17:51:50        31205
[Information]         cryptography/x509/extensions.py                2017-04-27 17:51:38        37228
[Information]         cryptography/x509/extensions.pyc               2017-04-27 17:51:50        59587
[Information]         cryptography/x509/general_name.py              2017-04-27 17:51:38         7519
[Information]         cryptography/x509/general_name.pyc             
...
2017-04-27 11:28:02        21986
[Information]         dateutil/relativedelta.pyc                     2017-04-27 11:28:06        17516
[Information]         dateutil/rrule.py                              2017-04-27 11:28:02        61792
[Information]         dateutil/rrule.pyc                             2017-04-27 11:28:06        48786
[Information]         dateutil/tz/                                   2017-04-27 11:28:06            0
[Information]         dateutil/tz/__init__.py                        2017-04-27 11:28:02          145
[Information]         dateutil/tz/__init__.pyc                       2017-04-27 11:28:06          379
[Information]         dateutil/tz/_common.py                         2017-04-27 11:28:02        11744
[Information]         dateutil/tz/_common.pyc                        2017-04-27 11:28:06        13900
[Information]         dateutil/tz/tz.py                              2017-04-27 11:28:02        48924
[Information]         dateutil/tz/tz.pyc                             2017-04-27 11:28:06        44590
[Information]         dateutil/tz/win.py                             2017-04-27 11:28:02        11466
[Information]         dateutil/tz/win.pyc                            2017-04-27 11:28:06        12475
[Information]         dateutil/tzwin.py                              2017-04-27 11:28:02           58
[Information]         dateutil/tzwin.pyc                             2017-04-27 11:28:06          211
[Information]         dateutil/zoneinfo/                             2017-04-27 11:28:06            0
[Information]         dateutil/zoneinfo/__init__.py                  2017-04-27 11:28:02         6810
[Information]         dateutil/zoneinfo/__init__.pyc                 2017-04-27 11:28:06         7654
[Information]         dateutil/zoneinfo/dateutil-zoneinfo.tar.gz     2017-04-27 11:28:02       139671
[Information]         dateutil/zoneinfo/rebuild.py                   2017-04-27 11:28:02         1688
[Information]         dateutil/zoneinfo/rebuild.pyc                  2017-04-27 11:28:06         2239
[Information]         jwt/__init__.py                                2017-06-06 14:51:08          738
[Information]         jwt/__init__.pyc                               2017-06-06 14:51:08         1177
[Information]         jwt/__main__.py                                2017-06-06 14:51:08         3585
[Information]         jwt/__main__.pyc                               2017-06-06 14:51:08         3120
[Information]         jwt/algorithms.py                              2017-06-06 14:51:08        13758
[Information]         jwt/algorithms.pyc                             2017-06-06 14:51:08        14450
[Information]         jwt/api_jws.py                                 2017-06-06 14:51:08         7133
[Information]         jwt/api_jws.pyc                                2017-06-06 14:51:08         7462
[Information]         jwt/api_jwt.py                                 2017-06-06 14:51:08         6547
[Information]         jwt/api_jwt.pyc                                2017-06-06 14:51:08         6842
[Information]         jwt/compat.py                                  2017-06-06 14:51:08         1784
[Information]         jwt/compat.pyc                                 2017-06-06 14:51:08         2253
[Information]         jwt/contrib/                                   2017-06-06 14:51:08            0
[Information]         jwt/contrib/__init__.py                        2017-06-06 14:51:08            0
[Information]         jwt/contrib/__init__.pyc                       2017-06-06 14:51:08          163
[Information]         jwt/contrib/algorithms/                        2017-06-06 14:51:08            0
[Information]         jwt/contrib/algorithms/__init__.py             2017-06-06 14:51:08            0
[Information]         jwt/contrib/algorithms/__init__.pyc            2017-06-06 14:51:08          174
[Information]         jwt/contrib/algorithms/py_ecdsa.py             2017-06-06 14:51:08         1771
[Information]         jwt/contrib/algorithms/py_ecdsa.pyc            2017-06-06 14:51:08         2406
[Information]         jwt/contrib/algorithms/pycrypto.py             2017-06-06 14:51:08         1250
[Information]         jwt/contrib/algorithms/pycrypto.pyc            2017-06-06 14:51:08         2325
[Information]         jwt/exceptions.py                              2017-06-06 14:51:08          841
[Information]         jwt/exceptions.pyc                             2017-06-06 14:51:08         2777
[Information]         jwt/utils.py                                   2017-06-06 14:51:08         2629
[Information]         jwt/utils.pyc                                  2017-06-06 14:51:08         4204

所以ZIP包已经以特定的方式完成,以便包裹' dist-info文件夹被删除,只包含具有包的确切名称的文件夹

enter image description here

我能够运行import cvxpy,注意包含新的包multiplocessCVXCanon。然而,在解决问题时,我得到了ecos模块缺失的错误。所以我为原始ecos包中的所有文件创建了一个新目录ecos.*.wheel,因此更新后的ZIP Bundle看起来像这样

enter image description here

我能用DCP工具CVXPY解决以下凸优化问题。

enter image description here

Python脚本模块中的代码解决了Azure ML中CVXPY的优化问题

import pandas as pd
from cvxpy import *
import numpy

def azureml_main(dataframe1 = None, dataframe2 = None):

    # Problem data.
    m = 30
    n = 20
    numpy.random.seed(1)
    A = numpy.random.randn(m, n)
    b = numpy.random.randn(m)

    # Construct the problem.
    x = Variable(n)
    objective = Minimize(sum_squares(A*x - b))
    constraints = [0 <= x, x <= 1]
    prob = Problem(objective, constraints)

    # The optimal objective is returned by prob.solve().
    result = prob.solve()
    # The optimal value for x is stored in x.value.
    #print x.value
    # The optimal Lagrange multiplier for a constraint
    # is stored in constraint.dual_value.
    #print constraints[0].dual_value

    dataframe1=pd.DataFrame(numpy.zeros(1))
    dataframe1[0][0]=result

    # Return value must be of a sequence of pandas.DataFrame
    return dataframe1,

进一步阅读

  1. 请注意,代码创建了一个大小为零矩阵的Panda DataFrame,可能有更优雅的方式来做,更多 Python Pandas DataFrame with only a single number stored?

答案 2 :(得分:0)

或者只是使用类似的东西

import pip

# you can make this install from a local path if needed, and upload the binaries
def install(package):
    if hasattr(pip, 'main'):
        pip.main(['install', package])
    else:
        pip._internal.main(['install', package])

if __name__ == '__main__':
    try:
        import mymodule
    except:
        install('mymodule')

Installing python module within code