Search code examples
pythonazurenumpypipazure-web-roles

"No space left on device" when installing Numpy on an Azure Web Role


I want to use Numpy and Pandas in a Python Web Role on Microsoft Azure.

I tried adding numpy and pandas to the requirements.txt, but this didn't work (using pip to install numpy often leads to problems so this was expected).

I followed this advice and downloaded numpy as a wheel from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and put the file in the root of the web role. Right now the requirements.txt looks like this:

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

I remoted into the virtual machine and found some logs in 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

How can I get Numpy working?


Solution

  • According your description, it looks like you host your python application on Azure Could Service. If you use Visual Studio as your IDE, I suggest that you can follow this solution:

    You can try to set python virtual environment as python runtime in Web Role package, and leverage Visual Studio we can configure and deploy cloud service in python with a ease.

    1, In your Azure Cloud Service project solution, right click Python Environment under your web role package, click add virtual environment. enter image description here

    2, If you named the virtual env as env, VS will create a VE folder named env in your web role root directory. Copy the wheel file numpy-1.9.3+mkl-cp34-none-win32.whl into env folder.

    3, configure requirements.txt, to completely configure the dependencies of pandas and numpy, here is my requirements.txt looks like beside azure package:

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

    4, right click the virtual env in the solution tree, click Install from requirements.txt to install all the packages.

    enter image description here

    5, then deploy it to Azure

    It works fine via this method on my side. Any concern, please feel free let me know.