【问题标题】:Azure ML Execute Python Module: Network I/O Disabled?Azure ML 执行 Python 模块:网络 I/O 已禁用?
【发布时间】:2015-03-27 09:44:40
【问题描述】:

有没有办法从 azure ml 连接到 URL 并获取它的内容

我的代码:

import requests
def azureml_main(dataframe1 = None, dataframe2 = None):    
    b= requests.get("http://www.google.com",timeout=30)
    dataframe1 = b.content
    return dataframe1

是否需要进行任何更改才能连接到 URL

错误:

Error 0085: The following error occurred during script evaluation, please view the output log for more information:
 ---------- Start of error message from Python interpreter ----------
data:text/plain,Caught exception while executing function: Traceback (most recent call last):
File "C:\server\invokepy.py", line 167, in batch
odfs = mod.azureml_main(*idfs)
File "C:\temp\azuremod.py", line 24, in azureml_main
b= requests.get("http://www.google.com",timeout=30)
File "C:\pyhome\lib\site-packages\requests\api.py", line 55, in get
return request('get', url, **kwargs)
File "C:\pyhome\lib\site-packages\requests\api.py", line 44, in request
return session.request(method=method, url=url, **kwargs)
File "C:\pyhome\lib\site-packages\requests\sessions.py", line 456, in request
resp = self.send(prep, **send_kwargs)
File "C:\pyhome\lib\site-packages\requests\sessions.py", line 559, in send
r = adapter.send(request, **kwargs)
File "C:\pyhome\lib\site-packages\requests\adapters.py", line 375, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='www.google.com', port=80): Max retries exceeded with url: / (Caused by <class 'socket.gaierror'>: [Errno 11001] getaddrinfo failed)

---------- End of error message from Python  interpreter  ---------

或者是否需要对 azure ml 设置进行任何更改

【问题讨论】:

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


    【解决方案1】:

    更新 2016 年 1 月 28 日

    现在支持Execute Python Script 的网络 I/O。

    过期

    执行 Python 模块不支持网络 I/O。为了执行这样的程序,您应该启动一个虚拟机(您选择 Windows 或 Linux)。

    窗户:

    1. RDP 进入虚拟机
    2. 安装您选择的 Python
    3. 您可以将 Python 程序从本地 Windows 计算机拖放到 RDP 屏幕上以传输代码
    4. 然后运行你的程序

    Ubuntu:

    1. 使用 Cygwin 或 Putty(Windows) 或终端 SSH (mac) SSH 到您的虚拟机 ssh yourUserName@yourAzureVM.cloudapps.net
    2. 安装 Python sudo apt-get install python
    3. 打开您喜欢的 Linux 文本编辑器vi myProgram.py
    4. 将代码复制并粘贴到编辑器中(使用 esc :wq 离开 vi)
    5. 运行您的代码python myProgram.py

    要将数据从您的 VM 移动到 AzureML,请查看 Github 上的 Azure-MachineLearning-ClientLibrary-Python

    【讨论】:

    • 这不能仅在 AzureML 中完成。由于潜在的滥用(DDOS 攻击等),网络 I/O 仅限于主要的 Azure 订阅。如果您不是工作区管理员,则必须联系他们为您设置虚拟机。如果您是 AzureML 免费用户,则必须在本地运行程序。
    • 谢谢队友,所以只有 azure ml 是不可能的。所以我必须将我的 azure vm 输出连接到 azure ml 然后处理它们。
    • 是的,我已经更新了我的答案,提供了指向我们的 Python 库的链接,用于将数据移动到您的工作区中,这应该有助于简化流程
    • Dan Ciborowski - 在哪里可以找到关于 Execute Python Script 模块中网络的任何文档?
    猜你喜欢
    • 2019-03-09
    • 1970-01-01
    • 1970-01-01
    • 2021-08-28
    • 1970-01-01
    • 1970-01-01
    • 2013-04-14
    • 2023-04-05
    • 1970-01-01
    相关资源
    最近更新 更多