EugenMayer / docker-sync

Run your application at full speed while syncing your code for development, finally empowering you to utilize docker for development under OSX/Windows/*Linux
GNU General Public License v3.0
3.53k stars 289 forks source link

Problem with: ImportError: No module named fsevents #191

Closed dacz closed 7 years ago

dacz commented 7 years ago

I'm trying to run docker-sync but I'm getting error with fsevents.

Please, can you help me what am I doing wrong?

the error:

23:31 $ docker-sync-stack start
          ok  Starting unison
          ok  Synced /Users/dacz/development/lidskaSila/.data/db
     success  Unison server started
          ok  Synced /Users/dacz/development/lidskaSila/.data/db
          ok  Starting unison
Contacting server...
Connected [//471ce402264b//var/lib/mysql -> //DavidCs-Air//Users/dacz/development/lidskaSila/.data/db]
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
^C/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open3.rb:285:in `read': closed stream (IOError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open3.rb:285:in `block (2 levels) in capture3'

docker-sync.yml

options:
  compose-file-path: '_docker-compose.yml'
  compose-dev-file-path: '_docker-compose-dev.yml'
  verbose: false

syncs:
  dbls-sync:
    notify_terminal: false
    src: './.data/db'
    dest: '/var/lib/mysql'
    sync_host_ip: '127.0.0.1'
    sync_host_port: 10871
    sync_strategy: 'unison'

  apache-php-sync:
    notify_terminal: false
    src: '.'
    dest: '/var/www/app'
    sync_host_ip: '127.0.0.1'
    sync_host_port: 10872
    sync_excludes: ['Gemfile.lock', 'Gemfile', 'config.rb', '.sass-cache/', 'sass/', 'sass-cache/', 'composer.json' , 'bower.json', 'package.json', 'Gruntfile*', 'bower_components/', 'node_modules/', '.gitignore', '.git/', '*.coffee', '*.scss', '*.sass', 'Tests']
    sync_excludes_type: 'Path'
    sync_strategy: 'unison'

docker-compose.yml

version: '2'
services:
    dbls:
        image: mysql:5.7
        container_name: dbls
        volumes:
            - "./.data/db:/var/lib/mysql"
        restart: always
        ports:
            - "3306:3306"

        environment:
            MYSQL_ROOT_PASSWORD: *****
            MYSQL_DATABASE: dbname
            MYSQL_USER: root
            MYSQL_PASSWORD: ******

    httpd:
        image: lidskasila-apache-dev
        container_name: apache-php
        restart: always
        ports:
            - "80:80"
            - "22:22"
        volumes:
            - "./:/var/www/app"

I've installed fswatch and unison via brew and docker-sync via gem (with sudo).

Please, can you help? Thanks!

EugenMayer commented 7 years ago

You miss unox on your host, try to run either

pip install unox

or

sudo pip install unox
uschtwill commented 7 years ago

Easier said than done:

❯ pip install unox
Collecting unox
  Could not find a version that satisfies the requirement unox (from versions: )
No matching distribution found for unox

Help?! :)

Edit:

❯ pip -v install unox
Collecting unox
  1 location(s) to search for versions of unox:
  * https://pypi.python.org/simple/unox/
  Getting page https://pypi.python.org/simple/unox/
  Looking up "https://pypi.python.org/simple/unox/" in the cache
  No cache entry available
  Starting new HTTPS connection (1): pypi.python.org
  "GET /simple/unox/ HTTP/1.1" 404 28063
  Status code 404 not in [200, 203, 300, 301]
  Could not fetch URL https://pypi.python.org/simple/unox/: 404 Client Error: Not Found for url: https://pypi.python.org/simple/unox/ - skipping
  Could not find a version that satisfies the requirement unox (from versions: )
Cleaning up...
No matching distribution found for unox
Exception information:
Traceback (most recent call last):
  File "/Users/Will/.pyenv/versions/3.4.4/lib/python3.4/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Users/Will/.pyenv/versions/3.4.4/lib/python3.4/site-packages/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/Users/Will/.pyenv/versions/3.4.4/lib/python3.4/site-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/Users/Will/.pyenv/versions/3.4.4/lib/python3.4/site-packages/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/Users/Will/.pyenv/versions/3.4.4/lib/python3.4/site-packages/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/Users/Will/.pyenv/versions/3.4.4/lib/python3.4/site-packages/pip/index.py", line 514, in find_requirement
    'No matching distribution found for %s' % req
pip.exceptions.DistributionNotFound: No matching distribution found for unox
EugenMayer commented 7 years ago

You are using pyenv - you need to fix it. I am using python 2.7, you are using 3.4 - i am not sure if unox is not available for 3.x or whatever, please check the python related docs, i cannot really help with custom python installations, sorry

uschtwill commented 7 years ago

Actually this doesn't seem to be a version issue, https://pypi.python.org/simple/unox/ just returns a 404. There isn't even any version info being transmitted, it looks like there simply is no package called unoxat all... or am I missing something here?

EugenMayer commented 7 years ago

Sorry, my bad. https://github.com/EugenMayer/docker-sync/blob/master/lib/docker-sync/preconditions.rb#L49

You ar missing macfsevents https://github.com/EugenMayer/docker-sync/blob/master/lib/docker-sync/preconditions.rb#L51

unox has been installed most probably using brew - did you?

uschtwill commented 7 years ago

No, I hadn't installed this ominous unox thing. :)

But I just got it to work by running https://github.com/EugenMayer/docker-sync/blob/master/lib/docker-sync/preconditions.rb#L49.

I then tried docker-sync startagain, which then threw the error ImportError: No module named fsevents.

At that point I remembered that I had installed Python 2.7 using pyenv, and that I already had set the local Python in the project directory to 2.7 as well, but that I hadn't installed macfsevents for that Python yet. So I ran the second command you referenced again and lo and behold docker-sync start is now working.

Thank you!

EugenMayer commented 7 years ago

well i added some confusion to the mix, so i guess, we are equal :)

Great that it works, happy syncing!

uschtwill commented 7 years ago

It's all good: ;)

Oh yeah, and I just tried switching back to Python 3.4.4 (pyenv local 3.4.4) with docker-sync startthen throwing:

Looking for changes
Traceback (most recent call last):
  File "/usr/local/bin/unison-fsmonitor", line 278, in <module>
    main()
  File "/usr/local/bin/unison-fsmonitor", line 212, in main
    sendCmd("VERSION", ["1"])
  File "/usr/local/bin/unison-fsmonitor", line 84, in sendCmd
    raw_cmd += " " + urllib.quote(arg);
AttributeError: 'module' object has no attribute 'quote'
Fatal error: File monitoring helper program not running

After doing a pyenv local 2.7 it works again. So yeah, the Python versions does seem to make the difference. :)