Tensorflow: Python 3.7 兼容性

创建于 2018-07-03  ·  80评论  ·  资料来源: tensorflow/tensorflow

我确信开发人员正在努力赶上 Python 3.7。
有时间线吗?

pip3 install tensorflow - 显然不起作用,从源代码构建:

操作系统平台和发行版:Mac OS X 10.13.5
Python:Python 3.7.0(自制)
TensorFlow 安装自:源 (https://github.com/tensorflow/tensorflow.git)
TensorFlow 版本:TensorFlow 1.9.0-rc2
巴泽尔版本:

Build label: 0.15.0-homebrew
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Jun 26 12:42:27 2018 (1530016947)
Build timestamp: 1530016947
Build timestamp as int: 1530016947

CUDA/cuDNN 版本:无
GPU型号和内存:无
重现的确切命令:
bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package

Starting local Bazel server and connecting to it...
...........................
WARNING: /private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/external/grpc/BUILD:1992:1: in srcs attribute of cc_library rule @grpc//:grpc_nanopb: please do not import '@grpc//third_party/nanopb:pb_common.c' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'grpc_generate_one_off_targets', the error might have been caused by the macro implementation in /private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/external/grpc/bazel/grpc_build_system.bzl:172:12
WARNING: /private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/external/grpc/BUILD:1992:1: in srcs attribute of cc_library rule @grpc//:grpc_nanopb: please do not import '@grpc//third_party/nanopb:pb_decode.c' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'grpc_generate_one_off_targets', the error might have been caused by the macro implementation in /private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/external/grpc/bazel/grpc_build_system.bzl:172:12
WARNING: /private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/external/grpc/BUILD:1992:1: in srcs attribute of cc_library rule @grpc//:grpc_nanopb: please do not import '@grpc//third_party/nanopb:pb_encode.c' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'grpc_generate_one_off_targets', the error might have been caused by the macro implementation in /private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/external/grpc/bazel/grpc_build_system.bzl:172:12
WARNING: /Users/zardoz/Projects/tensorflow/tensorflow/contrib/learn/BUILD:17:1: in py_library rule //tensorflow/contrib/learn:learn: target '//tensorflow/contrib/learn:learn' depends on deprecated target '//tensorflow/contrib/session_bundle:exporter': No longer supported. Switch to SavedModel immediately.
WARNING: /Users/zardoz/Projects/tensorflow/tensorflow/contrib/learn/BUILD:17:1: in py_library rule //tensorflow/contrib/learn:learn: target '//tensorflow/contrib/learn:learn' depends on deprecated target '//tensorflow/contrib/session_bundle:gc': No longer supported. Switch to SavedModel immediately.
WARNING: /Users/zardoz/Projects/tensorflow/tensorflow/contrib/timeseries/python/timeseries/BUILD:356:1: in py_library rule //tensorflow/contrib/timeseries/python/timeseries:ar_model: target '//tensorflow/contrib/timeseries/python/timeseries:ar_model' depends on deprecated target '//tensorflow/contrib/distributions:distributions_py': TensorFlow Distributions has migrated to TensorFlow Probability (https://github.com/tensorflow/probability). Deprecated copies remaining in tf.contrib.distributions are unmaintained, unsupported, and will be removed by late 2018. You should update all usage of `tf.contrib.distributions` to `tfp.distributions`.
WARNING: /Users/zardoz/Projects/tensorflow/tensorflow/contrib/timeseries/python/timeseries/state_space_models/BUILD:73:1: in py_library rule //tensorflow/contrib/timeseries/python/timeseries/state_space_models:kalman_filter: target '//tensorflow/contrib/timeseries/python/timeseries/state_space_models:kalman_filter' depends on deprecated target '//tensorflow/contrib/distributions:distributions_py': TensorFlow Distributions has migrated to TensorFlow Probability (https://github.com/tensorflow/probability). Deprecated copies remaining in tf.contrib.distributions are unmaintained, unsupported, and will be removed by late 2018. You should update all usage of `tf.contrib.distributions` to `tfp.distributions`.
WARNING: /Users/zardoz/Projects/tensorflow/tensorflow/contrib/timeseries/python/timeseries/state_space_models/BUILD:230:1: in py_library rule //tensorflow/contrib/timeseries/python/timeseries/state_space_models:filtering_postprocessor: target '//tensorflow/contrib/timeseries/python/timeseries/state_space_models:filtering_postprocessor' depends on deprecated target '//tensorflow/contrib/distributions:distributions_py': TensorFlow Distributions has migrated to TensorFlow Probability (https://github.com/tensorflow/probability). Deprecated copies remaining in tf.contrib.distributions are unmaintained, unsupported, and will be removed by late 2018. You should update all usage of `tf.contrib.distributions` to `tfp.distributions`.
WARNING: /Users/zardoz/Projects/tensorflow/tensorflow/contrib/bayesflow/BUILD:17:1: in py_library rule //tensorflow/contrib/bayesflow:bayesflow_py: target '//tensorflow/contrib/bayesflow:bayesflow_py' depends on deprecated target '//tensorflow/contrib/distributions:distributions_py': TensorFlow Distributions has migrated to TensorFlow Probability (https://github.com/tensorflow/probability). Deprecated copies remaining in tf.contrib.distributions are unmaintained, unsupported, and will be removed by late 2018. You should update all usage of `tf.contrib.distributions` to `tfp.distributions`.
WARNING: /Users/zardoz/Projects/tensorflow/tensorflow/contrib/seq2seq/BUILD:23:1: in py_library rule //tensorflow/contrib/seq2seq:seq2seq_py: target '//tensorflow/contrib/seq2seq:seq2seq_py' depends on deprecated target '//tensorflow/contrib/distributions:distributions_py': TensorFlow Distributions has migrated to TensorFlow Probability (https://github.com/tensorflow/probability). Deprecated copies remaining in tf.contrib.distributions are unmaintained, unsupported, and will be removed by late 2018. You should update all usage of `tf.contrib.distributions` to `tfp.distributions`.
WARNING: /Users/zardoz/Projects/tensorflow/tensorflow/contrib/kfac/python/ops/BUILD:80:1: in py_library rule //tensorflow/contrib/kfac/python/ops:loss_functions: target '//tensorflow/contrib/kfac/python/ops:loss_functions' depends on deprecated target '//tensorflow/contrib/distributions:distributions_py': TensorFlow Distributions has migrated to TensorFlow Probability (https://github.com/tensorflow/probability). Deprecated copies remaining in tf.contrib.distributions are unmaintained, unsupported, and will be removed by late 2018. You should update all usage of `tf.contrib.distributions` to `tfp.distributions`.
WARNING: /Users/zardoz/Projects/tensorflow/tensorflow/contrib/BUILD:14:1: in py_library rule //tensorflow/contrib:contrib_py: target '//tensorflow/contrib:contrib_py' depends on deprecated target '//tensorflow/contrib/distributions:distributions_py': TensorFlow Distributions has migrated to TensorFlow Probability (https://github.com/tensorflow/probability). Deprecated copies remaining in tf.contrib.distributions are unmaintained, unsupported, and will be removed by late 2018. You should update all usage of `tf.contrib.distributions` to `tfp.distributions`.
INFO: Analysed target //tensorflow/tools/pip_package:build_pip_package (303 packages loaded).
INFO: Found 1 target...
INFO: From Linking external/grpc/libgrpc_base_c.a [for host]:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(endpoint_pair_uv.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(endpoint_pair_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(ev_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(fork_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(gethostname_fallback.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(gethostname_host_name_max.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(iocp_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(iomgr_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(pollset_set_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(pollset_uv.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(pollset_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(resolve_address_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(socket_utils_linux.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(socket_utils_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(socket_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(tcp_client_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(tcp_server_utils_posix_noifaddrs.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(tcp_server_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(tcp_uv.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(tcp_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(timer_uv.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(unix_sockets_posix_noop.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc_base_c.a(wakeup_fd_eventfd.o) has no symbols
INFO: From Linking external/grpc/libalts_util.a [for host]:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libalts_util.a(check_gcp_environment_linux.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libalts_util.a(check_gcp_environment_windows.o) has no symbols
INFO: From Linking external/grpc/libtsi.a [for host]:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libtsi.a(ssl_session_openssl.o) has no symbols
INFO: From Linking external/grpc/libgrpc++_base.a [for host]:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgrpc++_base.a(rpc_method.o) has no symbols
INFO: From Linking external/grpc/libgpr_base.a [for host]:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(cpu_iphone.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(cpu_linux.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(cpu_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(env_linux.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(env_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(log_android.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(log_linux.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(log_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(string_util_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(string_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(sync_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(time_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(tls_pthread.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(tmpfile_msys.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(tmpfile_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(wrap_memcpy.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(thd_windows.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/libgpr_base.a(stap_timers.o) has no symbols
INFO: From Linking external/grpc/third_party/address_sorting/libaddress_sorting.a [for host]:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/grpc/third_party/address_sorting/libaddress_sorting.a(address_sorting_windows.o) has no symbols
ERROR: /Users/zardoz/Projects/tensorflow/tensorflow/python/BUILD:5315:1: Executing genrule //tensorflow/python:framework/fast_tensor_util.pyx_cython_translation failed (Exit 1)
Traceback (most recent call last):
  File "/private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/execroot/org_tensorflow/bazel-out/host/bin/external/cython/cython_binary.runfiles/cython/cython.py", line 17, in <module>
    main(command_line = 1)
  File "/private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/external/cython/Cython/Compiler/Main.py", line 720, in main
    result = compile(sources, options)
  File "/private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/external/cython/Cython/Compiler/Main.py", line 695, in compile
    return compile_multiple(source, options)
  File "/private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/external/cython/Cython/Compiler/Main.py", line 666, in compile_multiple
    context = options.create_context()
  File "/private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/external/cython/Cython/Compiler/Main.py", line 590, in create_context
    self.cplus, self.language_level, options=self)
  File "/private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/external/cython/Cython/Compiler/Main.py", line 75, in __init__
    from . import Builtin, CythonScope
  File "/private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/external/cython/Cython/Compiler/CythonScope.py", line 5, in <module>
    from .UtilityCode import CythonUtilityCode
  File "/private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/external/cython/Cython/Compiler/UtilityCode.py", line 3, in <module>
    from .TreeFragment import parse_from_strings, StringParseContext
  File "/private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/external/cython/Cython/Compiler/TreeFragment.py", line 17, in <module>
    from .Visitor import VisitorTransform
  File "/private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/external/cython/Cython/Compiler/Visitor.py", line 15, in <module>
    from . import ExprNodes
  File "/private/var/tmp/_bazel_zardoz/5e080a8a46c0e2b2146c013eb1079337/external/cython/Cython/Compiler/ExprNodes.py", line 2875
    await = None
          ^
SyntaxError: invalid syntax
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 179.318s, Critical Path: 6.38s
INFO: 413 processes: 413 local.
FAILED: Build did NOT complete successfully
feature

最有用的评论

@activatedgeek 请原谅我,但我看不到降级如何回答关于使 Tensorflow 与 Python 3.7 兼容的时间表(大约一个月前发布)的 OP 问题。

所有80条评论

谢谢你的文章。 我们注意到您没有在问题模板中填写以下字段。 如果它们与您的情况相关,您能否更新它们,或者将它们保留为 N/A? 谢谢。
我是否编写了自定义代码
操作系统平台和分发
TensorFlow 安装自
TensorFlow 版本
巴泽尔版
CUDA/cuDNN 版本
GPU型号和内存
重现的确切命令

根据要求更新了原始帖子。

@homofortis您可以同时将它与 Homebrew 一起使用来降级您的 Python 版本。

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb

asyncawait现在是关键字,需要在 TF 代码库中替换。 请参阅https://docs.python.org/3/whatsnew/3.7.html#summary -release-highlights

17022

@activatedgeek 请原谅我,但我看不到降级如何回答关于使 Tensorflow 与 Python 3.7 兼容的时间表(大约一个月前发布)的 OP 问题。

@homofortis道歉。 我可能在那里漏掉了几句话,并认为您的主要目标是从源代码编译。 很多搜索都导致了这个问题,我认为这对希望只运行 Tensorflow 的每个人都有好处。

正如我从描述中看到的,诊断与 tensorflow 与 Python-3.7 的兼容性无关,而是使用了太旧的 Cython,目前这个问题并没有重现,因为 Bazel 工作区中提到的 Cython 已经足够新了。 另一方面,至少有 2 个 Python-3.7 兼容性问题:

  • 使用async关键字作为pywrap_tensorflow_internal.py中从tensorflow/c/eager/c_api.{h,cc} $ 生成的变量名 - #20690
  • 以及将PyUnicode_AsUTF8AndSize()的返回类型从char *更改const char *造成的损坏
    也许将后者放在单独的问题上会更好。

FWIW,我刚刚使用 VS2017 和以下补丁在 Windows 上使用 MKL 为 Python 3.7 构建(尚未测试)tensorflow 1.9:

diff --git a/tensorflow/c/eager/c_api.h b/tensorflow/c/eager/c_api.h
index 1862af3ce2..093b97110f 100644
--- a/tensorflow/c/eager/c_api.h
+++ b/tensorflow/c/eager/c_api.h
@@ -76,7 +76,7 @@ typedef enum TFE_ContextDevicePlacementPolicy {
 // Sets the default execution mode (sync/async). Note that this can be
 // overridden per thread using TFE_ContextSetAsyncForThread.
 TF_CAPI_EXPORT extern void TFE_ContextOptionsSetAsync(TFE_ContextOptions*,
-                                                      unsigned char async);
+                                                      unsigned char is_async);

 TF_CAPI_EXPORT extern void TFE_ContextOptionsSetDevicePlacementPolicy(
     TFE_ContextOptions*, TFE_ContextDevicePlacementPolicy);
@@ -125,7 +125,7 @@ TFE_ContextGetDevicePlacementPolicy(TFE_Context*);

 // Overrides the execution mode (sync/async) for the current thread.
 TF_CAPI_EXPORT extern void TFE_ContextSetAsyncForThread(TFE_Context*,
-                                                        unsigned char async,
+                                                        unsigned char is_async,
                                                         TF_Status* status);

 // Causes the calling thread to block till all ops dispatched in async mode
diff --git a/tensorflow/core/platform/windows/port.cc b/tensorflow/core/platform/windows/port.cc
index 174f41a993..b06434620e 100644
--- a/tensorflow/core/platform/windows/port.cc
+++ b/tensorflow/core/platform/windows/port.cc
@@ -57,6 +57,11 @@ int NumSchedulableCPUs() {
   return system_info.dwNumberOfProcessors;
 }

+int NumHyperthreadsPerCore() {
+  static const int ht_per_core = tensorflow::port::CPUIDNumSMT();
+  return (ht_per_core > 0) ? ht_per_core : 1;
+}
+
 void* AlignedMalloc(size_t size, int minimum_alignment) {
 #ifdef TENSORFLOW_USE_JEMALLOC
   void* ptr = NULL;
diff --git a/tensorflow/python/eager/pywrap_tfe_src.cc b/tensorflow/python/eager/pywrap_tfe_src.cc
index 6c9481c3af..13edbb07db 100644
--- a/tensorflow/python/eager/pywrap_tfe_src.cc
+++ b/tensorflow/python/eager/pywrap_tfe_src.cc
@@ -813,7 +813,7 @@ char* TFE_GetPythonString(PyObject* o) {
   }
 #if PY_MAJOR_VERSION >= 3
   if (PyUnicode_Check(o)) {
-    return PyUnicode_AsUTF8(o);
+    return (char *)PyUnicode_AsUTF8(o);
   }
 #endif
   return nullptr;
diff --git a/tensorflow/python/lib/core/ndarray_tensor.cc b/tensorflow/python/lib/core/ndarray_tensor.cc
index 9df38d464c..4150fbfdd4 100644
--- a/tensorflow/python/lib/core/ndarray_tensor.cc
+++ b/tensorflow/python/lib/core/ndarray_tensor.cc
@@ -154,7 +154,7 @@ Status PyBytesArrayMap(PyArrayObject* array, F f) {
     if (PyUnicode_Check(item.get())) {
 #if PY_VERSION_HEX >= 0x03030000
       // Accept unicode by converting to UTF-8 bytes.
-      ptr = PyUnicode_AsUTF8AndSize(item.get(), &len);
+      ptr = (char *)PyUnicode_AsUTF8AndSize(item.get(), &len);
       if (!ptr) {
         return errors::Internal("Unable to get element as UTF-8.");
       }
diff --git a/tensorflow/python/lib/core/py_func.cc b/tensorflow/python/lib/core/py_func.cc
index 30c1a9c759..231a66de59 100644
--- a/tensorflow/python/lib/core/py_func.cc
+++ b/tensorflow/python/lib/core/py_func.cc
@@ -322,7 +322,7 @@ Status ConvertNdarrayToTensor(PyObject* obj, Tensor* ret) {
         Py_ssize_t el_size;
         if (PyBytes_AsStringAndSize(input_data[i], &el, &el_size) == -1) {
 #if PY_MAJOR_VERSION >= 3
-          el = PyUnicode_AsUTF8AndSize(input_data[i], &el_size);
+          el = (char *)PyUnicode_AsUTF8AndSize(input_data[i], &el_size);
 #else
           el = nullptr;
           if (PyUnicode_Check(input_data[i])) {

我更喜欢将const限定符添加到目标,而不是从PyUnicode_AsUTF8AndSize()的结果中删除它。 这是一个常量字符串,不应修改。

@asimshankar说他一直在审查和发送关于这个主题的 PR。 我会分配给他的。

在 Arch Linux 中使用 python 3.7 从源代码构建时,我也遇到了类似的问题。

ERROR: /home/rharish/.cache/bazel/_bazel_rharish/5d4d7b1255c710f6c814ab2f3f084405/external/protobuf_archive/BUILD:659:1: C++ compilation of rule '@protobuf_archive//:python/google/protobuf/pyext/_message.so' failed (Exit 1): crosstool_wrapper_driver_is_not_gcc failed: error executing command 
  (cd /home/rharish/.cache/bazel/_bazel_rharish/5d4d7b1255c710f6c814ab2f3f084405/execroot/org_tensorflow && \
  exec env - \
    LD_LIBRARY_PATH=:/usr/local/lib:/opt/cuda/lib64 \
    PATH=/home/rharish/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/opt/cuda/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl \
    PWD=/proc/self/cwd \
  external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -MD -MF bazel-out/host/bin/external/protobuf_archive/_objs/python/google/protobuf/pyext/_message.so/descriptor_containers.pic.d '-frandom-seed=bazel-out/host/bin/external/protobuf_archive/_objs/python/google/protobuf/pyext/_message.so/descriptor_containers.pic.o' -iquote external/protobuf_archive -iquote bazel-out/host/genfiles/external/protobuf_archive -iquote bazel-out/host/bin/external/protobuf_archive -iquote external/bazel_tools -iquote bazel-out/host/genfiles/external/bazel_tools -iquote bazel-out/host/bin/external/bazel_tools -iquote external/local_config_python -iquote bazel-out/host/genfiles/external/local_config_python -iquote bazel-out/host/bin/external/local_config_python -isystem external/protobuf_archive/python -isystem bazel-out/host/genfiles/external/protobuf_archive/python -isystem bazel-out/host/bin/external/protobuf_archive/python -isystem external/protobuf_archive/src -isystem bazel-out/host/genfiles/external/protobuf_archive/src -isystem bazel-out/host/bin/external/protobuf_archive/src -isystem external/local_config_python/python_include -isystem bazel-out/host/genfiles/external/local_config_python/python_include -isystem bazel-out/host/bin/external/local_config_python/python_include '-std=c++11' -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -fPIC -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -fno-omit-frame-pointer -no-canonical-prefixes -DNDEBUG -g0 -O2 -ffunction-sections -fdata-sections -g0 '-march=native' -g0 -DHAVE_PTHREAD -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -Wno-unused-function -Wno-writable-strings '-DGOOGLE_PROTOBUF_HAS_ONEOF=1' '-DPROTOBUF_PYTHON_ALLOW_OVERSIZE_PROTOS=1' -c external/protobuf_archive/python/google/protobuf/pyext/descriptor_containers.cc -o bazel-out/host/bin/external/protobuf_archive/_objs/python/google/protobuf/pyext/_message.so/descriptor_containers.pic.o)
external/protobuf_archive/python/google/protobuf/pyext/descriptor_containers.cc: In function 'bool google::protobuf::python::descriptor::_GetItemByKey(google::protobuf::python::PyContainer*, PyObject*, const void**)':
external/protobuf_archive/python/google/protobuf/pyext/descriptor_containers.cc:69:45: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
        ((*(charpp) = PyUnicode_AsUTF8AndSize(ob, (sizep))) == NULL? -1: 0): \
                      ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
external/protobuf_archive/python/google/protobuf/pyext/descriptor_containers.cc:172:13: note: in expansion of macro 'PyString_AsStringAndSize'
         if (PyString_AsStringAndSize(key, &name, &name_size) < 0) {
             ^~~~~~~~~~~~~~~~~~~~~~~~
external/protobuf_archive/python/google/protobuf/pyext/descriptor_containers.cc:69:45: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
        ((*(charpp) = PyUnicode_AsUTF8AndSize(ob, (sizep))) == NULL? -1: 0): \
                      ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
external/protobuf_archive/python/google/protobuf/pyext/descriptor_containers.cc:189:13: note: in expansion of macro 'PyString_AsStringAndSize'
         if (PyString_AsStringAndSize(key, &camelcase_name, &name_size) < 0) {
             ^~~~~~~~~~~~~~~~~~~~~~~~
At global scope:
cc1plus: warning: unrecognized command line option '-Wno-writable-strings'
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 63.634s, Critical Path: 9.08s
INFO: 464 processes: 464 local.
FAILED: Build did NOT complete successfully

我的系统配置是:
操作系统平台和发行版:Arch Linux
Python:Python 3.7.0
TensorFlow 安装自:源码(https://github.com/tensorflow/tensorflow.git),master 分支
TensorFlow 版本:TensorFlow 1.9.0
巴泽尔版本:0.16.0
CUDA/cuDNN 版本:CUDA 9.2
GPU 型号和内存:NVIDIA GeForce GTX 960M,4GB

@bstrener自愿更新 #21202,这将使我们更进一步。 但似乎我们需要等待支持 Python 3.7 的 protobuf 版本,然后更新 TensorFlow 依赖项以使用新的 protobuf 版本。

@rharish101
如果您使用的是 Arch Linux,您可以使用pacman-S python-tensorflow安装 Tensorflow。

@rharish101
如果需要CUDA支持,可以安装pacman-S python-tensorflow-cuda

@hzxie 是的,它现在运行良好! Arch 的人是如何让它发挥作用的?

尚无 protobuf 版本支持 3.7,但如果您愿意使用 master 的快照,则可以为 3.7 构建 TF

@bstrener
我仍然无法编译最新的大师。 构建退出并出现错误。

操作系统平台和发行版:Mac OS X 10.13.5
Python:Python 3.7.0
TensorFlow 安装自:源 (https://github.com/tensorflow/tensorflow.git)
TensorFlow 版本:TensorFlow 1.10
Bazel 版本:0.15.2-homebrew
CUDA/cuDNN 版本:无
GPU型号和内存:无
重现的确切命令:
bazel build --config=opt //tensorflow/tools/pip_package :build_pip_package

ERROR: /Users/zardoz/Projects/tensorflow/tensorflow/python/eager/BUILD:10:1: C++ compilation of rule '//tensorflow/python/eager:pywrap_tfe_lib' failed (Exit 1)
tensorflow/python/eager/pywrap_tfe_src.cc:219:11: error: cannot initialize a variable of type 'char *' with an rvalue of type 'const char *'
    char* buf = PyUnicode_AsUTF8AndSize(py_value, &size);
          ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tensorflow/python/eager/pywrap_tfe_src.cc:834:12: error: cannot initialize return object of type 'char *' with an rvalue of type 'const char *'
    return PyUnicode_AsUTF8(o);
           ^~~~~~~~~~~~~~~~~~~
2 errors generated.
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 5896.213s, Critical Path: 267.71s
INFO: 2883 processes: 2883 local.
FAILED: Build did NOT complete successfully

@cgohlke如何为 python 3.7 构建 tensorflow-gpu?

@homofortis那是因为这个 pr 还没有合并。 你需要自己把它拉进去。 https://github.com/tensorflow/tensorflow/pull/21202

要将 py37 修复程序拉入您当前的存储库,如下所示:

git remote add bstriner https://github.com/bstriner/tensorflow.git
git fetch bstriner
git merge bstriner/py37

基本上,如果您看到const char *被强制转换为char *或类似的问题,那就是 py37 中的更改。 在链接的 PR 中修复和讨论。

@bstrener我需要一个用于python 3.7的tensorflow gpu轮文件。 我不能自己建造它

这个问题什么时候解决??

感谢@bstrener的贡献(PR #21202),我们现在应该能够为 Python 3.7 构建。 然而,正如他在 PR 中提到的那样,eigen 和 protobuf 库仍然需要修复才能在 Windows 上编译。

@gunan @angersson会知道 TensorFlow 1.11 的官方版本是否支持 Python 3.7,或者您是否必须从源代码编译。

我们仍然有一个问题需要解决。
由于社区要求(与 ubuntu 14 兼容),我们所有的构建基础设施都使用 ubuntu 14。
但是,python 3.7 在 ubuntu 14 上构建并不简单,因为它需要 ubuntu 附带的一些库的更新版本。

当我们等待 Windows 上的 eigen 和 protobuf 修复时,我们会解决这些问题。
但这意味着 1.11 不会有 python 3.7 的预构建包

@SukeshP1995你可以试试这个网址https://www.lfd.uci.edu/~gohlke/pythonlibs/#tensorflow

是否有任何适用于 python 3.7 的 Ubuntu 16.04 TensorFlow gpu 轮子可用? 或者,如果没有,我能否获得一份自己构建的简短指南? 我没有经验在没有任何人牵着我的情况下出去做:)

@morenoh149仅适用于 python 3.6。 我有 3.7,因为我刚刚进行了全新安装。

https://github.com/tensorflow/tensorflow/issues/20517#issuecomment -418442189 仍然适用。
除了基础设施问题(ubuntu 14 上的 python 3.7),并非我们所有的依赖项都支持 python 3.7。 所以我们仍在与他们合作以迁移到 python 3.7。

啊不,这是@bjtho08 tensorflow 需要停止在 3.7 中使用新的 python 关键字的根本问题。 这就是这个线程的内容。 与此同时,您可以使用待定的分叉或使用 3.6

@morenoh149所以我的选择是构建旧版本的 python 或从 git/master 构建 tensorflow?

从今天开始是的。 此 PR https://github.com/tensorflow/tensorflow/pull/21202在 master 上,但尚未发布版本。 FWIW,您可以使用pyenv在系统上安装许多 python 版本。 专业的软件工程师应该能够根据项目确定他们的依赖项和工具。

@morenoh149 @bjtho08从 master 分支构建 tensorflow 是不够的。 一些依赖项仍然不支持 3.7。

@adrianodennanni依赖项支持 3.7,但在已发布版本中不支持。 您需要将工作区中的库更改为当前的主库。 在这些库具有稳定版本之前,无法更改 tensorflow 中的依赖项。

所以,对于当前的 protobuf,使用这个:

    PROTOBUF_URLS = [
        "https://mirror.bazel.build/github.com/google/protobuf/archive/a6e1cc7e328c45a0cb9856c530c8f6cd23314163.tar.gz",
        "https://github.com/google/protobuf/archive/a6e1cc7e328c45a0cb9856c530c8f6cd23314163.tar.gz",
    ]
    PROTOBUF_SHA256 = "f785d2009ea7c8484cb0443d9db8fe55f73cfdb6e112bfa659a8a5cdaf664ccd"
    PROTOBUF_STRIP_PREFIX = "protobuf-a6e1cc7e328c45a0cb9856c530c8f6cd23314163"

您可能还需要最新的特征。

@rharish101
如果需要CUDA支持,可以安装pacman-S python-tensorflow-cuda

做得好谢谢

从今天开始是的。 此 PR #21202 在 master 上,但尚未发布版本。 FWIW,您可以使用pyenv在系统上安装许多 python 版本。 专业的软件工程师应该能够根据项目确定他们的依赖项和工具。

感谢您的提示, @morenoh149 ! 我通过使用 pyenv 和 CUDA 9.0 重新开始使它工作:)

@古南

但是,python 3.7 在 ubuntu 14 上构建并不简单,因为它需要 ubuntu 附带的一些库的更新版本。

我想分享我在 Ubuntu 12 上构建 Python-3.7 的经验,如果你还没有解决这个问题,我希望它会有所帮助。 我使用以下配置标志构建:

    --prefix=... \
    --enable-ipv6 \
    --with-dbmliborder=gdbm \
    --with-system-expat \
    --with-computed-gotos \
    --with-system-ffi \
    --with-ensurepip=no

而对于 Python 而言,唯一过时的系统库是 OpenSSL,因此无法构建ssl模块。 为了解决这个问题,我决定从源代码构建 OpenSSL 并使用cryptography配方(https://cryptography.io/en/latest/installation/#static-wheels)静态链接它:

  • 仅使用静态库构建正确配置的 OpenSSL:
OPENSSL_VERSION=1.0.2p
wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
tar xf openssl-${OPENSSL_VERSION}.tar.gz
cd openssl-${OPENSSL_VERSION}
./config no-shared no-ssl2 no-ssl3 -fPIC --prefix=$(pwd)/_openssl
make && make install
  • 通过将标志传递给configure脚本使用该 OpenSSL 构建 Python: --with-openssl=$(pwd)/openssl-${OPENSSL_VERSION}/_openssl ,因此configure调用如下所示:
./configure
    --prefix=... \
    --enable-ipv6 \
    --with-dbmliborder=gdbm \
    --with-system-expat \
    --with-computed-gotos \
    --with-system-ffi \
    --with-ensurepip=no \
    --with-openssl=$(pwd)/openssl-${OPENSSL_VERSION}/_openssl

除了过时的 OpenSSL 问题之外,我还没有遇到在旧 Ubuntu 上构建 Python-3.7 的问题,我测试了我的构建,它似乎工作正常,来自 Python 源代码的测试通过。

唠叨受让人@gunan@angersson :已经 14 天没有活动,这个问题有受让人。 请相应地更新标签和/或状态。

@bstriner您建议更改 PROTOBUF_URLS、PROTOBUF_SHA256 和 PROTOBUF_STRIP_PREFIX。 我假设您在 tensorflow/workspace.bzl 中执行此操作? 其他地方? 谢谢。

实际上,在尝试了这个之后, tensorflow 1.11 的 bazel 构建会导致:

错误:tensorflow/tensorflow/tools/pip_package/ BUILD:216 :1:加载包“tensorflow”时出错:找不到扩展文件。 无法为“@bazel_skylib//:lib.bzl”加载包:“//tensorflow/tools/pip_package :build_pip_package ”无法解析和引用存储库

@jeffcbecker我也遇到了这个问题。 似乎 URL https://mirror.bazel.build/github.com/google/protobuf/archive/a6e1cc7e328c45a0cb9856c530c8f6cd23314163.tar.gz不可用。 有人有解决方法吗?

我能够通过使用 Python 3.6 来解决问题。
干杯
杰夫
从我的 T-Mobile 4G LTE 设备发送
-------- 原始消息--------来自:Adriano Dennanni [email protected]日期:10/21/18 1:40 PM (GMT-08:00) 收件人:tensorflow/tensorflow [email protected]抄送:jeffcbecker [email protected] ,提及提及@noreply.github.com主题:回复:[tensorflow/tensorflow] Python 3.7 兼容性(#20517)
@jeffcbecker我也遇到了这个问题。 似乎 URL https://mirror.bazel.build/github.com/google/protobuf/archive/a6e1cc7e328c45a0cb9856c530c8f6cd23314163.tar.gz不可用。 有人有解决方法吗?


你收到这个是因为你被提到了。
直接回复此电子邮件,在 GitHub 上查看它,或将线程静音。
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/tensorflow/tensorflow","title ":"tensorflow/tensorflow","subtitle":"GitHub 仓库","main_image_url":" https://assets-cdn.github.com/images/email/message_cards/header.png ","avatar_image_url":" https://assets-cdn.github.com/images/email/message_cards/avatar.png ","action":{"name":"在 GitHub 中打开","url":" https://github.com /tensorflow/tensorflow "}},"updates":{"snippets":[{"icon":"PERSON","message":" @adrianodennanni in #20517: @jeffcbecker我也遇到了这个问题。看来URL https://mirror.bazel.build/github.com/google/protobuf/archive/a6e1cc7e328c45a0cb9856c530c8f6cd23314163.tar.gz不可用。有人有解决方法吗?"}],"action":{"name":"View Issue","url":" https://github.com/tensorflow /tensorflow/issues/20517#issuecomment -431701713"}}}
[
{
"@context": " http://schema.org ",
"@type": "EmailMessage",
“潜在行动”:{
"@type": "ViewAction",
“目标”:“ https://github.com/tensorflow/tensorflow/issues/20517#issuecomment -431701713”,
“网址”:“ https://github.com/tensorflow/tensorflow/issues/20517#issuecomment -431701713”,
“名称”:“查看问题”
},
"description": "在 GitHub 上查看这个问题",
“出版商”:{
"@type": "组织",
“名称”:“GitHub”,
“网址”:“ https://github.com
}
},
{
"@type": "留言卡",
“@context”:“ http://schema.org/extensions ”,
"hideOriginalBody": "假",
“发起人”:“AF6C5A86-E920-430C-9C59-A73278B5EFEB”,
"title": "Re: [tensorflow/tensorflow] Python 3.7 兼容性 (#20517)",
“部分”:[
{
“文本”: ””,
“activityTitle”:“ Adriano Dennanni ”,
“activityImage”:“ https://assets-cdn.github.com/images/email/message_cards/avatar.png ”,
"activitySubtitle": "@adrianodennanni",
“事实”:[

]
}
],
“潜在行动”:[
{
"name": "添加评论",
"@type": "行动卡",
“输入”:[
{
“isMultiLine”:真,
"@type": "文本输入",
"id": "问题评论",
“是必需的”:假
}
],
“行动”:[
{
“名称”:“评论”,
"@type": "HttpPOST",
“目标”:“ https://api.github.com ”,
"body": "{n"commandName": "IssueComment",n"repositoryFullName": "tensorflow/tensorflow",n"issueId": 20517,n"IssueComment": "{{IssueComment.value}}"n}"
}
]
},
{
"name": "关闭问题",
"@type": "HttpPOST",
“目标”:“ https://api.github.com ”,
"body": "{n"commandName": "IssueClose",n"repositoryFullName": "tensorflow/tensorflow",n"issueId": 20517n}"
},
{
“目标”:[
{
“操作系统”:“默认”,
“uri”:“ https://github.com/tensorflow/tensorflow/issues/20517#issuecomment -431701713”
}
],
"@type": "OpenUri",
"name": "在 GitHub 上查看"
},
{
"name": "退订",
"@type": "HttpPOST",
“目标”:“ https://api.github.com ”,
"body": "{n"commandName": "MuteNotification",n"threadId": 352548653n}"
}
],
“主题颜色”:“26292E”
}
]

protobuf 轮已升级为支持 3.7。

现在是时候发布 tensorflow 以支持 3.7 了。

好消息!
您想发送 PR 以在工作区和 setup.py 中增加 TF protobuf 依赖项吗?

Tensorflow 显然是 Python-3.7.1 中最后一个缺失的部分。 由于 Python-3.7 比 Python-3.6 更高效,因此它可能会对某些 Cloud Electric 账单产生影响。

https://github.com/fo40225/tensorflow-windows-wheel/tree/master/1.12.0/py37

对于任何想要在 windows 上使用 python 3.7 测试 tensorflow 1.12.0 的人。

依赖于 protobuf v3.6.0 + cherry-pick https://github.com/protocolbuffers/protobuf/commit/0a59054c30e4f0ba10f10acfc1d7f3814c63e1a7

自 3.7 发布以来已经有几个月了,TF 的更新仍在推出,那么兼容性这个词/ETA 是什么?

那么2018年即将结束,支持python 3.7的官方发布还是一个泡沫? :)

@adrianodennanni发布的版本对我有用。 我在我的代码中使用了 python3.7 功能,并且一直在切换环境真的很麻烦。

对于它的价值,我能够编译 tf 并使用当前的 master 在 OSX 上构建一个 Python3.7 轮子。

我已经提交了https://github.com/tensorflow/tensorflow/commit/b0d7d8a477d3041e2d0ebd0cb1d35e4a7fa09663这应该允许您为 3.7 构建。 tf-nightly 现在有一个仅适用于 Ubuntu16.04+ 的 CPU(仅限 Ubuntu)版本。 即将推出适用于 Ubuntu 的 GPU 版本。

@av8ramit

多亏了你,我刚刚用 python 3.7.1、cuda 10 和 cudnn 7.4 成功构建了 tf

现在只剩下 bazel 0.20 支持了

使用 CUDA 10 构建的 tf-nightly-gpu 现在也在 pypi 上。 在我们有正式的 Python3.7 发布版本之前,我将保持这个 bug 开放。

@alanpurple你能详细说明一下吗? 我无法在 Ubuntu 18 和 python 3.7 上构建 tf 1.12 来挽救我的生命

https://drive.google.com/open?id=1ni7ExGVb6-c6gvb4J0hohpT4Jj4Z4xxO
1.12 带有 SSE、XLA 的 Python 3.7 轮子。

在窗户上:
成功搭建1.12-cpu,并在py3.7中导入。
但是显卡:
ps:使用 bazel 0.21

INFO: From Linking tensorflow/contrib/tpu/python/ops/_tpu_ops.so:
   Creating library bazel-out/x64_windows-opt/bin/tensorflow/contrib/tpu/python/ops/python/ops/lib_tpu_ops.so.ifso and object bazel-out/x64_windows-opt/bin/tensorflow/contrib/tpu/python/ops/python/ops/lib_tpu_ops.so.exp
INFO: From Linking tensorflow/contrib/tensor_forest/python/ops/_stats_ops.so:
   Creating library bazel-out/x64_windows-opt/bin/tensorflow/contrib/tensor_forest/python/ops/python/ops/lib_stats_ops.so.ifso and object bazel-out/x64_windows-opt/bin/tensorflow/contrib/tensor_forest/python/ops/python/ops/lib_stats_ops.so.exp
ERROR: C:/tensorflow/tensorflow/python/keras/api/BUILD:28:1: Executing genrule //tensorflow/python/keras/api:keras_python_api_gen_compat_v1 failed (Exit 1): bash.exe failed: error executing command
  cd C:/users/USER/_bazel_USER/xv6zejqw/execroot/org_tensorflow
  SET CUDA_TOOLKIT_PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0
    SET CUDNN_INSTALL_PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0
    SET PATH=C:\msys64\usr\bin;C:\msys64\bin
    SET PYTHON_BIN_PATH=C:/Program Files/Python37/python.exe
    SET PYTHON_LIB_PATH=C:/Program Files/Python37/lib/site-packages
    SET TF_CUDA_CLANG=0
    SET TF_CUDA_COMPUTE_CAPABILITIES=3.5,7.0
    SET TF_CUDA_VERSION=10.0
    SET TF_CUDNN_VERSION=7
    SET TF_NEED_CUDA=1
    SET TF_NEED_OPENCL_SYCL=0
    SET TF_NEED_ROCM=0
  C:/msys64/usr/bin/bash.exe -c source external/bazel_tools/tools/genrule/genrule-setup.sh; bazel-out/x64_windows-opt/bin/tensorflow/python/keras/api/create_tensorflow.python_api_1_keras_python_api_gen_compat_v1.exe  --apidir=bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api_v1/ --apiname=keras --apiversion=1  --package=tensorflow.python,tensorflow.python.keras --output_package=tensorflow.python.keras.api._v1 bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/activations/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/applications/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/applications/densenet/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/applications/inception_resnet_v2/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/applications/inception_v3/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/applications/mobilenet/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/applications/mobilenet_v2/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/applications/nasnet/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/applications/resnet50/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/applications/vgg16/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/applications/vgg19/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/applications/xception/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/backend/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/callbacks/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/constraints/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/datasets/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/datasets/boston_housing/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/datasets/cifar10/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/datasets/cifar100/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/datasets/fashion_mnist/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/datasets/imdb/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/datasets/mnist/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/datasets/reuters/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/estimator/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/experimental/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/initializers/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/layers/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/losses/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/metrics/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/models/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/optimizers/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/preprocessing/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/preprocessing/image/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/preprocessing/sequence/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/preprocessing/text/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/regularizers/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/utils/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/wrappers/__init__.py bazel-out/x64_windows-opt/genfiles/tensorflow/python/keras/api/_v1/keras/wrappers/scikit_learn/__init__.py
Execution platform: @bazel_tools//platforms:host_platform
Traceback (most recent call last):
  File "\\?\C:\Users\USER\AppData\Local\Temp\Bazel.runfiles_ms8gr8rl\runfiles\org_tensorflow\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "\\?\C:\Users\USER\AppData\Local\Temp\Bazel.runfiles_ms8gr8rl\runfiles\org_tensorflow\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "\\?\C:\Users\USER\AppData\Local\Temp\Bazel.runfiles_ms8gr8rl\runfiles\org_tensorflow\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\Program Files\Python37\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Program Files\Python37\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "\\?\C:\Users\USER\AppData\Local\Temp\Bazel.runfiles_ms8gr8rl\runfiles\org_tensorflow\tensorflow\python\tools\api\generator\create_python_api.py", line 27, in <module>
    from tensorflow.python.tools.api.generator import doc_srcs
  File "\\?\C:\Users\USER\AppData\Local\Temp\Bazel.runfiles_ms8gr8rl\runfiles\org_tensorflow\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "\\?\C:\Users\USER\AppData\Local\Temp\Bazel.runfiles_ms8gr8rl\runfiles\org_tensorflow\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "\\?\C:\Users\USER\AppData\Local\Temp\Bazel.runfiles_ms8gr8rl\runfiles\org_tensorflow\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "\\?\C:\Users\USER\AppData\Local\Temp\Bazel.runfiles_ms8gr8rl\runfiles\org_tensorflow\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "\\?\C:\Users\USER\AppData\Local\Temp\Bazel.runfiles_ms8gr8rl\runfiles\org_tensorflow\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\Program Files\Python37\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Program Files\Python37\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 2602.108s, Critical Path: 565.09s
INFO: 4691 processes: 4691 local.
FAILED: Build did NOT complete successfully

让我告诉你我遇到了什么问题以及我是如何解决的。 我正在使用 Mac 操作系统

Tensorflow 与 python 3.7 不兼容,目前我认为它仅适用于 python 3.6 ..

我使用的是python 3.7,所以我从其官方网站下载了python 3.6 ..一个安装程序包并安装它。 并将 python 3.6 应用程序固定到停靠,因为一旦 python 3.7 在启动器中。 Python 3.6 不会显示.. 即使它会在应用程序选项卡上显示为辅助文件夹

现在打开终端并输入: nano .bash_profile
然后 nano 编辑器将打开取消注释 python 3.6 的路径并注释 3.7 的路径。 然后按 control+X,然后按 y 表示是,然后按 Enter

Afterdat 重启终端并输入:echo $PATH
确保第一个链接是 python 3.6

现在输入:python3 并按回车键并检查打开的版本只是为了双重确定是 python 3.6

现在输入:python3 -m pip install tensorflow
您可以以相同的方式下载其他模块。

现在,当您想使用 python 3.6 打开时。 码头上的 Python。 并且工作..如果你想在 3.7 上工作,你可以打开 python 3.7,它也可以流畅地工作

要在 python 3.7 中安装模块,. 只需输入:python3.7 -m pip install package namr

使用 CUDA 10 最近为 windows 编译了 python3.7.2,此 repo 中的链接:
https://github.com/PlatinumLyfe/tf-windows-gpu/

嗨,这个兼容性问题有什么进展吗?

bbhattmaclap:~ bbhatt$ pip3 install --upgrade tensorflow
收集张量流
找不到满足要求 tensorflow 的版本(来自版本:)
没有找到 tensorflow 的匹配分布
bbhattmaclap:~ bbhatt$

@BhuvaneshBhatt最新的 tensorflow 官方包不支持 Python3.7。 你必须使用你的 tf-nightly-gpu 包。 我们正在尝试将它用于 1.13。

@PlatinumLyfe无法安装。
您的链接只有xxx-cp36-cp36m-...
没有cp37也没有-gpu-版本。

请停止要求其他人提供已编译的二进制文件。 除了向所有对 Python 3.7 官方支持何时发布感兴趣的人发送垃圾邮件之外,在可公开评论的页面上要求某人向您发送要运行的二进制文件并不是特别安全。

Tensorflow 1.13-rc0 已经发布(https://github.com/tensorflow/tensorflow/releases/tag/v1.13.0-rc0),但是没有基于 PyPI 的 Python 3.7 构建(https://pypi.org/project /tensorflow/1.13.0rc0/#files)。 TensorFlow 1.13 会正式发布 Python 3.7 吗?

我们的目标是尝试通过 rc2 或官方提供 Windows 和 Ubuntu python 二进制文件。

有关于 Mac 支持的消息吗? 我现在被困在Mac上。
2019 年 1 月 24 日上午 6:55 -0600,Amit Patankar [email protected]写道:

我们的目标是尝试通过 rc2 或官方提供 Windows 和 Ubuntu python 二进制文件。

你收到这个是因为你被提到了。
直接回复此电子邮件,在 GitHub 上查看它,或将线程静音。

我们现在有一个用于 Mac 的tf-nightly CPU 包。 也将尝试将其用于 rc2。

对于其他来到这个线程的人来说,上面提到的 tf-nightly 包很好。 对于 CPU 版本,使用pip3 install tf-nightly安装它们。 经过测试,在 MacOS Mojave 10.14.2 上使用 Python 3.7.2

1.13.0rc1 版本包括适用于cpugpu的所有操作系统的 Python3.7 二进制文件。

我似乎无法安装它。 任何简单的故障排除步骤?
编辑:问题是在 64 位系统上使用了 32 位版本的 CPython。

@MagixInTheAir我正在关闭这个问题,因为它只是一般的 Python 3.7 支持。 如果您仍然遇到问题,请重新打开一个包含日志的新问题以及有关您的设置的更多信息。

Tensorflow 1.13.1现在支持 Python 3.7。

https://pypi.org/project/tensorflow/#files tensorflow==1.13.1 有 cp37 版本。 你的环境可能有问题。

我正在使用 3.7.2 并且我有同样的问题,1.31.1 报告的版本/标签如下:

{('cp37', 'cp37m', 'manylinux1_x86_64')}

而我的 3.7.2 支持以下内容:

[('cp37', 'cp37m', 'linux_x86_64'), ('cp37', 'abi3', 'linux_x86_64'), ('cp37', 'none', 'linux_x86_64'), ('cp36', 'abi3', 'linux_x86_64'), ('cp35', 'abi3', 'linux_x86_64'), ('cp34', 'abi3', 'linux_x86_64'), ('cp33', 'abi3', 'linux_x86_64'), ('cp32', 'abi3', 'linux_x86_64'), ('py3', 'none', 'linux_x86_64'), ('cp37', 'none', 'any'), ('cp3', 'none', 'any'), ('py37', 'none', 'any'), ('py3', 'none', 'any'), ('py36', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')]

(来自 pep425tags.get_supported())

所以我认为问题只是轮子名称中应该是linux而不是manylinux1

我从源代码构建了一个干净的python,几乎没有默认参数。

@dellelce ,您可能使用的是非常旧的 pip 版本?

import pip._internal; print(pip._internal.pep425tags.get_supported())

给了我很多linux标签。

我刚刚检查了一下,问题出在 alpine 构建上,我的构建 (dellelce/py-base) 和官方 docker alpine 映像 (python:alpine) 有问题,而在 debian (python:latest) 上构建的映像工作正常。
它必须与使用的 libc 库有关(musl vs glibc)? 所以其他不使用 glibc 的 dist 可能有问题......

都有最新的点子和 3.7.3 或 3.7.2...

我很确定 Alpine 不包含在 manylinux 支持的许多 Linux 中。

@ppwwyyxx我们应该有另一张支持非 glibc linux 发行版的票吗?

PEP 571/PEP 513(“manylinux”)仅支持 glibc。

@dellelce支持 alpine linux 可能是一个有趣的想法,但可能不是微不足道的。 目前大多数 tensorflow 二进制文件都是用 Ubuntu 14.04 编译的。 甚至一些其他常用的平台(例如 CentOS)偶尔也会遇到一些问题。 我认为高山支持在短期内不太可能成为优先事项。

打开一个问题总是一件好事,因为它可以帮助衡量社区的需求和兴趣,并且它总是可以被贴上“欢迎贡献”的标签。

此页面是否有帮助?
0 / 5 - 0 等级