iwonbigbro / gsync

RSync for Google Drive - GSync
Other
238 stars 50 forks source link

Attempted install on a 'Python Fresh' machine #14

Closed odoncaoa closed 10 years ago

odoncaoa commented 10 years ago

Upon successful installation of gsync via the prescribed commands: sudo apt-get install python-stdeb sudo pypi-install gsync

Attempting to get more info about the command attribs, yielded:

odoncaoa@killincoole$ gsync --help Traceback (most recent call last): File "/usr/bin/gsync", line 7, in from docopt import docopt ImportError: No module named docopt

Trying to narrow down the problem, line 7 of gsync was commented out:

from docopt import docopt

Which then provided specific info regarding the missing element: odoncaoa@killincoole$ gsync --help Traceback (most recent call last): File "/usr/bin/gsync", line 131, in args = docopt(doc, version = version, options_first = True) NameError: name 'docopt' is not defined

Then, attempted to install 'docopt', but found that it lives elsewhere:

odoncaoa@killincoole$ sudo apt-get install docopt Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package docopt

Found docopt at: https://pypi.python.org/pypi/docopt/0.1 https://github.com/halst/docopt

And, downloaded and installed: /usr/share/pyshared odoncaoa@killincoole$ ll | grep doc lrwxrwxrwx 1 root root 10 Sep 27 20:14 docopt -> docopt-0.1/ drwxr-xr-x 3 root root 4096 Apr 10 2012 docopt-0.1/

However, unless one finds the install instructions, at 'https://github.com/docopt/docopt', the problem persists: sudo pip install docopt==0.6.1

Once finally installed, then: odoncaoa@killincoole$ ll /usr/local/lib/python2.7/dist-packages/docopt* -rw-r--r-- 1 root staff 19946 Sep 27 20:43 /usr/local/lib/python2.7/dist-packages/docopt.py -rw-r--r-- 1 root staff 24197 Sep 27 20:43 /usr/local/lib/python2.7/dist-packages/docopt.pyc

/usr/local/lib/python2.7/dist-packages/docopt-0.6.1-py2.7.egg-info: total 48 drwxr-sr-x 2 root staff 4096 Sep 27 20:43 ./ drwxrwsr-x 9 root staff 4096 Sep 27 20:43 ../ -rw-r--r-- 1 root staff 1 Sep 27 20:43 dependency_links.txt -rw-r--r-- 1 root staff 86 Sep 27 20:43 installed-files.txt -rw-r--r-- 1 root staff 21462 Sep 27 20:43 PKG-INFO -rw-r--r-- 1 root staff 651 Sep 27 20:43 SOURCES.txt -rw-r--r-- 1 root staff 7 Sep 27 20:43 top_level.txt

Until, finally: odoncaoa@killincoole$ gsync --help gsync version 0.1.0

Copyright (C) 2013 Craig Phillips. All rights reserved. ... -h, --help show this help

See https://github.com/iwonbigbro/gsync for updates, bug reports and answers

Thus, it would appear that some extra checking needs to be done in the installation procedures in order to insure that 'docopt' also gets installed; if it was not already present before.

Craig, you should be aware (if you weren't already) that '-h' has 2 assignments, as well:

-h, --help show this help -h, --human-readable output numbers in a human-readable format

Slainte,

Douglas Donahue

odoncaoa commented 10 years ago

So, a viably compete install command set is as follows:

sudo apt-get install python-stdeb sudo apt-get install python-pip sudo pip install docopt==0.6.1 sudo pypi-install gsync

Slainte Douglas

scphantm commented 10 years ago

Im doing the same on a fresh Mint install. In addition to the packages already mentioned, I had to install these manually as well:

sudo pypi-install oauth2 sudo pypi-install oauth2client sudo pypi-install python-gflags

and im still getting this error

willie@willie-laptop ~ $ gsync -vrn Calibre\ Library/ drive:///Calibre\ Library Traceback (most recent call last): File "/usr/bin/gsync", line 146, in from libgsync.crawler import Crawler File "/usr/lib/python2.7/dist-packages/libgsync/crawler.py", line 4, in from libgsync.sync import Sync File "/usr/lib/python2.7/dist-packages/libgsync/sync/init.py", line 5, in from libgsync.drive.mimetypes import MimeTypes File "/usr/lib/python2.7/dist-packages/libgsync/drive/init.py", line 19, in gflags.FLAGS['positional_parameters_enforcement'].value = 'IGNORE' File "/usr/lib/python2.7/dist-packages/gflags.py", line 1053, in getitem return self.FlagDict()[name] KeyError: 'positional_parameters_enforcement'

feyrune commented 10 years ago

I get the same error trying to install on Rasberian Wheezy on Raspberry Pi

iwonbigbro commented 10 years ago

Hi, thanks for the info. The positional_parameters... issue has been fixed in 0.1.1, but I haven't repackaged for pypi yet. I am having dependency issues with pypi on some systems, which is why docopt is not installed or an adequate version is not installed. I'll look into these and get a new 0.1.1 package uploaded to pypi.

One issue I'm having in particular, is that client.json is not in the same place on all systems and is hard to locate when used within a python chroot.

iwonbigbro commented 10 years ago

I have made a fix I hope will work (adding version specification for docopt in the setup.py file). I may need to implement a setup.py script that uses setuptools instead of distutils if the packages are still not auto installed.

iwonbigbro commented 10 years ago

There is now a 0.1.1 version available on pypi.

scphantm commented 10 years ago

That got me past the issue above, but then now i get

Error: No module named http

it looks like this install isn't even attempting to install dependencies. Ill give it a shot with easyinstall and see if i fare any better.

scphantm commented 10 years ago

I cloned the repo and tried the easy install and i got the same result. Its like dependencies are being ignored completely.

I ran these two based on the setup.py

sudo pypi-install httplib2 sudo pypi-install urllib3

They installed, but still can't find the http module

iwonbigbro commented 10 years ago

I have been reading up on setuptools and distutils, both modules used for running setup() within the setup.py scripts. It seems that setuptools provides the functionality for automatic resolution of dependencies, while the other (distutils) doesn't. Currently, setup.py is configured using distutils, which is shipped with python. setuptools is only available via pypi. So there is a catch 22. To get automatic resolution of dependencies, the system needs to already have setuptools installed, or the setup.py will fail to run. To install without requiring setuptools present results in other modules not being automatically installed.

From further reading, it does seem that there are hacks people have included in their setup.py scripts to download and install setuptools before dynamically importing it once it is installed. I'll look into this in more detail when I get closer to a 1.0 release.

I have however, found that using easy_install instead of pypi-install seems to work reliably. Funnily enough, easy_install is provided by setuptools, so actually performs the dependency resolution. I have updated the documentation installation instructions:

$ sudo apt-get install python-setuptools
$ sudo easy_install --verbose gsync

Hope this helps!

scphantm commented 10 years ago

Anyone using python for more than a day has setup tools installed so I don't think you have much to worry about going that direction. IMHO, the gain in dependency resolution is well worth the switch

iwonbigbro commented 10 years ago

I will definitely look into it asap. Need to understand how it works first. There are some subtle differences in the parameters passed to setup().

iwonbigbro commented 10 years ago

I found an alternative installation approach. Any change this works for you (this being Debian specific):

Get easy_install....

$ sudo apt-get install python-setuptools

Use easy_install to install pip...

$ sudo easy_install --verbose pip

Use pip to install gsync...

$ sudo pip install gsync

Hopefully that works?

scphantm commented 10 years ago

good progress, but not quite yet..

willie@willie-laptop ~ $ gsync -vrn Calibre\ Library/ drive:///Calibre\ Library Authorization is required to access your Google Drive. Navigate to the following URL: [big honkin url to google] Type in the received code: [my code] Error: No module named discovery willie@willie-laptop ~ $ sudo pip install discovery Downloading/unpacking discovery Could not find any downloads that satisfy the requirement discovery Cleaning up... No distributions at all found for discovery Storing complete log in /home/willie/.pip/pip.log willie@willie-laptop ~ $ sudo pip install apiclient Requirement already satisfied (use --upgrade to upgrade): apiclient in /usr/lib/python2.7/dist-packages Cleaning up... willie@willie-laptop ~ $ sudo pip install apiclient --upgrade Requirement already up-to-date: apiclient in /usr/lib/python2.7/dist-packages Cleaning up... willie@willie-laptop ~ $ sudo pip install apiclient.discovery --upgrade Downloading/unpacking apiclient.discovery Could not find any downloads that satisfy the requirement apiclient.discovery Cleaning up... No distributions at all found for apiclient.discovery Storing complete log in /home/willie/.pip/pip.log

iwonbigbro commented 10 years ago

Ah, I think this is similar to a problem I was having when I first started the project. Google have kindly named the apiclient after an already existing python module called "apiclient". In the end, I had to install something completely different, which predates the setup.py file. I'll figure out what the Google version is called and update the setup.py script.

On Wed, Oct 2, 2013 at 5:55 AM, Steel City Phantom <notifications@github.com

wrote:

good progress, but not quite yet..

willie@willie-laptop ~ $ gsync -vrn Calibre\ Library/ drive:///Calibre\ Library Authorization is required to access your Google Drive. Navigate to the following URL: [big honkin url to google] Type in the received code: [my code] Error: No module named discovery willie@willie-laptop ~ $ sudo pip install discovery Downloading/unpacking discovery Could not find any downloads that satisfy the requirement discovery Cleaning up... No distributions at all found for discovery Storing complete log in /home/willie/.pip/pip.log willie@willie-laptop ~ $ sudo pip install apiclient Requirement already satisfied (use --upgrade to upgrade): apiclient in /usr/lib/python2.7/dist-packages Cleaning up... willie@willie-laptop ~ $ sudo pip install apiclient --upgrade Requirement already up-to-date: apiclient in /usr/lib/python2.7/dist-packages Cleaning up... willie@willie-laptop ~ $ sudo pip install apiclient.discovery --upgrade Downloading/unpacking apiclient.discovery Could not find any downloads that satisfy the requirement apiclient.discovery Cleaning up... No distributions at all found for apiclient.discovery Storing complete log in /home/willie/.pip/pip.log

— Reply to this email directly or view it on GitHubhttps://github.com/iwonbigbro/gsync/issues/14#issuecomment-25513322 .

iwonbigbro commented 10 years ago

Try installing this module instead: https://github.com/iwonbigbro/gsync/commit/560e3e1e2b0e698f12d7e1ce2501220417b360a9

google-api-python-client

On Wed, Oct 2, 2013 at 8:35 AM, Craig iwonbigbro@gmail.com wrote:

Ah, I think this is similar to a problem I was having when I first started the project. Google have kindly named the apiclient after an already existing python module called "apiclient". In the end, I had to install something completely different, which predates the setup.py file. I'll figure out what the Google version is called and update the setup.py script.

On Wed, Oct 2, 2013 at 5:55 AM, Steel City Phantom < notifications@github.com> wrote:

good progress, but not quite yet..

willie@willie-laptop ~ $ gsync -vrn Calibre\ Library/ drive:///Calibre\ Library Authorization is required to access your Google Drive. Navigate to the following URL: [big honkin url to google] Type in the received code: [my code] Error: No module named discovery willie@willie-laptop ~ $ sudo pip install discovery Downloading/unpacking discovery Could not find any downloads that satisfy the requirement discovery Cleaning up... No distributions at all found for discovery Storing complete log in /home/willie/.pip/pip.log willie@willie-laptop ~ $ sudo pip install apiclient Requirement already satisfied (use --upgrade to upgrade): apiclient in /usr/lib/python2.7/dist-packages Cleaning up... willie@willie-laptop ~ $ sudo pip install apiclient --upgrade Requirement already up-to-date: apiclient in /usr/lib/python2.7/dist-packages Cleaning up... willie@willie-laptop ~ $ sudo pip install apiclient.discovery --upgrade Downloading/unpacking apiclient.discovery Could not find any downloads that satisfy the requirement apiclient.discovery Cleaning up... No distributions at all found for apiclient.discovery Storing complete log in /home/willie/.pip/pip.log

— Reply to this email directly or view it on GitHubhttps://github.com/iwonbigbro/gsync/issues/14#issuecomment-25513322 .

scphantm commented 10 years ago

So close i can taste it.

willie@willie-laptop ~ $ gsync -vr --stats --debug Calibre\ Library drive:///Calibre\ Library DEBUG: /usr/local/bin/gsync:152:(): {'--8-bit-output': False, '--append': False, '--backup': False, '--backup-dir': None, '--bwlimit': None, '--chmod': None, '--compare-dest': None, '--contimeout': None, '--copy-dest': None, '--copy-dirlinks': False, '--copy-links': False, '--copy-unsafe-links': False, '--cvs-exclude': False, '--debug': True, '--del': False, '--delay-updates': False, '--delete': False, '--delete-after': False, '--delete-before': False, '--delete-delay': False, '--delete-during': False, '--delete-excluded': False, '--dirs': False, '--dry-run': False, '--exclude': None, '--exclude-from': None, '--executability': False, '--existing': False, '--fake-super': False, '--files-from': None, '--filter': None, '--force': False, '--from0': False, '--fuzzy': False, '--group': False, '--hard-links': False, '--help': False, '--human-readable': False, '--ignore-errors': False, '--ignore-existing': False, '--ignore-times': False, '--include': None, '--include-from': None, '--itemize-changes': False, '--keep-dirlinks': False, '--links': False, '--list-only': False, '--log-file': None, '--log-file-format': None, '--max-delete': None, '--max-size': None, '--min-size': None, '--modify-window': None, '--no-implied-dirs': False, '--omit-dir-times': False, '--one-file-system': False, '--out-format': None, '--owner': False, '--partial': False, '--partial-dir': None, '--perms': False, '--progress': False, '--protect-args': False, '--proxy': False, '--prune-empty-dirs': False, '--quiet': False, '--recursive': True, '--relative': False, '--remove-source-files': False, '--safe-links': False, '--size-only': False, '--sparse': False, '--stats': True, '--suffix': None, '--super': False, '--temp-dir': None, '--timeout': None, '--times': False, '--update': False, '--verbose': True, '--version': False, '-F': False, '-P': False} DEBUG: /usr/local/bin/gsync:168:(): Creating crawler for: Calibre Library DEBUG: libgsync/drive/init.py:174:init(): Initialising drive DEBUG: libgsync/drive/init.py:191:init(): Initialisation complete DEBUG: libgsync/drive/init.py:434:stat(): Checking pcache for path: drive://Calibre Library DEBUG: libgsync/drive/init.py:459:stat(): Got 2 paths from pathlist(drive://Calibre Library) DEBUG: libgsync/drive/init.py:460:stat(): Got paths: ['drive://', 'Calibre Library'] DEBUG: libgsync/drive/init.py:467:stat(): Searching for Calibre Library in path drive:// DEBUG: libgsync/drive/init.py:472:stat(): Checking pcache for path: drive://Calibre Library DEBUG: libgsync/drive/init.py:475:stat(): * nothing found DEBUG: libgsync/drive/init.py:721:_query(): Checking gcache for parentId: root DEBUG: libgsync/drive/init.py:277:_getCredentialStorage(): Loading storage DEBUG: libgsync/drive/init.py:206:service(): Authenticating DEBUG: libgsync/drive/init.py:216:service(): Loading Google Drive service from config DEBUG: libgsync/drive/init.py:220:service(): Downloading API service DEBUG: libgsync/drive/init.py:237:service(): Building Google Drive service from document DEBUG: libgsync/drive/init.py:751:_query(): Executing query: {'q': '"root" in parents and trashed = false'} INFO:apiclient.discovery:URL being requested: https://www.googleapis.com/drive/v2/files?q=%22root%22+in+parents+and+trashed+%3D+false&alt=json connect: (www.googleapis.com, 443) send: 'GET [google url] reply: 'HTTP/1.1 200 OK\r\n' header: Expires: Thu, 03 Oct 2013 00:13:48 GMT header: Date: Thu, 03 Oct 2013 00:13:48 GMT header: Cache-Control: private, max-age=0, must-revalidate, no-transform header: ETag: "[key]" header: Content-Type: application/json; charset=UTF-8 header: Content-Encoding: gzip header: X-Content-Type-Options: nosniff header: X-Frame-Options: SAMEORIGIN header: X-XSS-Protection: 1; mode=block header: Content-Length: 7754 header: Server: GSE header: Alternate-Protocol: 443:quic DEBUG: libgsync/drive/init.py:755:_query(): Query returned 4 files DEBUG: libgsync/drive/init.py:762:_query(): Updating google cache: root (37 items) DEBUG: libgsync/drive/init.py:478:stat(): Got 37 entities back DEBUG: libgsync/drive/init.py:414:_findEntity(): Iterating 37 entities to find Calibre Library DEBUG: libgsync/drive/init.py:419:_findEntity(): Found Calibre Library DEBUG: libgsync/drive/init.py:426:_getProperties(): Fetching file properties: {[big long list of props]} DEBUG: libgsync/drive/init.py:492:stat(): Updating path cache: drive://Calibre Library DEBUG: libgsync/drive/init.py:496:stat(): Found drive://Calibre Library DEBUG: libgsync/drive/init.py:497:stat(): * ent: {u'mimeType': u'application/vnd.google-apps.folder', u'appDataContents': False, u'labels': {[big long list of google stuff]'> DEBUG: libgsync/crawler.py:60:init(): Dest is a directory, not forcing dest file: drive://Calibre Library DEBUG: libgsync/crawler.py:83:init(): force_dest_file = False DEBUG: libgsync/crawler.py:136:run(): Source srcpath: Calibre Library DEBUG: libgsync/crawler.py:137:run(): Source basepath: DEBUG: libgsync/crawler.py:138:run(): Source path: Calibre Library DEBUG: libgsync/sync/file/factory.py:10:create(): SyncFileFactory.create() DEBUG: libgsync/sync/file/factory.py:25:create(): Creating SyncFileLocal(.) DEBUG: libgsync/sync/file/factory.py:10:create(): SyncFileFactory.create(drive://Calibre Library) DEBUG: libgsync/sync/file/factory.py:17:create(): Creating SyncFileRemote(drive://Calibre Library) DEBUG: libgsync/crawler.py:146:run(): Enumerating: Calibre Library sent 0 bytes received 0 bytes 0.00 bytes/sec DEBUG: /usr/local/bin/gsync:179:(): Crawlers finished, exiting close failed in file object destructor: sys.excepthook is missing lost sys.stderr

It looks like its finding the folder on Drive, but not anything on my laptop, therefore copying nothing.

iwonbigbro commented 10 years ago

DEBUG: libgsync/crawler.py:146:run(): Enumerating: Calibre Library

This is a bug I have fixed, whereby local directories are not recursed. It was introduced in a fix made in relation to another issue. I am currently going through some stabilisation at the moment, so I won't keep you waiting much longer. I am reworking filename handling to fix a filename encoding issue. Once that is fixed, I will role out 0.1.4, which has the new setup.py using setuptools. :-)

iwonbigbro commented 10 years ago

I have just release 0.1.4 on pypi. It now uses setuptools, so if you install using pip, it installs everything needed.

scphantm commented 10 years ago

SUCCESS!!! Uploaded the folder just like rsync. Haven't tried downloading yet but it looks good. When I installed the update, it also verified dependencies. Looks good man, thanks.

iwonbigbro commented 10 years ago

Excellent!