tahaum
tahaum

Reputation: 55

Can't find module named 'azure.datalake' or pip in Azure Notebook VM

I've been using Notebook VMs through Machine Learning Studio for a while now, but they've suddenly started acting strange. For some time now I've experienced sudden error messages resulting in the VM not responding and having to be restarted. Even this in some cases did not help. Recently, these problems have seemed to disappear, but I now have a few other errors. I can't import the modules I need, for example:

---------------------------------------------------------------------------    
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-4-2f761c8f97ca> in <module>
      3 import matplotlib.pyplot as plt
      4 
----> 5 from azure.datalake.store import core, lib
      6 
      7 pd.set_option('display.max_columns', 500)

ModuleNotFoundError: No module named 'azure.datalake'

Until now I've resolved this by using !pip install, but now I get the following message:

/bin/sh: 1: pip: not found

Any ideas why?

Upvotes: 2

Views: 2691

Answers (1)

Peter Pan
Peter Pan

Reputation: 24138

Finally I see you are using Notebook VM on Azure Machine Learning, as the figure below, it's a new preview feature of Azure Machine Learning.

enter image description here

And I got the same issue with yours when I tried to install azure-datalake-store via !pip install azure-datalake-store, as below.

enter image description here

My solution to install the Python package via pip is to open a terminal windown to run the command pip install azure-datalake-store.

Fig 1. New a terminal window

enter image description here

Fig 2. To run pip install azure-datalake-store in the terminal, and it installed the package successfully

enter image description here

Fig 3. Then I import the package installed by terminal successfully in Python 3.6-Azure ML and Python 3 without any error

enter image description here

enter image description here

Hope it helps.


It sounds like you have installed azure-datalake-store package on Azure Notebooks via command !pip install azure-datalake-store as the figure below.

Fig 1. Install azure-datalake-store via !pip install in my notebook for Python 3

enter image description here

However, I see some accidentes broke down your notebook environment. Actually, in a worked notebook, you can see that it's an Anaconda environment via !which pip or !which conda to show the tools path.

Fig 2. Check the path of tools pip or conda

enter image description here

So first, you can try to check the conda tool whether exists via !which conda, and then to install pip tool again via !conda install -y pip as the figure below.

Fig 3. Install pip via conda

enter image description here


Update: Please command !ls /home/nbuser and !ls /home/nbuser/anaconda<python-version>-<anaconda-version> to see what there are, and command !echo $PATH to check your PATH value, as the figure below.

enter image description here

I guess you may only need to edit your PATH value to add the /home/nbuser/anaconda<python-version>-<anaconda-version>/bin as the figure above via run !export PATH=/home/nbuser/anaconda<python-version>-<anaconda-version>/bin:$PATH at the front of all code in the notebook to fix your issue.

Upvotes: 3

Related Questions