我已按照here步骤从Mac上的来源安装张量流。
最新问题无效,请参见本页底部的更新部分。
最直接的问题(现在已解决)我遇到了whl
文件无法找到sudo pip install /tmp/tensorflow_pkg/tensorflow-1.0.1-py2-none-any.whl
在此之前,虽然我没有收到错误,但在运行bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
时我收到了大量警告。以下仅是带有警告的日志消息的最后一部分。
arning: class 'WorkerEnv' was previously declared as a struct [-Wmismatched-tags]
class WorkerEnv;
^
./tensorflow/core/distributed_runtime/worker_env.h:37:8: note: previous use is here
struct WorkerEnv {
^
./tensorflow/core/distributed_runtime/worker.h:28:1: note: did you mean struct here?
class WorkerEnv;
^~~~~
struct
In file included from tensorflow/core/distributed_runtime/rpc/grpc_worker_service.cc:16:
./tensorflow/core/distributed_runtime/rpc/grpc_worker_service.h:36:8: warning: 'tensorflow::GrpcWorker::RecvTensorAsync' hides overloaded virtual function [-Woverloaded-virtual]
void RecvTensorAsync(CallOptions* opts, const RecvTensorRequest* request,
^
./tensorflow/core/distributed_runtime/worker.h:72:8: note: hidden overloaded virtual function 'tensorflow::Worker::RecvTensorAsync' declared here: type mismatch at 3rd parameter ('tensorflow::TensorResponse *' vs '::grpc::ByteBuffer *')
void RecvTensorAsync(CallOptions* opts, const RecvTensorRequest* request,
^
2 warnings generated.
INFO: From Linking tensorflow/core/kernels/libconv_ops.pic.lo:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: bazel-out/local-py3-opt/bin/tensorflow/core/kernels/_objs/conv_ops/tensorflow/core/kernels/conv_ops_using_gemm.pic.o has no symbols
INFO: From Linking tensorflow/core/kernels/libfft_ops.pic.lo:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: bazel-out/local-py3-opt/bin/tensorflow/core/kernels/_objs/fft_ops/tensorflow/core/kernels/fft_ops.pic.o has no symbols
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for library: bazel-out/local-py3-opt/bin/tensorflow/core/kernels/libfft_ops.pic.lo the table of contents is empty (no object file members in the library define global symbols)
INFO: From Linking tensorflow/core/libsycl_runtime.pic.lo:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: bazel-out/local-py3-opt/bin/tensorflow/core/_objs/sycl_runtime/tensorflow/core/common_runtime/sycl/sycl_allocator.pic.o has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: bazel-out/local-py3-opt/bin/tensorflow/core/_objs/sycl_runtime/tensorflow/core/common_runtime/sycl/sycl_device.pic.o has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: bazel-out/local-py3-opt/bin/tensorflow/core/_objs/sycl_runtime/tensorflow/core/common_runtime/sycl/sycl_device_context.pic.o has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: bazel-out/local-py3-opt/bin/tensorflow/core/_objs/sycl_runtime/tensorflow/core/common_runtime/sycl/sycl_device_factory.pic.o has no symbols
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for library: bazel-out/local-py3-opt/bin/tensorflow/core/libsycl_runtime.pic.lo the table of contents is empty (no object file members in the library define global symbols)
INFO: From Linking tensorflow/core/libgpu_runtime.pic.lo:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: bazel-out/local-py3-opt/bin/tensorflow/core/_objs/gpu_runtime/tensorflow/core/common_runtime/gpu/gpu_device.pic.o has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: bazel-out/local-py3-opt/bin/tensorflow/core/_objs/gpu_runtime/tensorflow/core/common_runtime/gpu/gpu_device_factory.pic.o has no symbols
INFO: From Linking tensorflow/python/gen_math_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/contrib/factorization/gen_gen_clustering_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_sparse_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_user_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/contrib/nccl/gen_nccl_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_nn_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_linalg_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_parsing_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/contrib/factorization/gen_gen_factorization_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/contrib/ffmpeg/gen_decode_audio_op_py_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_random_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/contrib/tensor_forest/gen_gen_tensor_forest_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_io_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_resource_variable_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_functional_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_logging_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_script_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_set_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_cloud_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/contrib/layers/gen_bucketization_op_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_test_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_state_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_ctc_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_data_flow_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_sdca_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/contrib/input_pipeline/gen_input_pipeline_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/_pywrap_tensorflow.so:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/contrib/image/gen_image_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_string_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/contrib/layers/gen_sparse_feature_cross_op_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/contrib/cudnn_rnn/gen_cudnn_rnn_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_candidate_sampling_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_image_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/contrib/ffmpeg/gen_encode_audio_op_py_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_training_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_array_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/python/gen_control_flow_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
INFO: From Linking tensorflow/contrib/framework/gen_gen_variable_ops_py_wrappers_cc [for host]:
clang: warning: argument unused during compilation: '-pthread'
Target //tensorflow/tools/pip_package:build_pip_package up-to-date:
bazel-bin/tensorflow/tools/pip_package/build_pip_package
INFO: Elapsed time: 2177.306s, Critical Path: 2134.22s
然后我运行了bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
,在控制台中输出以下输出似乎没有错误:
(dlnd-tf-lab) ->bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
Wed Apr 12 16:09:42 CST 2017 : === Using tmpdir: /var/folders/gz/ch3n2mp51m9386sytqf97s6w0000gn/T/tmp.XXXXXXXXXX.WnIjTd5J
~/Downloads/tensorflow/bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles ~/Downloads/tensorflow
~/Downloads/tensorflow
/var/folders/gz/ch3n2mp51m9386sytqf97s6w0000gn/T/tmp.XXXXXXXXXX.WnIjTd5J ~/Downloads/tensorflow
Wed Apr 12 16:09:45 CST 2017 : === Building wheel
~/Downloads/tensorflow
Wed Apr 12 16:10:02 CST 2017 : === Output wheel file is in: /tmp/tensorflow_pkg
然后我找不到whl
文件,你知道我在哪里可以找到它吗?
谢谢!
现在,我找到了whl
文件,但运行以下代码后,tensorflow没有变化,我也收到了警告。这个警告会不会对张量流产生任何影响?
(dlnd-tf-lab) ->sudo pip install tmp/tensorflow_pkg/tensorflow-1.0.1-cp35-cp35m-macosx_10_9_x86_64.whl
Password:
The directory '/Users/Natsume/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/Natsume/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: tensorflow==1.0.1 from file:///Users/Natsume/Downloads/tmp/tensorflow_pkg/tensorflow-1.0.1-cp35-cp35m-macosx_10_9_x86_64.whl in /Users/Natsume/miniconda2/envs/dlnd-tf-lab/lib/python3.5/site-packages
Requirement already satisfied: numpy>=1.11.0 in /Users/Natsume/miniconda2/envs/dlnd-tf-lab/lib/python3.5/site-packages (from tensorflow==1.0.1)
Requirement already satisfied: six>=1.10.0 in /Users/Natsume/miniconda2/envs/dlnd-tf-lab/lib/python3.5/site-packages (from tensorflow==1.0.1)
Requirement already satisfied: wheel>=0.26 in /Users/Natsume/miniconda2/envs/dlnd-tf-lab/lib/python3.5/site-packages (from tensorflow==1.0.1)
Requirement already satisfied: protobuf>=3.1.0 in /Users/Natsume/miniconda2/envs/dlnd-tf-lab/lib/python3.5/site-packages (from tensorflow==1.0.1)
Requirement already satisfied: setuptools in /Users/Natsume/miniconda2/envs/dlnd-tf-lab/lib/python3.5/site-packages (from protobuf>=3.1.0->tensorflow==1.0.1)
但是,当我尝试上面链接中提供的代码来检查一切是否按预期工作时,我仍然收到以下警告,表示没有效果。谁能在这帮助我?感谢
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
b'Hello, TensorFlow!'
答案 0 :(得分:3)
总结我的解决方案
按照问题中提供的链接,从源代码安装tensorflow的官方指南;
请耐心安装brew
和bazel
:安装bazel,转到bazel。确保您拥有最新版本。安装或升级速度非常慢,但它会让你耐心等待。
按照官方说明一直到./configure
的步骤,只需使用default
选项或no
设置所有内容;
现在是最后一步:官方指示告诉你bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
。但是,就我而言,我可以在Mac上找到/tmp/tensorflow_pkg
。幸运的是,如果你运行bazel-bin/tensorflow/tools/pip_package/build_pip_package Your_Full_Path/tmp/tensorflow_pkg
,就会看到它。请注意,tmp
文件夹和tensorflow
文件夹位于同一目录或同一级别。
转到存储tmp
和tensorflow
的目录,运行pip install /tmp/tensorflow_pkg/tensorflow-1.2.0rc0-cp35-cp35m-macosx_10_9_x86_64.whl
现在你做到了。
答案 1 :(得分:1)
正如Daniel在评论中所述,在TensorFlow成功构建之后利用完整路径可以访问和安装wheel文件。