installing google-cloud using pip fails

2019-07-26 20:31发布

问题:

Im trying to install the google-cloud python package, and I encounter the foloowing meesage whenn the installation fails:

 pip install --upgrade google-cloud
    Collecting google-cloud
      Using cached google_cloud-0.23.0-py2.py3-none-any.whl
    Collecting google-cloud-dns<0.24dev,>=0.23.0 (from google-cloud)
      Using cached google_cloud_dns-0.23.0-py2.py3-none-any.whl
    Collecting google-cloud-monitoring<0.24dev,>=0.23.0 (from google-cloud)
      Using cached google_cloud_monitoring-0.23.0-py2.py3-none-any.whl
    Collecting google-cloud-error-reporting<0.24dev,>=0.23.0 (from google-cloud)
      Using cached google_cloud_error_reporting-0.23.2-py2.py3-none-any.whl
    Collecting google-cloud-bigquery<0.24dev,>=0.23.0 (from google-cloud)
      Using cached google_cloud_bigquery-0.23.0-py2.py3-none-any.whl
    Collecting google-cloud-bigtable<0.24dev,>=0.23.0 (from google-cloud)
      Using cached google_cloud_bigtable-0.23.1-py2.py3-none-any.whl
    Collecting google-cloud-runtimeconfig<0.24dev,>=0.23.0 (from google-cloud)
      Using cached google_cloud_runtimeconfig-0.23.0-py2.py3-none-any.whl
    Collecting google-cloud-pubsub<0.24dev,>=0.23.0 (from google-cloud)
      Using cached google_cloud_pubsub-0.23.0-py2.py3-none-any.whl
    Collecting google-cloud-datastore<0.24dev,>=0.23.0 (from google-cloud)
      Using cached google_cloud_datastore-0.23.0-py2.py3-none-any.whl
    Collecting google-cloud-core<0.24dev,>=0.23.1 (from google-cloud)
      Using cached google_cloud_core-0.23.1-py2.py3-none-any.whl
    Collecting google-cloud-resource-manager<0.24dev,>=0.23.0 (from google-cloud)
      Using cached google_cloud_resource_manager-0.23.0-py2.py3-none-any.whl
    Collecting google-cloud-vision<0.24dev,>=0.23.0 (from google-cloud)
      Using cached google_cloud_vision-0.23.3-py2.py3-none-any.whl
    Collecting google-cloud-translate<0.24dev,>=0.23.0 (from google-cloud)
      Using cached google_cloud_translate-0.23.0-py2.py3-none-any.whl
    Collecting google-cloud-logging<0.24dev,>=0.23.0 (from google-cloud)
      Using cached google_cloud_logging-0.23.1-py2.py3-none-any.whl
    Collecting google-cloud-language<0.24dev,>=0.23.0 (from google-cloud)
      Using cached google_cloud_language-0.23.1-py2.py3-none-any.whl
    Collecting google-cloud-speech<0.24dev,>=0.23.0 (from google-cloud)
      Using cached google_cloud_speech-0.23.0-py2.py3-none-any.whl
    Collecting google-cloud-spanner<0.24dev,>=0.23.1 (from google-cloud)
      Using cached google_cloud_spanner-0.23.1-py2.py3-none-any.whl
    Collecting google-cloud-storage<0.24dev,>=0.23.0 (from google-cloud)
      Using cached google_cloud_storage-0.23.1-py2.py3-none-any.whl
    Collecting gapic-google-cloud-error-reporting-v1beta1<0.16dev,>=0.15.0 (from google-cloud-error-reporting<0.24dev,>=0.23.0->google-cloud)
      Using cached gapic-google-cloud-error-reporting-v1beta1-0.15.3.tar.gz
        Complete output from command python setup.py egg_info:
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "<frozen importlib._bootstrap>", line 969, in _find_and_load
          File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
          File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
          File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
          File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\setuptools\__init__.py", line 11, in <module>
          File "<frozen importlib._bootstrap>", line 969, in _find_and_load
          File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
          File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
          File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
          File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\setuptools\extern\__init__.py", line 1, in <module>
          File "<frozen importlib._bootstrap>", line 969, in _find_and_load
          File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
          File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
          File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
          File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2927, in <module>
          File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2913, in _call_aside
          File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2952, in _initialize_master_working_set
          File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 956, in subscribe
          File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2952, in <lambda>
          File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2515, in activate
          File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2097, in declare_namespace
          File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2047, in _handle_ns
          File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2066, in _rebuild_mod_path
        AttributeError: '_NamespacePath' object has no attribute 'sort'

        ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in C:\Users\OFIRAR~1\AppData\Local\Temp\pip-build-j5a_32a2\gapic-google-cloud-error-reporting-v1beta1\

what could cause this? I installed other packages without problems.

回答1:

Since I cannot comment, I will answer it here.

I had this issue once. I fixed it by doing the following:

pip install --upgrade pip pip install --upgrade setuptools

Some discussions relate this to an issue with Python 3*, and others with the version of pip.

If upgrading pip and setuptools does not work for you, try using Python 2.7*.

I have tested on my machine using Python 2.7.13 with pip v9.0.1.

Though this is a known issue, it has been discussed here and here



标签: python pip