AndroidTv Component - could not install all requirements

I just updated to HA 0.90 and wanted to use the native androidtv component with my FireTv Stick. However, after adding the configuration in my yaml file:

media_player:
   - platform: androidtv
     name: "Fire_TV"
     host: "192.168.0.7"
     adb_server_ip: 127.0.0.1
     adb_server_port: 5037

I get this error in homeassistant.log:

 2019-03-24 11:04:43 ERROR (SyncWorker_3) [homeassistant.util.package] Unable to install package androidtv==0.0.12: Failed building wheel for pycryptodome
    python-jose-cryptodome 1.3.2 has requirement pycryptodome<3.4.0,>=3.3.1, but you'll have pycryptodome 3.8.0 which is incompatible.
    pyrebase4 4.3.0 has requirement oauth2client==4.1.2, but you'll have oauth2client 4.0.0 which is incompatible.
    broadlink 0.9 has requirement pycryptodome==3.4.11, but you'll have pycryptodome 3.8.0 which is incompatible.
    Command "/usr/local/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-vme9kee3/pycryptodome/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-record-ge7nkf6m/install-record.txt --single-version-externally-managed --prefix  --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-vme9kee3/pycryptodome/
    You are using pip version 19.0.2, however version 19.0.3 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
2019-03-24 11:04:43 ERROR (MainThread) [homeassistant.requirements] Not initializing androidtv.media_player because could not install requirement androidtv==0.0.12
2019-03-24 11:04:43 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform androidtv.media_player: Could not install all requirements.

I’m on Hassio using HA 0.90 and using the ADB - Android Debug Bridge Addon which connects just fine with my FireTV.

Any help appreciated!

I’ve seen this before, but I don’t know what the solution is. All I can suggest is to use this as a custom component.

Thanks for your response!
Are the custom component and the “build in” one the same? Or better: do both support FireTv?

Use the official component, but use it as a custom component. Copy this androidtv folder to <config>/custom_components/androidtv.

:man_facepalming:
okay, did this. However, this only brought me 2 more lines of “errors”:
2019-03-25 17:02:07 WARNING (MainThread) [homeassistant.loader] You are using a custom component for androidtv which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

  • 2019-03-25 17:02:07 WARNING (MainThread) [homeassistant.loader] You are using a custom component for androidtv.media_player which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.*
  • 2019-03-25 17:03:17 ERROR (SyncWorker_8) [homeassistant.util.package] Unable to install package androidtv==0.0.13: Failed building wheel for pycryptodome*
  • python-jose-cryptodome 1.3.2 has requirement pycryptodome<3.4.0,>=3.3.1, but you’ll have pycryptodome 3.8.0 which is incompatible.*
  • pyrebase4 4.3.0 has requirement oauth2client==4.1.2, but you’ll have oauth2client 4.0.0 which is incompatible.*
  • broadlink 0.9 has requirement pycryptodome==3.4.11, but you’ll have pycryptodome 3.8.0 which is incompatible.*
  • Command “/usr/local/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-install-00rbbgb2/pycryptodome/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-record-srfw5ehn/install-record.txt --single-version-externally-managed --prefix --compile --user --prefix=” failed with error code 1 in /tmp/pip-install-00rbbgb2/pycryptodome/*
  • You are using pip version 19.0.2, however version 19.0.3 is available.*
  • You should consider upgrading via the ‘pip install --upgrade pip’ command.*
  • 2019-03-25 17:03:17 ERROR (MainThread) [homeassistant.requirements] Not initializing androidtv.media_player because could not install requirement androidtv==0.0.13*
  • 2019-03-25 17:03:17 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform androidtv.media_player: Could not install all requirements.*

All I can think of is to install androidtv into a temporary folder on a different machine and copy the files to config/lib/python3.x/site-packages (fill in the path accordingly).

To install androidtv into the current folder, run pip3 install androidtv --target .

Are you referring to the config folder inside the home-assistant folder (the one I can access via smb)?

If yes, I placed all files there:

But the same error persists…

What does your custom_components folder look like?

Custom Components:

   core-ssh:/config/custom_components# ls
__pycache__        androidtv          custom_updater.py

androidtv:

 core-ssh:/config/custom_components/androidtv# ls
    __init__.py      __pycache__      media_player.py  services.yaml

For the record, I’m getting the exact same errors as @capstan1, with and without the files in custom_components. I’m running home assistant in a docker container on a ubuntu 18.04 box.

I’m just playing around with pip3 install in a different directory now…

You need to fill in the “x” in python3.x. If you’re using the latest Hass.io, it should be python3.7.

so i did

$ pip3.7 install androidtv
$ sudo mkdir -p /usr/share/hassio/homeassistant/lib/python3.7/site-packages/
$ sudo cp -r ~/.local/lib/python3.7/site-packages/ /usr/share/hassio/homeassistant/lib/python3.7/

And I get the same errors:

2019-03-26 20:11:03 ERROR (SyncWorker_4) [homeassistant.util.package] Unable to install package androidtv==0.0.13: Failed building wheel for pycryptodome
python-jose-cryptodome 1.3.2 has requirement pycryptodome<3.4.0,>=3.3.1, but you'll have pycryptodome 3.8.0 which is incompatible.
pyrebase4 4.3.0 has requirement oauth2client==4.1.2, but you'll have oauth2client 4.0.0 which is incompatible.
broadlink 0.9 has requirement pycryptodome==3.4.11, but you'll have pycryptodome 3.8.0 which is incompatible.
Command "/usr/local/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-acu14z3j/pycryptodome/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-record-93lpvtpg/install-record.txt --single-version-externally-managed --prefix  --co
mpile --user --prefix=" failed with error code 1 in /tmp/pip-install-acu14z3j/pycryptodome/
You are using pip version 19.0.2, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
2019-03-26 20:11:03 ERROR (MainThread) [homeassistant.requirements] Not initializing androidtv.media_player because could not install requirement androidtv==0.0.13
2019-03-26 20:11:03 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform androidtv.media_player: Could not install all requirements.

Just to check, my homeassistant container sees this:

bash-4.4# find /config/lib -maxdepth 3 -type d
/config/lib
/config/lib/python3.7
/config/lib/python3.7/site-packages
/config/lib/python3.7/site-packages/adb
/config/lib/python3.7/site-packages/pyasn1
/config/lib/python3.7/site-packages/__pycache__
/config/lib/python3.7/site-packages/rsa-4.0.dist-info
/config/lib/python3.7/site-packages/Crypto
/config/lib/python3.7/site-packages/androidtv
/config/lib/python3.7/site-packages/libusb1-1.7.dist-info
/config/lib/python3.7/site-packages/adb_homeassistant-1.3.1.dist-info
/config/lib/python3.7/site-packages/androidtv-0.0.13.dist-info
/config/lib/python3.7/site-packages/rsa
/config/lib/python3.7/site-packages/adb_messenger
/config/lib/python3.7/site-packages/usb1
/config/lib/python3.7/site-packages/pip
/config/lib/python3.7/site-packages/pip-19.0.3.dist-info
/config/lib/python3.7/site-packages/pycryptodome-3.8.0.dist-info
/config/lib/python3.7/site-packages/pyasn1-0.4.5.dist-info
/config/lib/python3.7/site-packages/pure_python_adb_homeassistant-0.1.6.dev0.dist-info

You also need to use androidtv as a custom component.

I think I do:

$ tree /usr/share/hassio/homeassistant/custom_components/androidtv
/usr/share/hassio/homeassistant/custom_components/androidtv
├── __init__.py
├── media_player.py
├── __pycache__
│   ├── __init__.cpython-37.pyc
│   └── media_player.cpython-37.pyc
└── services.yaml

1 directory, 5 files

I’m out of my depth here, but I think androidtv wants pycryptodome 3.8.0, and something else wants python-jose-pycryptodome, which wants pycryptodome 3.3.X. I guess I’ll see if I can figure out what that might be.

1 Like

Did this, but didn’t solve the error, neither…

I’m stumped as well.

First of all, as far as I understand, when using it as a custom component it should look for its dependencies in the deps folder of your configuration directory, so versions of packages installed elsewhere shouldn’t matter. Although maybe it still prioritizes HA’s import path before the deps/lib/python3.7/site-packages path…

Second, there was a pull request a while back about pycryptodome and how versions prior to 3.6.6 should not be allowed. I don’t know why androidtv installs successfully for some users and not others, but perhaps it’s worth creating an issue about this. For reference:

One thing that came to my mind, that maybe could cause the issue:
Before trying to use androidtv I had to do a fresh install of Hassio. This probably installed 0.90 or 0.89.
I then restored my previous snapshot done using 0.88.2. I updated to 0.90 and tried the native component.

Could this mess with the dependencies?

It’s possible, but I don’t see why it would.

However, I found that around 0.88 (give or take), HA’s handling of dependencies for custom components changed. Whereas it used to install them for me, I now had to install them myself by copying over the files from elsewhere. I don’t know if that’s related.

Anyways, this issue has me stumped. It says it failed to install androidtv, but if you did the aforementioned steps correctly then it shouldn’t need to install it – it’s right there, in the deps folder! All I can suggest is to make sure that all your paths are correct and that the custom component is being loaded. Try adding _LOGGER.critical("I am here!") statements to the custom component. You could add import androidtv and _LOGGER.critical(androidtv.__file__) to see where it imported androidtv from, and you could do the same for other packages.

I might be able to remove the pycryptodome requirement. I think that would fix it.

@JeffLirion, Can you confirm where the deps directory should be, from inside the docker container? Your earlier message made me think it should be /config/lib/python3.7/site-packages, but now you’ve said deps, I’m wondering if it should really be /config/deps/lib/python3.7/site-packages?