2015-12-07 40 views
1

我想在Microsoft Azure上的Python Web角色中使用Numpy和Pandas。在Azure Web角色上安裝Numpy時,「設備上沒有剩餘空間」

我嘗試將numpypandas添加到requirements.txt,但這並不奏效(使用pip安裝numpy通常會導致問題,所以這是預期的)。

I followed this advice以及從http://www.lfd.uci.edu/~gohlke/pythonlibs/下載的numpy作爲輪子,並將該文件放入網絡角色的根目錄中。眼下requirements.txt看起來是這樣的:

azure>=0.8.0 
azure-storage-logging 
requests_futures 
numpy-1.9.3+mkl-cp34-none-win32.whl 
pandas 

我遠程處理到虛擬機,並發現了一些日誌中C:\Resources\Directory\7044b9f2b424470aa191d9c178d06399.WorkerRole1.DiagnosticStore\LogFiles\ConfigureCloudService

Storing debug log for failure in D:\Windows\system32\config\systemprofile\pip\pip.log 
pip 1.5.6 from D:\Python34\lib\site-packages (python 3.4) 
Unpacking e:\approot\numpy-1.9.3+mkl-cp34-none-win32.whl 
Cleaning up... 
Exception: 
Traceback (most recent call last): 
    File "D:\Python34\lib\site-packages\pip\basecommand.py", line 122, in main 
    status = self.run(options, args) 
    File "D:\Python34\lib\site-packages\pip\commands\install.py", line 278, in run 
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) 
    File "D:\Python34\lib\site-packages\pip\req.py", line 1197, in prepare_files 
    do_download, 
    File "D:\Python34\lib\site-packages\pip\req.py", line 1364, in unpack_url 
    unpack_file_url(link, location, download_dir) 
    File "D:\Python34\lib\site-packages\pip\download.py", line 640, in unpack_file_url 
    unpack_file(from_path, location, content_type, link) 
    File "D:\Python34\lib\site-packages\pip\util.py", line 621, in unpack_file 
    unzip_file(filename, location, flatten=not filename.endswith(('.pybundle', '.whl'))) 
    File "D:\Python34\lib\site-packages\pip\util.py", line 510, in unzip_file 
    fp.write(data) 
OSError: [Errno 28] No space left on device 

Storing debug log for failure in D:\Windows\system32\config\systemprofile\pip\pip.log 

我怎樣才能得到NumPy的工作?

+0

你'd:'驅動器空間不足 –

+0

很明顯,但這是微軟Azure管理的虛擬機。我試過將我的計劃從超小型升級到中型,但這似乎只會增加內存大小,而不會增加磁盤大小。 – JrtPec

+0

那麼你將不得不釋放一些空間。嘗試刪除一些臨時目錄 –

回答

1

根據您的描述,它看起來像您在Azure可能服務上託管您的python應用程序。如果您使用Visual Studio作爲您的IDE,我建議您可以遵循以下解決方案:

您可以嘗試將Python虛擬環境設置爲Web Role包中的python運行時,並利用Visual Studio我們可以配置和部署雲服務蟒蛇輕鬆。

1,在你的Azure的雲服務項目解決方案,右鍵單擊Python環境您的Web角色包下,單擊添加虛擬環境enter image description here

2,如果你命名虛擬ENV爲env,VS將創建一個VE文件夾在你的Web角色的根目錄中名爲env。將wheel文件numpy-1.9.3+mkl-cp34-none-win32.whl複製到env文件夾中。

3,配置requirements.txt,完全配置的pandasnumpy的依賴關係,這是我的requirements.txt看起來像蔚藍的包旁邊:

pandas 
numpy-1.9.3+mkl-cp34-none-win32.whl 
six 
pytz 

4,右鍵單擊該解決方案樹中的虛擬ENV,單擊從requirements.txt安裝以安裝所有軟件包。

enter image description here

5,然後通過在我身邊這個方法將其部署到Azure的

它工作正常。任何疑慮,請隨時通知我。

+0

這個工程! 雖然我在設置解釋器路徑時遇到了一些問題。在構建項目時,會生成一個名爲'AzureSetup.cfg'的文件,其中的變量'interpreter_path'設置爲'%INTERPRETERPATH%'。我發現沒有辦法設置這個變量,或者使它像'%ROOTDIR%\ env \ Scripts \ python.exe'。 我最終做的是編輯'LaunchWorker.ps1',將'$ interpreter_path = read_value'interpreter_path''行改爲'$ interpreter_path = $($ Env:RootDir)+'\ env \ Scripts \ python.exe' – JrtPec

+0

我有一個更新:現在pypi包含了windows的輪子,所以你可以在'requirements.txt'中寫'numpy',它會起作用,因爲你在安裝之前更新了pip。你可以通過在'ConfigureCloudService.ps1'中添加一行來實現:在執行'py -m pip install -r requirements.txt'前寫入'py -m pip install -U pip' – JrtPec

0

在我的情況下,它是由驅動器C引起的:太滿了。您電腦中所有進程的所有臨時文件都存儲在Drive C:中,因此在裝滿時請不要安裝大型軟件包。

0

我已經通過這個工作了約3天,調試PIP代碼和其他的點點滴滴我的解決方法是後:

IEX「$ ENV:PYPATH \腳本\ pip.exe安裝-be: \ approot \ stuff -r要求。TXT」

通知-b

由於某種原因,在Windows/Python的認爲它已經運行的空間在標準temp目錄:C:\資源\ APP_ID .....(當時有> 200GB全)

利用它迫使PIP使用自己的build目錄-b不填滿。

得很開心

0

我有同樣的問題,安裝NumPy的。

我從這個article中獲取Azure Web角色的基礎模板。 作爲一個想法來解決這個錯誤,我從Gordon's答案。

我加TMP本地存儲到我的RoleProperties:

enter image description here

之後進行了更改在ServiceDefinition.csdef中啓動任務。爲「tempdir」添加了一個變量:

<Task executionContext="elevated" taskType="simple" commandLine="bin\ps.cmd 
PipInstaller.ps1"> 
    <Environment> 
     <Variable name="EMULATED"> 
     <RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" /> 
     </Variable> 
     <Variable name="TEMPDIR"> 
     <RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/LocalResources/LocalResource[@name='tempdir']/@path" /> 
     </Variable> 
     <Variable name="PYTHON2" value="off" /> 
    </Environment> 
    </Task> 

最後一步。更改「PipInstaller.ps1」給力點子用「TEMPDIR」作爲構建目錄:

$tmp_dir = $env:TEMPDIR 
py -m pip install -b $tmp_dir -r ..\requirements.txt 
+0

從我第一次起問這個問題。 Pip現在在Windows上爲Numpy和Pandas預製了輪子,所以你不需要自己包含它們,或者使用virtualenv。 – JrtPec

相關問題