New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS X: pyspotify is linked with libspotify without .dylib suffix, causes "image not found" install error #130

Closed
ZakEspley opened this Issue Apr 28, 2014 · 17 comments

Comments

6 participants
@ZakEspley

ZakEspley commented Apr 28, 2014

I used

brew install libspotify

then

sudo pip install --pre pyspotify

This is my result,

Downloading/unpacking pyspotify
  Downloading pyspotify-2.0.0b1.tar.gz (139kB): 139kB downloaded
  Running setup.py (path:/private/tmp/pip_build_root/pyspotify/setup.py) egg_info for package pyspotify
    OS/X: confusion between 'cc' versus 'gcc' (see issue 123)
    will not use '__thread' in the C code

    Installed /private/tmp/pip_build_root/pyspotify/cffi-0.8.2-py2.7-macosx-10.9-x86_64.egg
    Searching for pycparser
    Reading https://pypi.python.org/simple/pycparser/
    Best match: pycparser 2.10
    Downloading https://pypi.python.org/packages/source/p/pycparser/pycparser-2.10.tar.gz#md5=d87aed98c8a9f386aa56d365fe4d515f
    Processing pycparser-2.10.tar.gz
    Writing /tmp/easy_install-QDABAH/pycparser-2.10/setup.cfg
    Running pycparser-2.10/setup.py -q bdist_egg --dist-dir /tmp/easy_install-QDABAH/pycparser-2.10/egg-dist-tmp-y_hKB9
    zip_safe flag not set; analyzing archive contents...

    Installed /private/tmp/pip_build_root/pyspotify/pycparser-2.10-py2.7.egg

    building '_cffi__xd2ced33x74321873' extension
    clang -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c spotify/__pycache__/_cffi__xd2ced33x74321873.c -o /private/tmp/pip_build_root/pyspotify/spotify/__pycache__/spotify/__pycache__/_cffi__xd2ced33x74321873.o
    spotify/__pycache__/_cffi__xd2ced33x74321873.c:9825:13: warning: incompatible pointer types initializing 'void (**)(sp_playlist *, sp_track **, int, int, void *)' with an expression of type 'void (**)(sp_playlist *, sp_track *const *, int, int, void *)' [-Wincompatible-pointer-types]
      { void(* *tmp)(sp_playlist *, sp_track * *, int, int, void *) = &p->tracks_added; (void)tmp; }
                ^                                                     ~~~~~~~~~~~~~~~~
    1 warning generated.
    clang -bundle -undefined dynamic_lookup -L/usr/local/lib -L/usr/local/opt/sqlite/lib /private/tmp/pip_build_root/pyspotify/spotify/__pycache__/spotify/__pycache__/_cffi__xd2ced33x74321873.o -lspotify -o /private/tmp/pip_build_root/pyspotify/spotify/__pycache__/_cffi__xd2ced33x74321873.so
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/private/tmp/pip_build_root/pyspotify/setup.py", line 64, in <module>
        'Topic :: Software Development :: Libraries',
      File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
        dist.run_commands()
      File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "<string>", line 15, in replacement_run
      File "/usr/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 186, in find_sources
        mm.run()
      File "/usr/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 246, in run
        self.add_defaults()
      File "/usr/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 282, in add_defaults
        sdist.add_defaults(self)
      File "/usr/local/lib/python2.7/site-packages/setuptools/command/sdist.py", line 167, in add_defaults
        build_py = self.get_finalized_command('build_py')
      File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
        self.finalize_options()
      File "/usr/local/lib/python2.7/site-packages/setuptools/command/build_py.py", line 26, in finalize_options
        _build_py.finalize_options(self)
      File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_py.py", line 46, in finalize_options
        ('force', 'force'))
      File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 298, in set_undefined_options
        src_cmd_obj.ensure_finalized()
      File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
        self.finalize_options()
      File "/private/tmp/pip_build_root/pyspotify/setup.py", line 26, in finalize_options
        from spotify import ffi
      File "spotify/__init__.py", line 108, in <module>
        ffi, lib = _build_ffi()
      File "spotify/__init__.py", line 100, in _build_ffi
        ext_package='spotify')
      File "/private/tmp/pip_build_root/pyspotify/cffi-0.8.2-py2.7-macosx-10.9-x86_64.egg/cffi/api.py", line 341, in verify
        lib = self.verifier.load_library()
      File "/private/tmp/pip_build_root/pyspotify/cffi-0.8.2-py2.7-macosx-10.9-x86_64.egg/cffi/verifier.py", line 75, in load_library
        return self._load_library()
      File "/private/tmp/pip_build_root/pyspotify/cffi-0.8.2-py2.7-macosx-10.9-x86_64.egg/cffi/verifier.py", line 151, in _load_library
        return self._vengine.load_library()
      File "/private/tmp/pip_build_root/pyspotify/cffi-0.8.2-py2.7-macosx-10.9-x86_64.egg/cffi/vengine_cpy.py", line 138, in load_library
        raise ffiplatform.VerificationError(error)
    cffi.ffiplatform.VerificationError: importing '/private/tmp/pip_build_root/pyspotify/spotify/__pycache__/_cffi__xd2ced33x74321873.so': dlopen(/private/tmp/pip_build_root/pyspotify/spotify/__pycache__/_cffi__xd2ced33x74321873.so, 2): Library not loaded: /usr/local/opt/libspotify/lib/libspotify
      Referenced from: /private/tmp/pip_build_root/pyspotify/spotify/__pycache__/_cffi__xd2ced33x74321873.so
      Reason: image not found
    Complete output from command python setup.py egg_info:
    OS/X: confusion between 'cc' versus 'gcc' (see issue 123)

will not use '__thread' in the C code



Installed /private/tmp/pip_build_root/pyspotify/cffi-0.8.2-py2.7-macosx-10.9-x86_64.egg

Searching for pycparser

Reading https://pypi.python.org/simple/pycparser/

Best match: pycparser 2.10

Downloading https://pypi.python.org/packages/source/p/pycparser/pycparser-2.10.tar.gz#md5=d87aed98c8a9f386aa56d365fe4d515f

Processing pycparser-2.10.tar.gz

Writing /tmp/easy_install-QDABAH/pycparser-2.10/setup.cfg

Running pycparser-2.10/setup.py -q bdist_egg --dist-dir /tmp/easy_install-QDABAH/pycparser-2.10/egg-dist-tmp-y_hKB9

zip_safe flag not set; analyzing archive contents...



Installed /private/tmp/pip_build_root/pyspotify/pycparser-2.10-py2.7.egg

running egg_info

creating pip-egg-info/pyspotify.egg-info

writing requirements to pip-egg-info/pyspotify.egg-info/requires.txt

writing pip-egg-info/pyspotify.egg-info/PKG-INFO

writing top-level names to pip-egg-info/pyspotify.egg-info/top_level.txt

writing dependency_links to pip-egg-info/pyspotify.egg-info/dependency_links.txt

writing manifest file 'pip-egg-info/pyspotify.egg-info/SOURCES.txt'

warning: manifest_maker: standard file '-c' not found



running build_ext

building '_cffi__xd2ced33x74321873' extension

creating /private/tmp/pip_build_root/pyspotify/spotify/__pycache__/spotify

creating /private/tmp/pip_build_root/pyspotify/spotify/__pycache__/spotify/__pycache__

clang -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c spotify/__pycache__/_cffi__xd2ced33x74321873.c -o /private/tmp/pip_build_root/pyspotify/spotify/__pycache__/spotify/__pycache__/_cffi__xd2ced33x74321873.o

spotify/__pycache__/_cffi__xd2ced33x74321873.c:9825:13: warning: incompatible pointer types initializing 'void (**)(sp_playlist *, sp_track **, int, int, void *)' with an expression of type 'void (**)(sp_playlist *, sp_track *const *, int, int, void *)' [-Wincompatible-pointer-types]

  { void(* *tmp)(sp_playlist *, sp_track * *, int, int, void *) = &p->tracks_added; (void)tmp; }

            ^                                                     ~~~~~~~~~~~~~~~~

1 warning generated.

clang -bundle -undefined dynamic_lookup -L/usr/local/lib -L/usr/local/opt/sqlite/lib /private/tmp/pip_build_root/pyspotify/spotify/__pycache__/spotify/__pycache__/_cffi__xd2ced33x74321873.o -lspotify -o /private/tmp/pip_build_root/pyspotify/spotify/__pycache__/_cffi__xd2ced33x74321873.so

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/private/tmp/pip_build_root/pyspotify/setup.py", line 64, in <module>

    'Topic :: Software Development :: Libraries',

  File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup

    dist.run_commands()

  File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands

    self.run_command(cmd)

  File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command

    cmd_obj.run()

  File "<string>", line 15, in replacement_run

  File "/usr/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 186, in find_sources

    mm.run()

  File "/usr/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 246, in run

    self.add_defaults()

  File "/usr/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 282, in add_defaults

    sdist.add_defaults(self)

  File "/usr/local/lib/python2.7/site-packages/setuptools/command/sdist.py", line 167, in add_defaults

    build_py = self.get_finalized_command('build_py')

  File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command

    cmd_obj.ensure_finalized()

  File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized

    self.finalize_options()

  File "/usr/local/lib/python2.7/site-packages/setuptools/command/build_py.py", line 26, in finalize_options

    _build_py.finalize_options(self)

  File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_py.py", line 46, in finalize_options

    ('force', 'force'))

  File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 298, in set_undefined_options

    src_cmd_obj.ensure_finalized()

  File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized

    self.finalize_options()

  File "/private/tmp/pip_build_root/pyspotify/setup.py", line 26, in finalize_options

    from spotify import ffi

  File "spotify/__init__.py", line 108, in <module>

    ffi, lib = _build_ffi()

  File "spotify/__init__.py", line 100, in _build_ffi

    ext_package='spotify')

  File "/private/tmp/pip_build_root/pyspotify/cffi-0.8.2-py2.7-macosx-10.9-x86_64.egg/cffi/api.py", line 341, in verify

    lib = self.verifier.load_library()

  File "/private/tmp/pip_build_root/pyspotify/cffi-0.8.2-py2.7-macosx-10.9-x86_64.egg/cffi/verifier.py", line 75, in load_library

    return self._load_library()

  File "/private/tmp/pip_build_root/pyspotify/cffi-0.8.2-py2.7-macosx-10.9-x86_64.egg/cffi/verifier.py", line 151, in _load_library

    return self._vengine.load_library()

  File "/private/tmp/pip_build_root/pyspotify/cffi-0.8.2-py2.7-macosx-10.9-x86_64.egg/cffi/vengine_cpy.py", line 138, in load_library

    raise ffiplatform.VerificationError(error)

cffi.ffiplatform.VerificationError: importing '/private/tmp/pip_build_root/pyspotify/spotify/__pycache__/_cffi__xd2ced33x74321873.so': dlopen(/private/tmp/pip_build_root/pyspotify/spotify/__pycache__/_cffi__xd2ced33x74321873.so, 2): Library not loaded: /usr/local/opt/libspotify/lib/libspotify

  Referenced from: /private/tmp/pip_build_root/pyspotify/spotify/__pycache__/_cffi__xd2ced33x74321873.so

  Reason: image not found

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /private/tmp/pip_build_root/pyspotify

I also tried running with

CFLAGS=-Qunused-arguments CPPFLAGS=-Qunused-arguments pip install --pre pyspotify

and receive the same error.

This is off a fresh install of brew with python on a 2009 intel MBP OSX 10.9.2 and XCode 5.1.1

@jodal jodal added the 2.x label Apr 28, 2014

@jodal

This comment has been minimized.

Member

jodal commented Apr 28, 2014

I'm suspecting that running the following is a workaround?

sudo ln -s /usr/local/opt/libspotify/lib/libspotify.12.1.51.dylib /usr/local/opt/libspotify/lib/libspotify

@jodal jodal added the bug label Apr 28, 2014

@jodal jodal changed the title from Can't install through homebrew and pip to pip install does not find libspotify installed from Homebrew Apr 28, 2014

@jodal

This comment has been minimized.

Member

jodal commented Apr 28, 2014

Yet another workaround not addressing the core issue: I just uploaded wheel packages of v2.0.0b1 for Python 2.7, 3.3, and 3.4 on OSX.

@jodal

This comment has been minimized.

Member

jodal commented Apr 29, 2014

When creating the wheels yesterday, I used XCode 5.0.2. Later I upgraded to XCode 5.1.1, but still couldn't reproduce the issue you experienced.

That said, I do believe this is an issue, as I've seen one or two others with the same or a similar issue since the release of pyspotify v2.0.0b1.

@jodal

This comment has been minimized.

Member

jodal commented Apr 29, 2014

There are at least three typical ways to get Python installed on OS X:

  • Python from Python.org packages,
  • Python from Homebrew, and
  • Python from Apple.

When I tested yesterday and couldn't reproduce this, I used Python installed from Python.org-packages. They does not seem to be affected by #124 nor #130.

When using Python 2.7 from Homebrew, everything also seems to work:

$ ls -l /usr/local/bin/python2.7
lrwxr-xr-x  1 jodal  staff  38 Apr 16 20:45 /usr/local/bin/python2.7 -> ../Cellar/python/2.7.6_1/bin/python2.7
$ mktmpenv -p /usr/local/bin/python2.7
...
$ pip install --pre pyspotify
...
Successfully installed pyspotify cffi pycparser
Cleaning up...
$

When using Python 2.7 from Apple and try to install pyspotify 2.x I'm hit by issue #124, but not this issue:

$ mktmpenv -P /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python
...
$ pip install --pre pyspotify
...
    clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
    clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
    Traceback (most recent call last):
...
$ CFLAGS=-Qunused-arguments pip install --pre pyspotify
...
Successfully installed pyspotify cffi pycparser
Cleaning up...
$

Thus, I'm currently not able to reproduce this. Is there any factor I haven't thought of?

I too have libspotify installed from Homebrew, with no additional symlinks or similar.

@ZakEspley

This comment has been minimized.

ZakEspley commented Apr 29, 2014

Your work around worked for me. But it won't install without it. If you can't reproduce it I can't imagine what is on my computer that wont make it work. Everything is up to date on my computer and I attempted it from a fresh install of Homebrew and Homebrew python 2.7. Thank you for the work around though. Is there anything I can do on my end to help you out?

@jodal

This comment has been minimized.

Member

jodal commented Apr 29, 2014

Would be good to know exactly which of the workarounds helps, if not both.

Can you uninstall and install pyspotify without using the wheel packages I released? E.g., run something like this and see if it works:

pip uninstall pyspotify
pip install --no-use-wheel --pre pyspotify

If you remove the symlink, does it still work to uninstall and install pyspotify now? The wheel packages I released should ensure that. E.g., can you run something along the lines of this?

sudo rm /usr/local/opt/libspotify/lib/libspotify
pip uninstall pyspotify
pip install --pre pyspotify

@jodal jodal self-assigned this Apr 29, 2014

@jodal

This comment has been minimized.

Member

jodal commented May 2, 2014

If anyone else experience this exact issue, please reopen the issue and provide any information you have which may help debug this.

@jodal jodal closed this May 2, 2014

@ZakEspley

This comment has been minimized.

ZakEspley commented May 2, 2014

With the system link both methods work to install pyspotify That is if I have the link in place,

pip install --no-use-wheel --pre pyspotify

worked, and so did,

pip install --pre pyspotify

As soon as I removed the system link both methods failed the same as before.

@jodal

This comment has been minimized.

Member

jodal commented May 2, 2014

Ok... Let's look a bit more for differences between your system and the OS X systems I have access to. What does the following commands return on your system?

$ which clang
/usr/bin/clang
$ clang --version
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
@ycros

This comment has been minimized.

ycros commented May 6, 2014

I have the same issue, libspotify out of homebrew, running Apple's default Python. the symlink fixes it for me as well. Happy to provide more info on request.

$ which clang
/usr/bin/clang
$ clang --version
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
$ which python
/usr/bin/python
$ python
Python 2.7.5 (default, Sep 12 2013, 21:33:34)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

@jodal jodal reopened this May 6, 2014

@ZakEspley

This comment has been minimized.

ZakEspley commented May 6, 2014

Sorry that my contact here is so intermittent I am just very busy and stop by when I have the time. All of my results match ycros's except my python. I returned,

localhost:pyjs Zak$ which python
/usr/local/bin/python
localhost:pyjs Zak$ python
Python 2.7.6 (default, Apr  9 2014, 11:48:52) 
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

So my python is the one from HomeBrew I believe. I don't know if it is important but both ycros and I have python versions that say they are compatible with clang versions older than what we have.

@jrandall

This comment has been minimized.

jrandall commented May 15, 2014

I appear to have this exact issue as well and my python was installed via homebrew.

$ which clang
/usr/bin/clang
$ clang --version
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
$ which python
/usr/local/bin/python
$ python --version
Python 2.7.6
@ghost

This comment has been minimized.

ghost commented May 21, 2014

I've got the same problem. My setup is a bit different than others in that i'm using python 3.4.1/pip3 but same error. Creating the symlink "solves" the issue. Removing it makes it fail. Doesn't matter whether i use --no-use-wheel or not.

My libspotify is installed via homebrew. Python is the install from python.org.

Output of the stuff above:
/usr/bin/clang and a clang version of

Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.2.0

Python version output is:

Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 00:54:21) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
@bookcasey

This comment has been minimized.

bookcasey commented May 30, 2014

Also same problem. Python from Apple, libspotify from homebrew. Workaround works.

@kitizz

This comment has been minimized.

kitizz commented Jun 26, 2014

I'm having this issue as well. Python from MacPorts (=p), libspotify from homebrew. Workaround works.

@jodal

This comment has been minimized.

Member

jodal commented Jun 26, 2014

After brew uninstall libspotify; brew install libspotify I can reproduce this as well. So far, I'm no closer to find a good permanent solution.

@jodal jodal added this to the v2.0.0 milestone Jun 26, 2014

jodal added a commit that referenced this issue Jun 26, 2014

@jodal jodal changed the title from pip install does not find libspotify installed from Homebrew to OS X: pyspotify is linked with libspotify without .dylib suffix, causes "image not found" install error Jun 26, 2014

jodal added a commit to mopidy/homebrew-mopidy that referenced this issue Jun 27, 2014

Add libspotify formula
Copied from homebrew/homebrew, with an added symlink to work around
mopidy/pyspotify#130.

jodal added a commit that referenced this issue Aug 11, 2014

@jodal

This comment has been minimized.

Member

jodal commented Dec 24, 2014

I'm closing this issue, as the problem seems to be have worked around by the symlink and the alternative Homebrew formula for libspotify which creates the symlink for you, both which are documented in the pyspotify installation docs.

If anyone has a proper solution for this issue, please comment. I'd love to have this working without workarounds.

@jodal jodal closed this Dec 24, 2014

@jodal jodal modified the milestones: v2.0.0, v2.0.0b4 Dec 24, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment