Gsutil: Running gsutil fails after updating via pip

Created on 22 Sep 2017  路  5Comments  路  Source: GoogleCloudPlatform/gsutil

Yesterday I've update gsutil and since then it fails from the command line with the following stack trace:

$ gsutil
Traceback (most recent call last):
  File "/usr/local/bin/gsutil", line 11, in <module>
    load_entry_point('gsutil==4.27', 'console_scripts', 'gsutil')()
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 570, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2751, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2405, in load
    return self.resolve()
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2411, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/site-packages/gslib/__main__.py", line 51, in <module>
    from gslib import metrics
  File "/usr/local/lib/python2.7/site-packages/gslib/metrics.py", line 39, in <module>
    from gslib.util import CalculateThroughput
  File "/usr/local/lib/python2.7/site-packages/gslib/util.py", line 39, in <module>
    from apitools.base.py import http_wrapper
  File "/usr/local/lib/python2.7/site-packages/apitools/base/py/__init__.py", line 20, in <module>
    from apitools.base.py.base_api import *
  File "/usr/local/lib/python2.7/site-packages/apitools/base/py/base_api.py", line 31, in <module>
    from apitools.base.protorpclite import message_types
  File "/usr/local/lib/python2.7/site-packages/apitools/base/protorpclite/message_types.py", line 25, in <module>
    from apitools.base.protorpclite import messages
  File "/usr/local/lib/python2.7/site-packages/apitools/base/protorpclite/messages.py", line 1168, 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

This is installed on FreeBSD 11.1 via pip. It was upgrade via pip install --upgrade gsutil.

The same setup has worked just fine for many years now. (, wel not on FreeBSD 11.1 since that isn't out for years, but on the same install)

It's probably one of the dependencies giving a problem, I think.

It's almost weekend so no rush of course. :smile:

Most helpful comment

BTW 'google-apitools==0.5.15' has a fix for this... but gsutil is pinned to version 0.5.3.
Alternatively you need to pin six package.

All 5 comments

BTW 'google-apitools==0.5.15' has a fix for this... but gsutil is pinned to version 0.5.3.
Alternatively you need to pin six package.

Thanks! I pinnend six to the previous version as a temporary fix.

Released v4.28 today, which pins to v0.5.16 of apitools. Marking as fixed.

Thanks!

For anyone else with the issue, pip install six==1.10.0 is the version of six. I needed to use pip2, for Python2.7 but that's dependant on your own Python. pip or pip3 might work too.

Was this page helpful?
0 / 5 - 0 ratings