Multiple Python Errors - How to upgrade Python?

Hi
I am seeing a lot of Python errors in the information page of HA.
Ex,:

  • deps/lib/python3.6/site-packages/bluetooth/bluez.py (ERROR)
  • Setup of wemo is taking over 10 seconds.
    util/async_.py (WARNING)
  • components/mqtt/init.py (ERROR)
    etc.
    And I am getting the same error trying to setup Kodi Media Player

I am running in a Docker environment on Ubuntu 16.04
When I check the versions I get:
python -V
response: Python 2.7.12

python3 -V
response: Python 3.5.2

So it seems like I am off on my versions since the move towards Python 3.5.4 started from HA version .63

Has anyone ever done an upgrade in Ubuntu 16.04 with a Docker setup?
if so, is it as easy as issuing the command:
sudo apt-get install python3.6?

I also saw this tutorial online but it seem over complicated:
http://ubuntuhandbook.org/index.php/2017/07/install-python-3-6-1-in-ubuntu-16-04-lts/
Also just saw this warning, so may not proceed this way:

I also see a link in the forum that point to:

But I have no idea what a PPA is and surely don’t want to have the same mistake as ove and ending up with Version 3.6.5

If I install on my base Linux (Ubuntu) system will the version be picked up by the Home Assistant containers?
I have searched the board and didn’t really find an answer tha fits

Please share your experience.

What is the output of

apt-cache policy python3

That’s pretty weird…

I’m running Debian and it is showing Python 2.7.13 and 3.5.3
But if I run a console in the Home Assistant Docker Container it says Python is 3.6.6

So I am running Hassio… I thought one of the points of Docker is you don’t need to worry about this sort of thing as the image should have all the dependencies in it already and this is certainly what is happening on my system.

1 Like

@DavidFW1960
That’s what I thought as well and that was the allure to move to a Docker setup, thinking that all dependencies are within the container. I am hoping that finding a fix to this will at least get my bluetooth trackers working. How do you open up a console from within the container? Maybe I can check that as well.

@nickrout
The output that I am getting is:
python3:
Installed: 3.5.1-3
Candidate: 3.5.1-3
Version table:
*** 3.5.1-3 500
500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
100 /var/lib/dpkg/status

That’s a pretty cool command, didn’t know it existed. Seems like there are no candidates that I can pull to upgrade. Not sure if I upgrade my distro to 18.04 LTS if this would offer me more choices.

HOLD ON.

NO.

No. That would be completely AGAINST the idea behind Docker.

This is true.

You don’t need to do that, because the Docker image is your entire package. You don’t update things inside Docker.

Nothing you do OUTSIDE the Docker container is going to have any affect on the image running inside the container. You are barking up the wrong tree here. :wink:

@flamingm0e
So what is causing all these errors then? Why can’t I get bluetooth tracking working, and why can I just setup a simple Kodi Media Player? Seems like there is something else going on.

Did you enable the bluetooth device on your host OS?

Ubuntu server will not have the bluetooth packages installed and enabled by default and will not see a bluetooth device at all until you install bluez and enable it with bluetoothctl.

There is. You have an error initiating the mqtt, which makes me think you might have a config error.

@flamingm0e
That I know of, I never installed Bluez on my system, and if I issue this command, I get a reply back:
dpkg --status bluez | grep ‘^Version:’
Version: 5.37-0ubuntu5.1

Issuing: hcitool dev:
returns:
Devices:
hci0 00:01:A5:35:A0:D4
So it sees an adapter

But issuing: hcitool scan
Scanning …
Inquiry failed: Device or resource busy

So maybe I need to look into what’s causing this issue as it should return devices

But I am floored for the other issues, especially setting up something as easy as a Media Player.

try bluetoothctl status

bluetoothctl status

[NEW] Controller 00:01:A5:35:A0:D4 hassdocker [default]

sudo bluetoothctl

[bluetooth]# agent on

Then restart the container for home assistant.

Still “no Go”

Here is a more comprensive list of the errors:

  • 9:19 AM components/media_player/kodi.py (ERROR)
  • 9:19 AM components/zeroconf.py (ERROR)
  • 9:19 AM components/binary_sensor/isy994.py (ERROR)
  • 9:19 AM components/sensor/scrape.py (ERROR)
  • 9:19 AM components/recorder/util.py (ERROR) . (MySQL)
  • 9:20 AM deps/lib/python3.6/site-packages/bluetooth/bluez.py (ERROR)

I still may have a config issue somewhere, but for some reason it’s showing up as Python errors (in my mind anyway).

What does your REAL log say? Not the web GUI.

I need to cleanup some HTML scrapers that are not working as it’s polluting my log, but I do see some successful entries:

[homeassistant.components.mqtt] Transmitting message on mqtt/status: online
[homeassistant.components.device_tracker.bluetooth_tracker] Scanning F8:04:2E:E2:D7:E3
[homeassistant.components.device_tracker.bluetooth_tracker] Bluetooth devices discovered = 0
(this phone is away right now)

For Kodi, I get this message:
2018-10-04 09:19:03 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform kodi
Traceback (most recent call last):
File “/usr/src/app/homeassistant/helpers/entity_platform.py”, line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/usr/local/lib/python3.6/asyncio/coroutines.py”, line 212, in coro
res = func(*args, **kw)
File “/usr/src/app/homeassistant/components/media_player/kodi.py”, line 188, in async_setup_platform
ip_addr = socket.gethostbyname(host)
socket.gaierror: [Errno -2] Name or service not known

My Config for Kodi Media Player is:

  - platform: kodi
    host: 192. 168.XX.XXX
    enable_websocket: true
    username: !secret kodi_user
    password: !secret kodi_pass

Also failed to mention that for the bluetooth tracker, although it seems like it’s working from the log entry, I don’t have an entry in my known_devices.yaml for neither this phone or mine, and all my devices have "track: true: in this file. Nothing shows in my device page.

you have a space in between 192. and 168

Well that was a little stupid on my part … I looked at that config many times and couldn’t spot it.
So that fixed that issue, but still have all of my others. I will dive into the logs a little more after some cleanup

A lot of times when you have an error in your config, it will actually generate errors that seemingly have nothing to do with a particular device, because your config basically crashed during the load.