gilesknap / gphotos-sync

Google Photos and Albums backup with Google Photos Library API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to install on Windows?

gilesknap opened this issue · comments

I'm not too familiar with python environments on Windows - I can make it work in pycharm but need independent instructions.

The following worked for me:
(it may b worth adding C:\Users<Username>\AppData\Local\Programs\Python\Python36\ to the path instead of using the full path every time - not sure why python installer does not do this?)

  • Install python from https://www.python.org/ftp/python/3.6.7/python-3.6.7-amd64.exe
  • mkdir myInstallDir
  • cd myInstallDir
  • C:\Users\giles\AppData\Local\Programs\Python\Python36\python.exe -m pip install pipenv
  • C:\Users\giles\AppData\Local\Programs\Python\Python36\python.exe -m pipenv install gphotos-sync
  • C:\Users\giles\AppData\Local\Programs\Python\Python36\python.exe -m pipenv install python-magic-bin
  • C:\Users\giles\AppData\Local\Programs\Python\Python36/python.exe -m pipenv run gphotos-sync C:\MyPhotosFolder
commented

the last command (python -m pipenv run gphotos-sync C:\MyPhotosFolder) failed in my case:

C:\Python\Python37>python -m pipenv run gphotos-sync C:\MyPhotosFolder
missing or bad secrets file: C:\Users\8000plus\AppData\Local\gphotos-sync\gphotos-sync\client_secret.json
09-24 15:29:50
Process failed.
Traceback (most recent call last):
  File "c:\users\8000plus\.virtualenvs\python37-q9pyk0hv\lib\site-packages\gphotos\authorize.py", line 41, in __init__
    with secrets_file.open('r') as stream:
  File "C:\Python\Python37\Lib\pathlib.py", line 1193, in open
    opener=self._opener)
  File "C:\Python\Python37\Lib\pathlib.py", line 1046, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\8000plus\\AppData\\Local\\gphotos-sync\\gphotos-sync\\client_secret.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\8000plus\.virtualenvs\python37-q9pyk0hv\lib\site-packages\gphotos\Main.py", line 372, in main
    self.setup(args, db_path)
  File "c:\users\8000plus\.virtualenvs\python37-q9pyk0hv\lib\site-packages\gphotos\Main.py", line 224, in setup
    int(args.max_retries)
  File "c:\users\8000plus\.virtualenvs\python37-q9pyk0hv\lib\site-packages\gphotos\authorize.py", line 54, in __init__
    exit(1)
  File "c:\users\8000plus\.virtualenvs\python37-q9pyk0hv\lib\site.py", line 397, in __call__
    raise SystemExit(code)
SystemExit: 1
09-24 15:29:50 Done.

How to proceed?

You need to create a client secret file and place it in C:\Users\8000plus\AppData\Local\gphotos-sync\gphotos-sync\.

See the section on 'valid client id' in https://github.com/gilesknap/gphotos-sync or have a read of https://www.linuxuprising.com/2019/06/how-to-backup-google-photos-to-your.html

Cheers,
giles.

I have version 2.10.4 installed on my windows, how do I update to 2.14.0 with this method? I re-ran the command but that didn't help. Do I need to delete something first?

To be sure pipenv gets the latest you can do.
pipenv -rm
Before redoing the above.
Make sure you cd to the directory first.

To be sure pipenv gets the latest you can do.
pipenv -rm

It is pipenv --rm

For new users, when creating the client secret file, do not select the "other" option but "Desktop app" (as mentioned here)

Any idea how long I should expect this to take? I entered in the final command into Command Prompt about an hour ago and still nothing has happened since then, no error, no progress indication, no link to request that I log in to Google Photos, and no photos appearing in the folder. My Google Photos account has about 950+ GB of photos and videos in it, so I am not sure if that is partly why it is slow. Thanks!

Indexing takes quite a while and varies by library size. But you should see the indexing ... prompt

hello!
I'm getting an error on Debian 10. Does it try to bind to a port and listen?

gphotos-sync --new-token --progress --secret .config/gphotos-sync/client_secret.json /srv/storage/photos/ 12-21 16:59:07 WARNING gphotos-sync 3.0.3 2022-12-21 16:59:07.780742 12-21 16:59:07 ERROR Process failed. Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/gphotos_sync/Main.py", line 496, in main self.setup(args, db_path) File "/usr/local/lib/python3.7/dist-packages/gphotos_sync/Main.py", line 345, in setup self.auth.authorize() File "/usr/local/lib/python3.7/dist-packages/gphotos_sync/authorize.py", line 96, in authorize flow.run_local_server(open_browser=False, host=self.host, port=self.port) File "/usr/local/lib/python3.7/dist-packages/google_auth_oauthlib/flow.py", line 500, in run_local_server bind_addr or host, port, wsgi_app, handler_class=_WSGIRequestHandler File "/usr/lib/python3.7/wsgiref/simple_server.py", line 153, in make_server server = server_class((host, port), handler_class) File "/usr/lib/python3.7/socketserver.py", line 452, in __init__ self.server_bind() File "/usr/lib/python3.7/wsgiref/simple_server.py", line 50, in server_bind HTTPServer.server_bind(self) File "/usr/lib/python3.7/http/server.py", line 137, in server_bind socketserver.TCPServer.server_bind(self) File "/usr/lib/python3.7/socketserver.py", line 466, in server_bind self.socket.bind(self.server_address) OSError: [Errno 98] Address already in use 12-21 16:59:07 WARNING Done.

Any advice?
Thanks!

Hi @stefankarschti . Yes the Google Auth sets up a web server to receive a redirect for initial login only. I think there is a command line option to change the default. Open a new bug if you are still having issues, for some reason you have commented on a long closed bug re windows.

Hi @gilesknap . Solved in the meantime. I was going for a headless installation and skipped the part where a token needed to be created elsewhere and copied.
Thanks a lot! Awesome project!