lra / mackup

Keep your application settings in sync (OS X/Linux)
GNU General Public License v3.0
14.56k stars 929 forks source link

Immediate failure upon invocation (on OSX Mavericks 10, installed with homebrew) #330

Closed yonkeltron closed 10 years ago

yonkeltron commented 10 years ago

After upgrading mackup to 0.7.4 via homebrew, it became impossible to use the executable as it immediately coughed and died.

The cough:

$ mackup
Traceback (most recent call last):
  File "/usr/local/bin/mackup", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
    working_set.require(__requires__)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: mackup==0.7.4

About my current setup:

$ uname -a
Darwin Concurrent-Chickpea.local 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64

$ brew --version
0.9.5

If I can provide any additional info, please let me know.

Thanks!

kukat commented 10 years ago

Same to me.

brew install python

/usr/local/bin/python
Python 2.7.8
pip 1.5.6 from /usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg (python 2.7)
➜  ~  brew install mackup
==> Downloading https://github.com/lra/mackup/archive/0.7.4.tar.gz
######################################################################## 100.0%
==> python setup.py install --prefix=/usr/local/Cellar/mackup/0.7.4 --single-version-externally-managed
🍺  /usr/local/Cellar/mackup/0.7.4: 214 files, 952K, built in 5 seconds
➜  ~  mackup -h
Traceback (most recent call last):
  File "/usr/local/bin/mackup", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2793, in <module>
    working_set.require(__requires__)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 673, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 576, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: mackup==0.7.4

But pip version works fine.

➜  ~  brew uninstall mackup --force
Uninstalling mackup...
➜  ~  pip install mackup
Downloading/unpacking mackup
  Downloading mackup-0.7.4.tar.gz
  Running setup.py (path:/private/var/folders/39/p4bts1150q90kxl83bn23g440000gn/T/pip_build_alex/mackup/setup.py) egg_info for package mackup

Installing collected packages: mackup
  Running setup.py install for mackup

    Installing mackup script to /usr/local/bin
Successfully installed mackup
Cleaning up...
➜  ~  mackup -h
usage: mackup [-h] {backup,restore,uninstall,list}

Mackup 0.7.4
Keep your application settings in sync.
Copyright (C) 2013-2014 Laurent Raufaste <http://glop.org/>

positional arguments:
  {backup,restore,uninstall,list}
                        Required action mode for Mackup, see below for
                        details.

optional arguments:
  -h, --help            show this help message and exit

Mackup modes of action:
 - backup: sync your conf files to your synced storage, use this the 1st time you use Mackup.
 - restore: link the conf files already in your synced storage on your system, use it on any new system you use.
 - uninstall: reset everything as it was before using Mackup.
 - list: display a list of all supported applications.
supermarin commented 10 years ago

Same issue here. The solution is to tell Python how to find the installed site-packages, as Homebrew tells you:

==> Caveats
If you need Python to find the installed site-packages:
  mkdir -p ~/Library/Python/2.7/lib/python/site-packages
  echo '/usr/local/lib/python2.7/site-packages' > ~/Library/Python/2.7/lib/python/site-packages/homebrew.pth

Perhaps this could be solved with the brew formula? cc/ @lra

lra commented 10 years ago

Thanks guys for the detailed report, and sorry about the delay on the fix. Hopefully this will fix it: https://github.com/Homebrew/homebrew/pull/32833

lamielle commented 10 years ago

My Homebrew pull request Homebrew/homebrew#32967 was just merged, please "brew update" and see if that addresses your problems. It fixed it for me.

yonkeltron commented 10 years ago

Ok, it gets a little better, actually. Now I get this:

$ brew reinstall mackup
$ mackup backup
acking up .jshintrc...
Backing up Library/Application Support/LightTable/plugins...
Backing up Library/Preferences/com.kodowa.LightTable.plist...
Backing up Library/Application Support/LightTable/settings...
Backing up Library/Application Support/BibDesk...
Backing up .atom/init.coffee...
A file named /Users/yonkeltron/Dropbox/Mackup/.atom/init.coffee already exists in the backup.
Are you sure that your want to replace it ? <Yes|No>Yes
Traceback (most recent call last):
  File "/usr/local/Cellar/mackup/0.7.4/libexec/bin/mackup", line 8, in <module>
    load_entry_point('mackup==0.7.4', 'console_scripts', 'mackup')()
  File "/usr/local/Cellar/mackup/0.7.4/lib/python2.7/site-packages/mackup/main.py", line 48, in main
    app.backup()
  File "/usr/local/Cellar/mackup/0.7.4/lib/python2.7/site-packages/mackup/application.py", line 83, in backup
    utils.copy(filepath, mackup_filepath)
  File "/usr/local/Cellar/mackup/0.7.4/lib/python2.7/site-packages/mackup/utils.py", line 76, in copy
    assert os.path.exists(src)
AssertionError
lamielle commented 10 years ago

That appears to be mackup-specific, so we're out of the Homebrew woods at this point.

I believe the maintainer(s) (@lra) would suggest you file a separate ticket tracking this new issue.

lamielle commented 10 years ago

I'm convinced now @yonkeltron: the issue you're seeing is definitely unrelated and I see it too. Here's what's happening: the atom.cfg was updated at some point to NOT backup the full ~/.atom directory. Instead, it only lists specific files under that directory. My ~/.atom directory is a symlink to my dropbox directory. So, when I run 'mackup backup', the new atom.cfg is not considering the fact that the .atom directory is a symlink itself and is trying to create symlinks for the individual files instead.

To work around the problem, break the symlink of ~/.atom to your dropbox directory, then a 'mackup backup' will 'do the right thing'. Not sure if this is the best behavior of mackup, but the workaround is quick and easy.

Here's me fixing it on my notebook:

    $ rm ~/.atom
    $ mv ~/Dropbox/Mackup/.atom ~
    $ mackup backup
    Backing up .atom/init.coffee...
    Backing up .atom/snippets.cson...
    Backing up .atom/config.cson...
    Backing up .atom/styles.less...
    Backing up .atom/keymap.cson...
    Backing up .atom/packages...
yonkeltron commented 10 years ago

Yep, @lamielle I can confirm that fix works. Therefore, it looks like the ticket can be closed considering the working homebrew formula.

lamielle commented 10 years ago

Great, thanks for confirming @yonkeltron!

@papegoja it looks like some permissions problem (clearly). Just from that dump I don't have enough context to know what's wrong. Also, I don't use oh-my-zsh, so I'm not able to reproduce (though I have wanted to check out that package for a while now...).

lra commented 10 years ago

Fixed by https://github.com/Homebrew/homebrew/pull/32967 thanks @lamielle

@yonkeltron @Papegoja please open specific tickets, it's very hard to follow multiple bugs in the same issue.

andemening commented 10 years ago

I can confirm this works for my ~/.oh-my-zsh/plugins/gitfast/git-completion.bash too. pip installed Mackup version 0.7.4. Deleting the symlink fixes the issue I had with oh-my-zsh. I run zsh shell.

EmilVarona commented 9 years ago

fwiw, I had a similar issue. Homebrew installed v0.8.8 which gave me this error after installation

$ mackup backup
Traceback (most recent call last):
  File "/usr/local/Cellar/mackup/0.8.8/libexec/bin/mackup", line 9, in <module>
    load_entry_point('mackup==0.8.8', 'console_scripts', 'mackup')()
  File "/usr/local/Cellar/mackup/0.8.8/libexec/lib/python2.7/site-packages/mackup/main.py", line 52, in main
    if args['force']:
KeyError: 'force'

I uninstalled and reinstalled using pip, which installed v0.8.9. This version worked without issue

lra commented 9 years ago

yep, homebrew is a little behind sometimes.