Using pip3 to install mopidy extensions

Hi to all.
I have recently installed the mopidy on my raspbian stretch lite with the following commands:
wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add -

below the stretch.list instead of buster.list

sudo wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/stretch.list
sudo apt-get update
sudo apt-get install mopidy

I configured mopidy as a systemd service - so the mopidy configuration is at:
/etc/mopidy/mopidy.conf
The command:
sudo mopidyctl config
gives me the correct mopidy configuration

The command:
sudo mopidyctl local scan
also adds some test media (mp3) files to the mopidy server

Than I wanted to install the mopidy-gmusic extension as suggested in your documentation via
pip install mopidy-gmusic
which gives me an error when trying to compile lxml plugin (on stretch lite with installed uptodate python 2.7 and python 3.5.3)

arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-Ub3vap/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc/lxml/includes -I/usr/include/python2.7 -c src/lxml/etree.c -o build/temp.linux-armv7l-2.7/src/lxml/etree.o -w
In file included from src/lxml/etree.c:692:0:
src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: No such file or directory
#include “libxml/xmlversion.h”
^
compilation terminated.
Compile failed: command ‘arm-linux-gnueabihf-gcc’ failed with exit status 1
cc -I/usr/include/libxml2 -c /tmp/xmlXPathInitftk_S2.c -o tmp/xmlXPathInitftk_S2.o
/tmp/xmlXPathInitftk_S2.c:1:26: fatal error: libxml/xpath.h: No such file or directory
#include “libxml/xpath.h”
^
compilation terminated.
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command ‘arm-linux-gnueabihf-gcc’ failed with exit status 1

----------------------------------------

Command “/usr/bin/python -u -c “import setuptools, tokenize;file=’/tmp/pip-build-sipuDN/lxml/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-1IFDcJ-record/install-record.txt --single-version-externally-managed --compile --user --prefix=” failed with error code 1 in /tmp/pip-build-sipuDN/lxml/

Because it was unclear to me why the lxml wheel needs to be recompiled for python 2.7 i used the pip3 commands to install mopidy-gmusic like:
pip3 install mopidy-gmusic
which collects all required dependencies and allready compiled packages at the installation (which is probably the only reasonable thing to do, not to recompile locally) and the installation is SUCCESSFUL.
Same way I installed also mopidy-musicbox-webclient via pip3 command
sudo pip3 install mopidy-musicbox-webclient
with also successful install.

I also add configurations for both extensions in the /etc/mopidy/mopidy.conf yielding:
[musicbox_webclient]
enabled = true
musicbox = false
websocket_host =
websocket_port =
on_track_click = PLAY_ALL

[gmusic]
username = myusername
password = secret
deviceid = mac
all_access = true
bitrate = 320

Show radio stations in content browser

radio_stations_in_browse = true

Show radio stations as playlists

radio_stations_as_playlists = false

Limit the number of radio stations, unlimited if unset

radio_stations_count =

Limit the number or tracks for each radio station

radio_tracks_count = 25

After mopidy service restart and command:
sudo mopidyctl config
the mopidy DOES NOT give the newly installed extensions in a mopidy.conf (Why is that? Are the extension NOT istalled correctly?)

After openning a mopidy web server entry point:
localhost:6680 (with http://)
mopidy says there are no web clients installed
Web clients which are installed as Mopidy extensions will automatically appear here.
My /etc/mopidy/mopidy.conf below:
[core]
cache_dir = /var/cache/mopidy
config_dir = /etc/mopidy
data_dir = /var/lib/mopidy

[logging]
config_file = /etc/mopidy/logging.conf
debug_file = /var/log/mopidy/mopidy-debug.log

[local]
media_dir = /var/lib/mopidy/media

[m3u]
playlists_dir = /var/lib/mopidy/playlists

[musicbox_webclient]
enabled = true
musicbox = false
websocket_host =
websocket_port =
on_track_click = PLAY_ALL

[gmusic]
username = myemail
password = secret
deviceid = mac
all_access = true
bitrate = 320

Show radio stations in content browser

radio_stations_in_browse = true

Show radio stations as playlists

radio_stations_as_playlists = false

Limit the number of radio stations, unlimited if unset

radio_stations_count =

Limit the number or tracks for each radio station

radio_tracks_count = 25

What am I missing here - don’t the mopidy extensions work also for python 3.5 as installed from pip3.
Did I forget something?
Many thanks for anybody’s answer.
Peter

If you run mopidy deps I imagine you’ll see a load of python2.7 paths listed. And unsurprisingly for a python2 program, no python3 paths. Installing stuff with pip3 installs it into the python3 paths and that’s no good, Mopidy can’t find it.

In short, you need to install python2 versions of everything as per the documentation. You do need to recompile if there is no wheel available (which there generally isn’t), install that missing -dev package dependency using apt.

Hi kingosticks.

Really thanks for your quick response. I was not aware of the fact that with mopidy you should install the extensions with python2 (its nothing bad - just to know). I’ll install the lxml correctly - so that the gcc can compile it.
If I may just ask for a small thing still - mopidy (when running as a service) runs within a particular “mopidy” user. Than it is the correct way to install the extensions to install them within a context of this mopidy user like:

sudo -u mopidy pip install mopidy-gmusic
so the dependencies are then installed in context of a mopidy service e.g below command gives correct results? Or?
sudo mopidyctl deps

Many thanks for your answer.
Peter.

sudo pip install mopidy-whatever will install it system-wide, which is what you want for the service.

This used to be the default behaviour for pip and it would error if you didn’t have write permission for those system directories. We never updated out extension documentation to reflect the new requirement to avoid installing in only the user’s path (by using sudo, or similar).

Understood. Thanks for your help.
Peter.