PIP modules not being installed with Docker


#1

Hi guys,

I’m fairly new to docker and have run into a brick wall with what seems like a simple task - PIP modules that are installed via a Docker file are not installed when I run the container, even though everything looks fine during the build process. The module in question is ‘websocket-client’.

blaster:~/.docker/samsungctl # cat Dockerfile

FROM python:3

RUN python3 -m pip install websocket-client && git clone https://github.com/kdschlosser/samsungctl.git /samsungctl

blaster:~/.docker/samsungctl # docker build --no-cache ~/.docker/samsungctl

Sending build context to Docker daemon 2.048kB

Step 1/2 : FROM python:3

---> 98281429ea18

Step 2/2 : RUN python3 -m pip install websocket-client && git clone https://github.com/kdschlosser/samsungctl.git /samsungctl

---> Running in 7a46dbc6f2ca

Collecting websocket-client

Downloading https://files.pythonhosted.org/packages/26/2d/f749a5c82f6192d77ed061a38e02001afcba55fe8477336d26a950ab17ce/websocket_client-0.54.0-py2.py3-none-any.whl (200kB)

Collecting six (from websocket-client)

Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl

Installing collected packages: six, websocket-client

Successfully installed six-1.12.0 websocket-client-0.54.0

You are using pip version 10.0.1, however version 18.1 is available.

You should consider upgrading via the 'pip install --upgrade pip' command.

Cloning into '/samsungctl'...

Removing intermediate container 7a46dbc6f2ca

---> 2aea07de01f3

Successfully built 2aea07de01f3

blaster:~/.docker/samsungctl # /storage/.kodi/addons/service.system.docker/bin/docker run -w /samsungctl samsungctl pip list

Package Version

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

pip 10.0.1

setuptools 39.1.0

wheel 0.31.0

You are using pip version 10.0.1, however version 18.1 is available.

You should consider upgrading via the 'pip install --upgrade pip' command.

blaster:~/.docker/samsungctl # /storage/.kodi/addons/service.system.docker/bin/docker run -w /samsungctl samsungctl python -m samsungctl --host 192.168.123.203 --port 8002 --method websocket KEY_HDMI

Traceback (most recent call last):

File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main

"__main__", mod_spec)

File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code

exec(code, run_globals)

File "/samsungctl/samsungctl/__main__.py", line 134, in <module>

main()

File "/samsungctl/samsungctl/__main__.py", line 112, in main

with Remote(config) as remote:

File "/samsungctl/samsungctl/remote.py", line 11, in __init__

self.remote = RemoteWebsocket(config)

File "/samsungctl/samsungctl/remote_websocket.py", line 13, in __init__

import websocket

ModuleNotFoundError: No module named 'websocket'

Not sure what the issue is and I haven’t been able to find much info via google.

Does anyone have any idea why the PIP module is not being installed?

Thanks in advance!


#2

While i am not familiar with docker or the pip program, i wm wondering if there is a resson why you are using an ancient version of this pip thingy?

I would start with updating as it’s suggesting


#3

Its what comes as standard. I have tried updating it but it makes no difference.