mopidy / mopidy-spotify

Mopidy extension for playing music from Spotify
https://mopidy.com/ext/spotify/
Apache License 2.0
933 stars 109 forks source link

Installation error Raspberry Pi 3 - DietPi #262

Closed frohlichcortezh closed 4 years ago

frohlichcortezh commented 4 years ago

I get the following error after running sudo python3 -m pip install Mopidy-Spotify

Building wheels for collected packages: pyspotify
  Running setup.py bdist_wheel for pyspotify ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-xhq_qaao/pyspotify/setup.py';f=getatt
r(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wh
eel-4w9sfgex --python-tag cp37:
  running bdist_wheel

(...)

 build/temp.linux-armv7l-3.7/spotify._spotify.c:22:12: fatal error: pyconfig.h: No such file or directory
   #  include <pyconfig.h>
              ^~~~~~~~~~~~
  compilation terminated.
  error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for pyspotify
  Running setup.py clean for pyspotify
Failed to build pyspotify
Installing collected packages: pyspotify, Mopidy-Spotify
  Running setup.py install for pyspotify ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-xhq_qaao/pyspotify/setup.py';f=geta
ttr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pi
p-record-k7db0v09/install-record.txt --single-version-externally-managed --compile:
    running install

(...)

 generating cffi module 'build/temp.linux-armv7l-3.7/spotify._spotify.c'
    creating build/temp.linux-armv7l-3.7
    building 'spotify._spotify' extension
    creating build/temp.linux-armv7l-3.7/build
    creating build/temp.linux-armv7l-3.7/build/temp.linux-armv7l-3.7
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORT
IFY_SOURCE=2 -fPIC -I/usr/include/python3.7m -c build/temp.linux-armv7l-3.7/spotify._spotify.c -o build/temp.linux-armv7l-3.7/build/temp.linux-armv
7l-3.7/spotify._spotify.o
    build/temp.linux-armv7l-3.7/spotify._spotify.c:22:12: fatal error: pyconfig.h: No such file or directory
     #  include <pyconfig.h>
                ^~~~~~~~~~~~
    compilation terminated.
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-xhq_qaao/pyspotify/setup.py';f=getattr(tokenize, 'open', op
en)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-k7db0v09/instal
l-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-xhq_qaao/pyspotify/

Same error also has occured after I've tried installing pyspotify before running the command. I've tried both

sudo apt-get install python-spotify
sudo apt-get install libspotify-dev

Error didn't happen during a Raspberry PI 4 installation.

kingosticks commented 4 years ago

By far the easiest thing to do is to install Mopidy-Spotify from apt.mopidy.com.

If you want to install from source then you need to install all the dependencies. Googling the first error message shows you are missing the python development headers. See https://pyspotify.readthedocs.io/en/latest/installation/#build-tools

sudo apt-get install python-spotify

The package python-spotify is the python2 version but we need the python3 version which is packaged for Debian as python3-spotify. I have fixed that in the readme. I can't see how this would change depending on what hardware you are installing on so you must have done something slightly different in that case.

frohlichcortezh commented 4 years ago

Thank you, I might have installed from apt.mopidy.com the first time. Tried again from there it worked.

Cheers!