Docker-sync: Detect fsvents installation properly

Created on 16 Feb 2017  Â·  11Comments  Â·  Source: EugenMayer/docker-sync

Fail with ImportError: No module named fsevents

➜  laradock git:(docker-sync-0.2) ✗ docker-sync start
       note:  You can also run docker-sync in the background with --daemon
          ok  Starting unison
          ok  appcode-unison-sync container still running, restarting unison in container
     command  docker exec appcode-unison-sync supervisorctl restart unison
          ok  starting initial sync of appcode-unison-sync
     command  docker inspect --format=" {{ .NetworkSettings.Ports }} " appcode-unison-sync | /usr/bin/sed -E "s/.*map\[5000[^ ]+ ([0-9]*)[^0-9].*/\1/"
     command  unison -testserver /var/www "socket://127.0.0.1:32768"
     command  docker inspect --format=" {{ .NetworkSettings.Ports }} " appcode-unison-sync | /usr/bin/sed -E "s/.*map\[5000[^ ]+ ([0-9]*)[^0-9].*/\1/"
     command  unison -ignore='Name ../.git' /Users/simon/Src/campusbooks.ch -auto -batch socket://127.0.0.1:32768
       error  Error starting sync, exit code 0
props    <-?-> props      /
local        : dir props changed  modified on 2017-02-12 at 15:26:30  size 155185219 rwxr-x---
03a44c0a5f87 : dir props changed  modified on 2017-02-16 at 19:37:22  size 155185219 rwxr-xr-x
No updates to propagate
     message  Contacting server...
Connected [//03a44c0a5f87//var/www -> //computer.fritz.box//Users/simon/Src/campusbooks.ch]
Looking for changes
  Waiting for changes from server
Reconciling changes
Synchronization complete at 19:44:33  (0 item transferred, 1 skipped, 0 failed)
  skipped:  (properties changed on both sides)
     success  Unison server started
     command  docker inspect --format=" {{ .NetworkSettings.Ports }} " appcode-unison-sync | /usr/bin/sed -E "s/.*map\[5000[^ ]+ ([0-9]*)[^0-9].*/\1/"
     command  unison -ignore='Name ../.git' /Users/simon/Src/campusbooks.ch -auto -batch socket://127.0.0.1:32768
       error  Error starting sync, exit code 0
props    <-?-> props      /
local        : dir props changed  modified on 2017-02-12 at 15:26:30  size 155185219 rwxr-x---
03a44c0a5f87 : dir props changed  modified on 2017-02-16 at 19:37:22  size 155185219 rwxr-xr-x
No updates to propagate
     message  Contacting server...
Connected [//03a44c0a5f87//var/www -> //computer.fritz.box//Users/simon/Src/campusbooks.ch]
Looking for changes
  Waiting for changes from server
Reconciling changes
Synchronization complete at 19:44:34  (0 item transferred, 1 skipped, 0 failed)
  skipped:  (properties changed on both sides)
     command  docker inspect --format=" {{ .NetworkSettings.Ports }} " appcode-unison-sync | /usr/bin/sed -E "s/.*map\[5000[^ ]+ ([0-9]*)[^0-9].*/\1/"
     command  unison -ignore='Name ../.git' /Users/simon/Src/campusbooks.ch -auto -batch socket://127.0.0.1:32768 -repeat watch
Contacting server...
Connected [//03a44c0a5f87//var/www -> //computer.fritz.box//Users/simon/Src/campusbooks.ch]
Looking for changes
Traceback (most recent call last):
  File "/usr/local/bin/unison-fsmonitor", line 24, in <module>
    import fsevents
ImportError: No module named fsevents
Fatal error: File monitoring helper program not running

Perhaps the same issue than https://github.com/EugenMayer/docker-sync/issues/191 ?

bug documentation

All 11 comments

Are you using pyenv or have several python versions installed?

I'm not using pyenv and don't have different version of python (no python 3), but I did install python 2 from homebrew.

➜  laradock git:(docker-sync-0.2) ✗ which python
/usr/local/bin/python
➜  laradock git:(docker-sync-0.2) ✗ python --version
Python 2.7.13
➜  laradock git:(docker-sync-0.2) ✗ ls -la /usr/local/bin/python
lrwxr-xr-x  1 simon  admin  34 Jan 30 21:46 /usr/local/bin/python -> ../Cellar/python/2.7.13/bin/python

So you have 2 pythons

I uninstalled the homebrew python (it come as ansible dependency). Same error even after reinstalling docker-sync.

You can install one or the other, and both, but you need to know which python is used during docker-sync.

Please have a look at https://github.com/EugenMayer/docker-sync/blob/master/lib/docker-sync/preconditions.rb#L48

unison-fsmonitor is installed (should have happened for you

and

sudo pip install macfsevents

That exact command is missing for you. This command above installs it to the system OSX python, thats why sudo is needed. If you generally use something else, you can install it also for this python version.

I updated the docs here https://github.com/EugenMayer/docker-sync/wiki/1.-Installation to make the dependencies more clear

@gagarine i rechecked the preconditions and fixed quiet a lot of cases

  • macfsevents check installation is done, even if unison-unox is already installed ( the reason why it was still not working for you after uninstalling non sysmtem python )
  • detect if the user using system python / custom python and us the corresponding pip command
  • much clearer messages
  • explicit test if macfsevents could have been installed

@mickaelperrin finally we got this right :)

@gagarine please try to upgrade to beta4, the current release/0.2.0 build and run docker-sync start once, it should detect that u miss fsevents and fix it properly. You can also install brews python before that.

@mickaelperrin i took that fight here because unison is now the default, and if people have too much struggle getting docker-sync run initially, they get frustrated.

@gagarine you can now also install docker-sync using gem install -v0.2.0.beta5 docker-sync i published a pre-release

I will test it ASAP. Thanks a lot for your work.

Automatic macfsevents installation stil failed for me.

Requirement already satisfied: macfsevents in /usr/local/lib/python3.6/site-packages
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named fsevents
       error  Somehow could not successfully install macfsevents even though i treed. 

Fixed it by installing macfsevents for Python 2 manually:

 pip2 install macfsevents

Mobilizer could you open a fresh issue on that? Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Nomafin picture Nomafin  Â·  5Comments

aandrushchenko picture aandrushchenko  Â·  5Comments

zedtux picture zedtux  Â·  8Comments

davellx picture davellx  Â·  8Comments

netiul picture netiul  Â·  7Comments