简体   繁体   中英

Installing tensorflow using pip within anaconda fails

I have a fresh Anaconda install (Python 3.6) and am trying to install tensorflow via pip (as described here ) on Mac OS X High Sierra.

Specifically, I've run:

pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.4.1-py3-none-any.whl

Output is the following:

Collecting tensorflow==1.4.1 from https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.4.1-py3-none-any.whl
      Using cached https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.4.1-py3-none-any.whl
    Collecting six>=1.10.0 (from tensorflow==1.4.1)
      Using cached six-1.11.0-py2.py3-none-any.whl
    Collecting wheel>=0.26 (from tensorflow==1.4.1)
      Using cached wheel-0.30.0-py2.py3-none-any.whl
    Collecting numpy>=1.12.1 (from tensorflow==1.4.1)
      Using cached numpy-1.14.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
    Collecting protobuf>=3.3.0 (from tensorflow==1.4.1)
      Using cached protobuf-3.5.1-py2.py3-none-any.whl
    Collecting tensorflow-tensorboard<0.5.0,>=0.4.0rc1 (from tensorflow==1.4.1)
      Using cached tensorflow_tensorboard-0.4.0rc3-py3-none-any.whl
    Collecting enum34>=1.1.6 (from tensorflow==1.4.1)
      Using cached enum34-1.1.6-py3-none-any.whl
    Collecting setuptools (from protobuf>=3.3.0->tensorflow==1.4.1)
      Using cached setuptools-38.4.0-py2.py3-none-any.whl
    Collecting html5lib==0.9999999 (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow==1.4.1)
      Using cached html5lib-0.9999999.tar.gz
    Collecting markdown>=2.6.8 (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow==1.4.1)
      Using cached Markdown-2.6.11-py2.py3-none-any.whl
    Collecting bleach==1.5.0 (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow==1.4.1)
      Using cached bleach-1.5.0-py2.py3-none-any.whl
    Collecting werkzeug>=0.11.10 (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow==1.4.1)
      Using cached Werkzeug-0.14.1-py2.py3-none-any.whl
    Building wheels for collected packages: html5lib
      Running setup.py bdist_wheel for html5lib ... done
      Running setup.py clean for html5lib
    Failed to build html5lib
    Installing collected packages: six, wheel, numpy, setuptools, protobuf, html5lib, markdown, bleach, werkzeug, tensorflow-tensorboard, enum34, tensorflow
      Running setup.py install for html5lib ... error
        Complete output from command /Users/mcewen/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/Users/mcewen/pip-build-r4d_y_ei/html5lib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record ./pip-62mbr8ng-record/install-record.txt --single-version-externally-managed --compile:
        running install
        running build
        running build_py
        creating build
        creating build/lib
        creating build/lib/html5lib
        copying html5lib/inputstream.py -> build/lib/html5lib
        copying html5lib/sanitizer.py -> build/lib/html5lib
        copying html5lib/constants.py -> build/lib/html5lib
        copying html5lib/html5parser.py -> build/lib/html5lib
        copying html5lib/__init__.py -> build/lib/html5lib
        copying html5lib/ihatexml.py -> build/lib/html5lib
        copying html5lib/tokenizer.py -> build/lib/html5lib
        copying html5lib/utils.py -> build/lib/html5lib
        creating build/lib/html5lib/filters
        copying html5lib/filters/_base.py -> build/lib/html5lib/filters
        copying html5lib/filters/sanitizer.py -> build/lib/html5lib/filters
        copying html5lib/filters/inject_meta_charset.py -> build/lib/html5lib/filters
        copying html5lib/filters/__init__.py -> build/lib/html5lib/filters
        copying html5lib/filters/alphabeticalattributes.py -> build/lib/html5lib/filters
        copying html5lib/filters/optionaltags.py -> build/lib/html5lib/filters
        copying html5lib/filters/lint.py -> build/lib/html5lib/filters
        copying html5lib/filters/whitespace.py -> build/lib/html5lib/filters
        creating build/lib/html5lib/treewalkers
        copying html5lib/treewalkers/_base.py -> build/lib/html5lib/treewalkers
        copying html5lib/treewalkers/pulldom.py -> build/lib/html5lib/treewalkers
        copying html5lib/treewalkers/genshistream.py -> build/lib/html5lib/treewalkers
        copying html5lib/treewalkers/__init__.py -> build/lib/html5lib/treewalkers
        copying html5lib/treewalkers/lxmletree.py -> build/lib/html5lib/treewalkers
        copying html5lib/treewalkers/etree.py -> build/lib/html5lib/treewalkers
        copying html5lib/treewalkers/dom.py -> build/lib/html5lib/treewalkers
        creating build/lib/html5lib/serializer
        copying html5lib/serializer/htmlserializer.py -> build/lib/html5lib/serializer
        copying html5lib/serializer/__init__.py -> build/lib/html5lib/serializer
        creating build/lib/html5lib/treebuilders
        copying html5lib/treebuilders/_base.py -> build/lib/html5lib/treebuilders
        copying html5lib/treebuilders/etree_lxml.py -> build/lib/html5lib/treebuilders
        copying html5lib/treebuilders/__init__.py -> build/lib/html5lib/treebuilders
        copying html5lib/treebuilders/etree.py -> build/lib/html5lib/treebuilders
        copying html5lib/treebuilders/dom.py -> build/lib/html5lib/treebuilders
        creating build/lib/html5lib/treeadapters
        copying html5lib/treeadapters/sax.py -> build/lib/html5lib/treeadapters
        copying html5lib/treeadapters/__init__.py -> build/lib/html5lib/treeadapters
        creating build/lib/html5lib/trie
        copying html5lib/trie/_base.py -> build/lib/html5lib/trie
        copying html5lib/trie/datrie.py -> build/lib/html5lib/trie
        copying html5lib/trie/__init__.py -> build/lib/html5lib/trie
        copying html5lib/trie/py.py -> build/lib/html5lib/trie
        running install_lib
        running install_egg_info
        running egg_info
        writing html5lib.egg-info/PKG-INFO
        writing dependency_links to html5lib.egg-info/dependency_links.txt
        writing requirements to html5lib.egg-info/requires.txt
        writing top-level names to html5lib.egg-info/top_level.txt
        reading manifest file 'html5lib.egg-info/SOURCES.txt'
        writing manifest file 'html5lib.egg-info/SOURCES.txt'
        removing '/Users/mcewen/anaconda3/lib/python3.6/site-packages/html5lib-0.9999999-py3.6.egg-info' (and everything under it)
        Copying html5lib.egg-info to /Users/mcewen/anaconda3/lib/python3.6/site-packages/html5lib-0.9999999-py3.6.egg-info
        running install_scripts
        writing list of installed files to './pip-62mbr8ng-record/install-record.txt'
        error: [Errno 2] No such file or directory: './pip-62mbr8ng-record/install-record.txt'

        ----------------------------------------
    Command "/Users/mcewen/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/Users/mcewen/pip-build-r4d_y_ei/html5lib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record ./pip-62mbr8ng-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /Users/mcewen/pip-build-r4d_y_ei/html5lib/

I suspect this could be a pip issue rather than a tensorflow issue but haven't been able to find a solution. Any help very welcome!

I had many problems installing tensorflow on my mac as well.

Finally I did it this way and it worked: I followed commands from tensorflow site, but didn't work properly.

Also, from the same site, sudo is ok to use.

  1. Go to Ananconda Navigator, Click on Environments (left menu), then Create button on sub-menu. Type in a name ("Tensorflow" would be my choice)
  2. On the bigger frame to the right, Select All from dropdown, type in tensorflow in Search text box, then some tensorflow items should appear.
  3. Select tensorflow, click Apply on bottom right.

Note: Now I have two environments, "root" and "tensorflow". I select tensorflow before clicking on Python IDE (Spyder).

Not sure if this is what you were looking for: anaconda-navigator-tensorflow-install

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