2

I am using a Data Science virtual machine on Azure that has anaconda python installed.

I need to access module Azure storage blob using:

from azure.storage.blob import BlockBlobService

When dealing with this command I receive the message that the module azure.blob.storage is not found. I have forced the update for the module azure-storage:

pip install azure-storage --upgrade

The missing module instead is present on the installed modules using:

pip freeze

After removing Anaconda and using the standard Python distro everything works well.

How can I continue using Anaconda with azurestorage support? Has anyone experimented this issue and solved it?

Mike Wise
  • 22,131
  • 8
  • 81
  • 104
Roberto G.
  • 171
  • 5
  • 12
  • You need to make sure to use the version of pip associated with the Anaconda install. What is the output of `which pip` – darthbith Nov 14 '16 at 23:22

2 Answers2

2

The Linux flavors of the Data Science Virtual Machine include two Anaconda environments: root, with Python 2.7, and py35, with Python 3.5. You should activate the one you want:

source activate py35

pip and python will then both refer to the same environment.

You may need to run pip as root to install packages. You can do with

sudo /anaconda/bin/pip

for the root environment, or

sudo /anaconda/envs/py35/bin/pip

for the py35 environment.

Paul Shealy
  • 734
  • 3
  • 8
0

There are two installations for Python on Azure VM for Data Science, which include system level & Anaconda level.

As @darthbith said, it shows the path /usr/local/bin/pip when you run the command which pip, which is belong to system level.

You need to move to the path bin of Anaconda and install the modules you want using the ./pip command for the current Anaconda, as below using jupyter terminal.

# For example, using anaconda for Python 2
nbuser@nbserver:~$ cd anaconda2_20/bin
# Using the Anaconda pip to install modules
nbuser@nbserver:~/anaconda2_20/bin$ ./pip install azure-storage --upgrade
# Then see the content below
Collecting azure-storage                                                                                                                  
  Downloading azure_storage-0.33.0-py2-none-any.whl (182kB)                                                                               
    100% |################################| 184kB 2.9MB/s                                                                                 
Collecting requests (from azure-storage)                                                                                                  
  Downloading requests-2.12.1-py2.py3-none-any.whl (574kB)                                                                                
    100% |################################| 583kB 1.7MB/s                                                                                 
Requirement already up-to-date: azure-nspkg in /home/nbcommon/anaconda2_20/lib/python2.7/site-packages (from azure-storage)               
Requirement already up-to-date: azure-common in /home/nbcommon/anaconda2_20/lib/python2.7/site-packages (from azure-storage)              
Requirement already up-to-date: futures in /home/nbcommon/anaconda2_20/lib/python2.7/site-packages (from azure-storage)                   
Collecting cryptography (from azure-storage)                                                                                              
  Downloading cryptography-1.5.3.tar.gz (400kB)
.....

Then the azure-storgae module be upgraded for the current Anaconda.

Hope it helps.

Peter Pan
  • 23,476
  • 4
  • 25
  • 43