简体   繁体   中英

How to install TensorFlow in jupyter notebook on Azure Machine Learning Studio

I'm trying to test Azure Machine Learning Studio.

I want to use TensorFlow, but it is not installed on Jupyter notebook.

How can I use some machine learning libraries like TensorFlow, Theano, Keras,... on the notebook?

I tried this:

!pip install tensorflow 

But, I got error as below:

Collecting tensorflow
  Downloading tensorflow-0.12.0rc0-cp34-cp34m-manylinux1_x86_64.whl (43.1MB)
    100% |################################| 43.1MB 27kB/s 
Collecting protobuf==3.1.0 (from tensorflow)
  Downloading protobuf-3.1.0-py2.py3-none-any.whl (339kB)
    100% |################################| 348kB 3.7MB/s 
Collecting six>=1.10.0 (from tensorflow)
  Downloading six-1.10.0-py2.py3-none-any.whl
Requirement already satisfied: numpy>=1.11.0 in /home/nbcommon/anaconda3_23/lib/python3.4/site-packages (from tensorflow)
Requirement already satisfied: wheel>=0.26 in /home/nbcommon/anaconda3_23/lib/python3.4/site-packages (from tensorflow)
Requirement already satisfied: setuptools in /home/nbcommon/anaconda3_23/lib/python3.4/site-packages/setuptools-27.2.0-py3.4.egg (from protobuf==3.1.0->tensorflow)
Installing collected packages: six, protobuf, tensorflow
  Found existing installation: six 1.9.0
    DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling six-1.9.0:
      Successfully uninstalled six-1.9.0
  Rolling back uninstall of six
Exception:
Traceback (most recent call last):
  File "/home/nbcommon/anaconda3_23/lib/python3.4/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/nbcommon/anaconda3_23/lib/python3.4/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/home/nbcommon/anaconda3_23/lib/python3.4/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/home/nbcommon/anaconda3_23/lib/python3.4/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/home/nbcommon/anaconda3_23/lib/python3.4/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/home/nbcommon/anaconda3_23/lib/python3.4/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/home/nbcommon/anaconda3_23/lib/python3.4/site-packages/pip/wheel.py", line 329, in clobber
    os.utime(destfile, (st.st_atime, st.st_mtime))
PermissionError: [Errno 1] Operation not permitted

As you noticed, the active user doesn't have permissions to write to the site-packages directory in Azure Machine Learning Studio notebooks. You could try installing the package to another directory where you do have write permissions (like the default working directory) and importing from there, but I recommend the following lower-hassle option.

Azure Notebooks is a separate Jupyter Notebook service that will allow you to install tensorflow, theano, and keras. Like the notebooks in AML Studio, these notebooks will persist in your account. The primary downside is that if you want to access your workspace through eg the Python azureml package, you'll need to provide your workspace id/authorization token to set up the connection. (In Azure ML Studio, those values are loaded automatically from the current workspace.) Otherwise I believe Azure Notebooks can do everything you are used to doing inside AML Studio only.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM