iwonbigbro/gsync

Setup dependencies are not consistent

Opened this issue · 3 comments

The current setup.py in master branch provides a dependency configuration that is inconsistent, so a manual installation will fail if the user has an old version of httplib2, e.g. 0.9.2:

Here it is the complete traceback:

Collecting docopt>=0.6.0 (from -r gsync.egg-info/requires.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/a2/55/8f8cab2afd404cf578136ef2cc5dfb50baa1761b68c9da1fb1e4eed343c9/docopt-0.6.2.tar.gz
Collecting google-api-python-client>=1.2 (from -r gsync.egg-info/requires.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/50/94/e30a5118dbb178d8ea4bde737e7722209b7018349a2fbdadadc159ba931c/google-api-python-client-1.8.0.tar.gz (145kB)
    100% |████████████████████████████████| 153kB 3.2MB/s 
Requirement already satisfied: httplib2>=0.8 in /usr/lib/python2.7/dist-packages (from -r gsync.egg-info/requires.txt (line 3)) (0.9.1)
Collecting oauth2client>=1.1 (from -r gsync.egg-info/requires.txt (line 4))
  Downloading https://files.pythonhosted.org/packages/95/a9/4f25a14d23f0786b64875b91784607c2277eff25d48f915e39ff0cff505a/oauth2client-4.1.3-py2.py3-none-any.whl (98kB)
    100% |████████████████████████████████| 102kB 5.6MB/s 
Requirement already satisfied: python-dateutil>=1.5 in /usr/lib/python2.7/dist-packages (from -r gsync.egg-info/requires.txt (line 5)) (2.4.2)
Collecting python-gflags>=2.0 (from -r gsync.egg-info/requires.txt (line 6))
  Downloading https://files.pythonhosted.org/packages/df/ec/e31302d355bcb9d207d9b858adc1ecc4a6d8c855730c8ba4ddbdd3f8eb8d/python-gflags-3.1.2.tar.gz (52kB)
    100% |████████████████████████████████| 61kB 12.4MB/s 
Collecting python-magic>=0.4.6 (from -r gsync.egg-info/requires.txt (line 7))
  Downloading https://files.pythonhosted.org/packages/42/a1/76d30c79992e3750dac6790ce16f056f870d368ba142f83f75f694d93001/python_magic-0.4.15-py2.py3-none-any.whl
Collecting retrying>=1.1.0 (from -r gsync.egg-info/requires.txt (line 8))
  Downloading https://files.pythonhosted.org/packages/44/ef/beae4b4ef80902f22e3af073397f079c96969c69b2c7d52a57ea9ae61c9d/retrying-1.3.3.tar.gz
Collecting urllib3>=1.5 (from -r gsync.egg-info/requires.txt (line 9))
  Downloading https://files.pythonhosted.org/packages/e8/74/6e4f91745020f967d09332bb2b8b9b10090957334692eb88ea4afe91b77f/urllib3-1.25.8-py2.py3-none-any.whl (125kB)
    100% |████████████████████████████████| 133kB 5.6MB/s 
Collecting google-api-core<2dev,>=1.13.0 (from google-api-python-client>=1.2->-r gsync.egg-info/requires.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/63/7e/a523169b0cc9ce62d56e07571db927286a94b1a5f51ac220bd97db825c77/google_api_core-1.16.0-py2.py3-none-any.whl (70kB)
    100% |████████████████████████████████| 71kB 5.3MB/s 
Collecting google-auth-httplib2>=0.0.3 (from google-api-python-client>=1.2->-r gsync.egg-info/requires.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/33/49/c814d6d438b823441552198f096fcd0377fd6c88714dbed34f1d3c8c4389/google_auth_httplib2-0.0.3-py2.py3-none-any.whl
Collecting google-auth>=1.4.1 (from google-api-python-client>=1.2->-r gsync.egg-info/requires.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/f7/f8/2da482a6165ef3f28d52faf8c2ca31628129a84a294033eb399ef500e265/google_auth-1.11.3-py2.py3-none-any.whl (76kB)
    100% |████████████████████████████████| 81kB 8.5MB/s 
Requirement already satisfied: six<2dev,>=1.6.1 in /usr/lib/python2.7/dist-packages (from google-api-python-client>=1.2->-r gsync.egg-info/requires.txt (line 2)) (1.11.0)
Collecting uritemplate<4dev,>=3.0.0 (from google-api-python-client>=1.2->-r gsync.egg-info/requires.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/bf/0c/60d82c077998feb631608dca3cc1fe19ac074e772bf0c24cf409b977b815/uritemplate-3.0.1-py2.py3-none-any.whl
Collecting pyasn1>=0.1.7 (from oauth2client>=1.1->-r gsync.egg-info/requires.txt (line 4))
  Downloading https://files.pythonhosted.org/packages/62/1e/a94a8d635fa3ce4cfc7f506003548d0a2447ae76fd5ca53932970fe3053f/pyasn1-0.4.8-py2.py3-none-any.whl (77kB)
    100% |████████████████████████████████| 81kB 7.4MB/s 
Collecting pyasn1-modules>=0.0.5 (from oauth2client>=1.1->-r gsync.egg-info/requires.txt (line 4))
  Downloading https://files.pythonhosted.org/packages/95/de/214830a981892a3e286c3794f41ae67a4495df1108c3da8a9f62159b9a9d/pyasn1_modules-0.2.8-py2.py3-none-any.whl (155kB)
    100% |████████████████████████████████| 163kB 4.7MB/s 
Collecting rsa>=3.1.4 (from oauth2client>=1.1->-r gsync.egg-info/requires.txt (line 4))
  Downloading https://files.pythonhosted.org/packages/02/e5/38518af393f7c214357079ce67a317307936896e961e35450b70fad2a9cf/rsa-4.0-py2.py3-none-any.whl
Collecting googleapis-common-protos<2.0dev,>=1.6.0 (from google-api-core<2dev,>=1.13.0->google-api-python-client>=1.2->-r gsync.egg-info/requires.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/05/46/168fd780f594a4d61122f7f3dc0561686084319ad73b4febbf02ae8b32cf/googleapis-common-protos-1.51.0.tar.gz
Collecting protobuf>=3.4.0 (from google-api-core<2dev,>=1.13.0->google-api-python-client>=1.2->-r gsync.egg-info/requires.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/f5/cc/9180fa1f97ad122d92cfbff413bcd0be4bd3efee284a5fb6344670220709/protobuf-3.11.3-cp27-cp27mu-manylinux1_x86_64.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 3.5MB/s 
Collecting setuptools>=34.0.0 (from google-api-core<2dev,>=1.13.0->google-api-python-client>=1.2->-r gsync.egg-info/requires.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/f9/d3/955738b20d3832dfa3cd3d9b07e29a8162edb480bf988332f5e6e48ca444/setuptools-44.0.0-py2.py3-none-any.whl (583kB)
    100% |████████████████████████████████| 583kB 5.2MB/s 
Requirement already satisfied: pytz in /usr/lib/python2.7/dist-packages (from google-api-core<2dev,>=1.13.0->google-api-python-client>=1.2->-r gsync.egg-info/requires.txt (line 2)) (2014.10)
Collecting futures>=3.2.0; python_version < "3.2" (from google-api-core<2dev,>=1.13.0->google-api-python-client>=1.2->-r gsync.egg-info/requires.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/d8/a6/f46ae3f1da0cd4361c344888f59ec2f5785e69c872e175a748ef6071cdb5/futures-3.3.0-py2-none-any.whl
Collecting requests<3.0.0dev,>=2.18.0 (from google-api-core<2dev,>=1.13.0->google-api-python-client>=1.2->-r gsync.egg-info/requires.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/1a/70/1935c770cb3be6e3a8b78ced23d7e0f3b187f5cbfab4749523ed65d7c9b1/requests-2.23.0-py2.py3-none-any.whl (58kB)
    100% |████████████████████████████████| 61kB 5.0MB/s 
Collecting cachetools<5.0,>=2.0.0 (from google-auth>=1.4.1->google-api-python-client>=1.2->-r gsync.egg-info/requires.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/2f/a6/30b0a0bef12283e83e58c1d6e7b5aabc7acfc4110df81a4471655d33e704/cachetools-3.1.1-py2.py3-none-any.whl
Requirement already satisfied: chardet<4,>=3.0.2 in /usr/lib/python2.7/dist-packages (from requests<3.0.0dev,>=2.18.0->google-api-core<2dev,>=1.13.0->google-api-python-client>=1.2->-r gsync.egg-info/requires.txt (line 2)) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in /usr/lib/python2.7/dist-packages (from requests<3.0.0dev,>=2.18.0->google-api-core<2dev,>=1.13.0->google-api-python-client>=1.2->-r gsync.egg-info/requires.txt (line 2)) (2.5)
Collecting certifi>=2017.4.17 (from requests<3.0.0dev,>=2.18.0->google-api-core<2dev,>=1.13.0->google-api-python-client>=1.2->-r gsync.egg-info/requires.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/b9/63/df50cac98ea0d5b006c55a399c3bf1db9da7b5a24de7890bc9cfd5dd9e99/certifi-2019.11.28-py2.py3-none-any.whl (156kB)
    100% |████████████████████████████████| 163kB 4.3MB/s 
cheetah 2.4.4 requires Markdown>=2.0.1, which is not installed.
google-api-python-client 1.8.0 has requirement httplib2<1dev,>=0.9.2, but you'll have httplib2 0.9.1 which is incompatible.
Installing collected packages: docopt, setuptools, protobuf, googleapis-common-protos, pyasn1, rsa, cachetools, pyasn1-modules, google-auth, futures, urllib3, certifi, requests, google-api-core, google-auth-httplib2, uritemplate, google-api-python-client, oauth2client, python-gflags, python-magic, retrying
  Running setup.py install for docopt ... done
  Found existing installation: setuptools 33.1.1
    Uninstalling setuptools-33.1.1:
      Successfully uninstalled setuptools-33.1.1
  Running setup.py install for googleapis-common-protos ... done
  Running setup.py install for google-api-python-client ... done
  Running setup.py install for python-gflags ... done
  Running setup.py install for retrying ... done
Successfully installed cachetools-3.1.1 certifi-2019.11.28 docopt-0.6.2 futures-3.3.0 google-api-core-1.16.0 google-api-python-client-1.8.0 google-auth-1.11.3 google-auth-httplib2-0.0.3 googleapis-common-protos-1.51.0 oauth2client-4.1.3 protobuf-3.11.3 pyasn1-0.4.8 pyasn1-modules-0.2.8 python-gflags-3.1.2 python-magic-0.4.15 requests-2.23.0 retrying-1.3.3 rsa-4.0 setuptools-44.0.0 uritemplate-3.0.1 urllib3-1.25.8

from which this is the relevant part:

google-api-python-client 1.8.0 has requirement httplib2<1dev,>=0.9.2, but you'll have httplib2 0.9.1 which is incompatible.

It can be bypassed by forcing google-api-python-client to be lower than 1.5.0, replacing

    'google-api-python-client >= 1.2',

with

    'google-api-python-client >= 1.2, < 1.5.0',

in the setup.py file. After doing this, although the dependencies are installed correctly, I get the following error when executing gsync:

vic@thinkpad:/home/vic/github/gsync$ gsync
Traceback (most recent call last):
  File "/home/vic/github/gsync/bin/gsync", line 17, in <module>
    from libgsync.crawler import Crawler
  File "/home/vic/github/gsync/libgsync/crawler.py", line 12, in <module>
    from libgsync.sync import Sync
  File "/home/vic/github/gsync/libgsync/sync/__init__.py", line 11, in <module>
    from libgsync.drive.mimetypes import MimeTypes
  File "/home/vic/github/gsync/libgsync/drive/__init__.py", line 24, in <module>
    import oauth2client.util
ImportError: No module named util

because the default version installed for oauth2client is 4.1.3, and the subpackage util does not exist since version 4.0.0. So, similarly, in the setup.py I needed to replace:

    'oauth2client >= 1.1',

with

    'oauth2client >= 1.1, < 4.0.0',

By the way, when fixing this dependency inconsistency I could realise that it is necessary to set the maximum version of httplib2 to 0.15.0, otherwise the uploads fail with an error that is hidden by the try-except clause located at Line 880 in libgsync/drive/__init__.py. If I comment this try-except clause, the error raised is the following:

Error: RedirectMissingLocation('Redirected but the response is missing a Location: header.',)

which after some research it sent me to a discussion in StackOverflow in which it is explained with detail why google-api-python-client is incompatible with httplib2>=0.16.0.

I forked the repo to apply the fixes, just in case somebody needs them too. The patches for the dependencies versions are 5f7f3f02, dbe0976f and dfc67c9f.