# Using pip3 to install mopidy extensions

**URL:** <https://discourse.mopidy.com/t/using-pip3-to-install-mopidy-extensions/3464>\
**Category:** Misc\
**Created:** [September 13, 2019, 7:52am UTC](https://discourse.mopidy.com/t/using-pip3-to-install-mopidy-extensions/3464 "2019-09-13T07:52:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrkiperica](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/mrkiperica/32/1279_2.png) [@mrkiperica](https://discourse.mopidy.com/u/mrkiperica)\
**Post date:** [September 13, 2019, 7:52am UTC](https://discourse.mopidy.com/t/using-pip3-to-install-mopidy-extensions/3464/1 "2019-09-13T07:52:45Z")

</div>

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](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](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

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [September 13, 2019, 8:21am UTC](https://discourse.mopidy.com/t/using-pip3-to-install-mopidy-extensions/3464/2 "2019-09-13T08:21:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mrkiperica](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/mrkiperica/32/1279_2.png) [@mrkiperica](https://discourse.mopidy.com/u/mrkiperica)\
**Post date:** [September 13, 2019, 9:05am UTC](https://discourse.mopidy.com/t/using-pip3-to-install-mopidy-extensions/3464/3 "2019-09-13T09:05:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [September 13, 2019, 9:31am UTC](https://discourse.mopidy.com/t/using-pip3-to-install-mopidy-extensions/3464/4 "2019-09-13T09:31:29Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![mrkiperica](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/mrkiperica/32/1279_2.png) [@mrkiperica](https://discourse.mopidy.com/u/mrkiperica)\
**Post date:** [September 13, 2019, 9:34am UTC](https://discourse.mopidy.com/t/using-pip3-to-install-mopidy-extensions/3464/5 "2019-09-13T09:34:23Z")

</div>

Understood. Thanks for your help.  
Peter.
