导入apache_beam元类冲突

时间:2017-09-19 12:12:56

标签: python-2.7 google-cloud-dataflow apache-beam

当我尝试导入apache beam时,我收到以下错误。

>>> 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

我正在一个新的虚拟环境中工作,我已经通过安装带有pip的google-cloud-dataflow安装了apache_beam,因为我需要能够在google云平台上运行的版本。

pip install google-cloud-dataflow

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

软件包的已安装版本为:

>>> 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

1 个答案:

答案 0 :(得分:20)

将六个版本降级为版本1.10.0

pip install six==1.10.0