0

swiftclient ライブラリを使用してコンテナー内のファイルを作成および削除できる Python コードを bluemix で作成しています。ただし、次のコードでは例外が発生します。Apache Spark で Notebook を使用していることに注意してください。開発が完了したら、これをアプリ コードとしてアップロードできます。例外は最後に表示されます。

Exception                                 Traceback (most recent call last)
<ipython-input-6-c6375c8f3026> in <module>()
     13   'tenantId':'sdb2-2605e7ecec4bce-07c8d52a704f'
     14 }
---> 15 import swiftclient.client
     16 from keystoneclient import client
     17 

/gpfs/fs01/user/sdb2-2605e7ecec4bce-07c8d52a704f/.local/lib/python2.7/site-packages/swiftclient/__init__.py in <module>()
     18 OpenStack Swift Python client binding.
     19 """
---> 20 from .client import *  # noqa
     21 
     22 # At setup.py time, we haven't installed anything yet, so there

/gpfs/fs01/user/sdb2-2605e7ecec4bce-07c8d52a704f/.local/lib/python2.7/site-packages/swiftclient/client.py in <module>()
     30 import six
     31 
---> 32 from swiftclient import version as swiftclient_version
     33 from swiftclient.exceptions import ClientException
     34 from swiftclient.utils import (

/gpfs/fs01/user/sdb2-2605e7ecec4bce-07c8d52a704f/.local/lib/python2.7/site-packages/swiftclient/version.py in <module>()
     26     # its thing to figure out a version number.
     27     import pbr.version
---> 28     version_string = str(pbr.version.VersionInfo('python-swiftclient'))

/usr/local/src/bluemix_ipythonspark_16/notebook/lib/python2.7/site-packages/pbr-0.11.0-py2.7.egg/pbr/version.pyc in __str__(self)
    414     def __str__(self):
    415         """Make the VersionInfo object behave like a string."""
--> 416         return self.version_string()
    417 
    418     def __repr__(self):

/usr/local/src/bluemix_ipythonspark_16/notebook/lib/python2.7/site-packages/pbr-0.11.0-py2.7.egg/pbr/version.pyc in version_string(self)
    455     def version_string(self):
    456         """Return the short version minus any alpha/beta tags."""
--> 457         return self.semantic_version().brief_string()
    458 
    459     # Compatibility functions

/usr/local/src/bluemix_ipythonspark_16/notebook/lib/python2.7/site-packages/pbr-0.11.0-py2.7.egg/pbr/version.pyc in semantic_version(self)
    450         """Return the SemanticVersion object for this version."""
    451         if self._semantic is None:
--> 452             self._semantic = self._get_version_from_pkg_resources()
    453         return self._semantic
    454 

/usr/local/src/bluemix_ipythonspark_16/notebook/lib/python2.7/site-packages/pbr-0.11.0-py2.7.egg/pbr/version.pyc in _get_version_from_pkg_resources(self)
    437             # installed into anything. Revert to setup-time logic.
    438             from pbr import packaging
--> 439             result_string = packaging.get_version(self.package)
    440         return SemanticVersion.from_pip_string(result_string)
    441 

/usr/local/src/bluemix_ipythonspark_16/notebook/lib/python2.7/site-packages/pbr-0.11.0-py2.7.egg/pbr/packaging.pyc in get_version(package_name, pre_version)
    658     if version:
    659         return version
--> 660     raise Exception("Versioning for this project requires either an sdist"
    661                     " tarball, or access to an upstream git repository."
    662                     " Are you sure that git is installed?")

***Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. Are you sure that git is installed?***
4

1 に答える 1

0

おそらく次のような環境で「bluemix_ipythonspark_16」スパーク サービス インスタンスを使用しているようです。

Language
Python 2.7
Notebook (Jupyter)
IPython 3.2.1
Spark as a Service
Apache Spark 1.6

この環境で問題を再現できますが、IPython 環境に関連している可能性があると思います。 これは、IPython を使用していた古い Spark サービス インスタンスの問題のようです。

bluemix で作成する新しい Spark サービスには、Jupyter 環境が含まれます。

Language
Python 2.7
Notebook (Jupyter)
Jupyter 4.0.6
Spark as a Service
Apache Spark 1.6

これをテストしましたが、この新しい環境では問題は発生しません。可能であれば試してみてください

https://github.com/charles2588/bluemixsparknotebooks/raw/master/Python/SO_swiftclient_version.ipynb

古い環境での回避策が見つかった場合は、ここで更新します。

ありがとう、チャールズ。

于 2016-06-07T19:05:44.757 に答える