导入 apache_beam 元类冲突 [英] import apache_beam metaclass conflict

查看:34
本文介绍了导入 apache_beam 元类冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试导入 apache beam 时,出现以下错误.

<预><代码>>>>导入 apache_beam回溯(最近一次调用最后一次):文件<stdin>",第 1 行,在 <module> 中文件/home/toor/pfff/local/lib/python2.7/site-packages/apache_beam/__init__.py",第78行,在<module>从 apache_beam 导入 io文件/home/toor/pfff/local/lib/python2.7/site-packages/apache_beam/io/__init__.py",第21行,在<module>...从 apitools.base.protorpclite 导入消息文件/home/toor/pfff/local/lib/python2.7/site-packages/apitools/base/protorpclite/messages.py",第1165行,在<module>类字段(六.with_metaclass(_FieldMeta,对象)):TypeError:调用元类基类时出错元类冲突:派生类的元类必须是其所有基类元类的(非严格)子类

我正在一个新的虚拟环境中工作,我通过使用 pip 安装 google-cloud-dataflow 来安装 apache_beam,因为我需要能够在 google 云平台上运行的版本.

pip install google-cloud-dataflow

我不知道如何解决这个错误.为了完整起见,我在 Windows 上的 ubuntu bash 上使用 python 2.7.12.我的同事在 Windows 上的 ubuntu 上的 bash 上运行它时遇到了同样的错误,而直接在 Windows 上运行它工作正常.

已安装的软件包版本为:

<预><代码>>>>点冻结阿帕奇光束==2.1.0avro==1.8.2缓存工具==2.0.1证书==2017.7.27.1chardet==3.0.4crcmod==1.7莳萝==0.2.6enum34==1.1.6funcsigs==1.0.2未来==0.16.0期货==3.1.1gapic-google-cloud-pubsub-v1==0.15.4谷歌apitools==0.5.11谷歌认证==1.1.0google-auth-httplib2==0.0.2谷歌云bigquery == 0.25.0谷歌云核心==0.25.0谷歌云数据流==2.1.0谷歌云发布订阅==0.26.0谷歌-gax==0.15.15googleapis-common-protos==1.5.2谷歌数据存储==7.0.1grpc-google-iam-v1==0.11.3grpcio==1.6.0httplib2==0.9.2idna==2.6模拟==2.0.0oauth2client==3.0.0pbr==3.1.1pkg-resources==0.0.0厚度==3.8proto-google-cloud-datastore-v1==0.90.4proto-google-cloud-pubsub-v1==0.15.4protobuf==3.3.0pyasn1==0.3.5pyasn1-modules==0.1.4PyYAML==3.12请求==2.18.4rsa==3.4.2六==1.11.0urllib3==1.22

解决方案

降级 6 至 1.10.0 版

pip install 6==1.10.0

When I try to import apache beam I get the following error.

>>> import apache_beam
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/toor/pfff/local/lib/python2.7/site-packages/apache_beam/__init__.py", line 78, in <module>
    from apache_beam import io
  File "/home/toor/pfff/local/lib/python2.7/site-packages/apache_beam/io/__init__.py", line 21, in <module>
    ...
    from apitools.base.protorpclite import messages
  File "/home/toor/pfff/local/lib/python2.7/site-packages/apitools/base/protorpclite/messages.py", line 1165, in <module>
    class Field(six.with_metaclass(_FieldMeta, object)):
TypeError: Error when calling the metaclass bases
    metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

I'm working in a new virtual environment in which I have installed apache_beam by installing google-cloud-dataflow with pip as I need the version that is able to run on google cloud platform.

pip install google-cloud-dataflow

I have no idea how to solve this error. For completeness, I'm using python 2.7.12 on bash on ubuntu on Windows. My colleague had the same error when running it on bash on ubuntu on Windows, while directly running on Windows is working fine.

The installed versions of the packages are:

>>> pip freeze
apache-beam==2.1.0
avro==1.8.2
cachetools==2.0.1
certifi==2017.7.27.1
chardet==3.0.4
crcmod==1.7
dill==0.2.6
enum34==1.1.6
funcsigs==1.0.2
future==0.16.0
futures==3.1.1
gapic-google-cloud-pubsub-v1==0.15.4
google-apitools==0.5.11
google-auth==1.1.0
google-auth-httplib2==0.0.2
google-cloud-bigquery==0.25.0
google-cloud-core==0.25.0
google-cloud-dataflow==2.1.0
google-cloud-pubsub==0.26.0
google-gax==0.15.15
googleapis-common-protos==1.5.2
googledatastore==7.0.1
grpc-google-iam-v1==0.11.3
grpcio==1.6.0
httplib2==0.9.2
idna==2.6
mock==2.0.0
oauth2client==3.0.0
pbr==3.1.1
pkg-resources==0.0.0
ply==3.8
proto-google-cloud-datastore-v1==0.90.4
proto-google-cloud-pubsub-v1==0.15.4
protobuf==3.3.0
pyasn1==0.3.5
pyasn1-modules==0.1.4
PyYAML==3.12
requests==2.18.4
rsa==3.4.2
six==1.11.0
urllib3==1.22

解决方案

Downgrade six to version 1.10.0

pip install six==1.10.0

这篇关于导入 apache_beam 元类冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆