【问题标题】:Install Tensorflow from source从源代码安装 TensorFlow
【发布时间】:2016-11-02 09:21:29
【问题描述】:

我正在尝试在集群上安装 tensorflow(我没有 sudo 权限)。 如果我尝试使用 pip 我首先设置环境变量:

export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl

然后我执行:

pip install --upgrade $TF_BINARY_URL -b=/home/js668623/tools/tensorflow

输出是:

You are using pip version 7.1.0, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting tensorflow==0.9.0 from https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl
Using cached https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl
Collecting six>=1.10.0 (from tensorflow==0.9.0)
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting protobuf==3.0.0b2 (from tensorflow==0.9.0)
Using cached protobuf-3.0.0b2-py2.py3-none-any.whl
Collecting wheel (from tensorflow==0.9.0)
Using cached wheel-0.29.0-py2.py3-none-any.whl
Collecting numpy>=1.8.2 (from tensorflow==0.9.0)
Using cached numpy-1.11.1.zip
Collecting setuptools (from protobuf==3.0.0b2->tensorflow==0.9.0)
Using cached setuptools-23.1.0-py2.py3-none-any.whl
Installing collected packages: six, setuptools, protobuf, wheel, numpy, tensorflow
Found existing installation: six 1.9.0
Uninstalling six-1.9.0:
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 308, in run
strip_file_prefix=options.strip_file_prefix,
File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 640, in install
requirement.uninstall(auto_confirm=True)
File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 726, in uninstall
paths_to_remove.remove(auto_confirm)
File "/usr/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 125, in remove
renames(path, new_path)
File "/usr/lib/python2.7/site-packages/pip/utils/__init__.py", line 314, in renames
shutil.move(old, new)
File "/usr/lib64/python2.7/shutil.py", line 299, in move
rmtree(src)
File "/usr/lib64/python2.7/shutil.py", line 252, in rmtree
onerror(os.remove, fullname, sys.exc_info())
File "/usr/lib64/python2.7/shutil.py", line 250, in rmtree
os.remove(fullname)
OSError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/six-1.9.0-py2.7.egg-info/PKG-INFO'

【问题讨论】:

    标签: installation pip tensorflow


    【解决方案1】:

    如果您还需要特定版本的 python,那么您需要的不仅仅是我给您的脚本,但只要稍微了解一下,该脚本应该适合您;)

    module load Python/2.7.11-foss-2016a
    curl -O https://bootstrap.pypa.io/get-pip.py
    python get-pip.py --user --upgrade
    rm get-pip.py
    .local/bin/pip install --user --upgrade pip
    
    git clone https://github.com/tensorflow/tensorflow
    git clone https://github.com/bazelbuild/bazel.git
    wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u92-b14/jdk-8u92-linux-x64.tar.gz
    tar -xf jdk*
    rm jdk*.gz
    cd bazel
    export JAVA_HOME=~/jdk1.8.0_92/
    module unload GCC/4.9.3-2.25
    module load GCC/4.8.2
    ./compile.sh
    cd ../tensorflow
    export PATH=/home/ulg/sysmod/gmath/bazel/output/:$PATH
    ./configure
    bazel build -c opt //tensorflow/tools/pip_package:build_pip_package 2>/dev/null
    bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
    cd
    .local/bin/pip install --user --upgrade /tmp/tensorflow_pkg/tensorflow-0.8.0-py2-none-any.whl
    

    【讨论】:

    • 感谢您的回答;)但是安装仍然不成功。我根据需要更改了 /home/ulg... 行,但得到以下输出 IOError: [Errno 2] No such file or directory: '/tmp/tensorflow_pkg/tensorflow-0.8.0-py2-none-any .whl' .?不知道怎么回事……
    • 您需要从您的主目录运行此脚本。要获得有关错误的更多输出,请重试删除“2>/dev/null”
    【解决方案2】:

    如果您在机器上没有 sudo 权限,我个人认为“virtualenv”安装最简单。它应该可以在没有 root 访问权限的情况下工作。

    https://www.tensorflow.org/versions/r0.9/get_started/os_setup.html#virtualenv-installation

    您可能还会研究“anaconda”安装,但我没有这方面的经验。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-22
    相关资源
    最近更新 更多