openlumi / homeassistant_on_openwrt

Install Home Assistant on your OpenWrt device with a single command
MIT License
157 stars 43 forks source link

script fails at install of "frozenlist-1.3.3" package using pip #28

Closed littleboot closed 1 year ago

littleboot commented 1 year ago

The script fails when it tries to install the frozenlist package using pip. The cause of this problem is that frozenlist-1.3.3 tries to install using "Accelerated build" which is looking for the gcc compiler which is not installed. script output:

Collecting frozenlist>=1.1.1
  Downloading frozenlist-1.3.3.tar.gz (66 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.6/66.6 kB 4.1 MB/s eta 0:00:00
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 2
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  Installing build dependencies ... error
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 2
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

FIX: I have found 2 possible solutions for this problem: Option 1. Patch "setup.py" to force a pure python install:

cd /tmp
wget https://files.pythonhosted.org/packages/e9/10/d629476346112b85c912527b9080944fd2c39a816c2225413dbc0bb6fcc0/frozenlist-1.3.3.tar.gz -O - > frozenlist-1.3.3.tar.gz
tar -zxf frozenlist-1.3.3.tar.gz
cd frozenlist-1.3.3
sed -i 's/if NO_EXTENSIONS:/if 1:/' setup.py
pip3 install --no-cache-dir --no-dependencies .
pip3 install --no-cache-dir --no-dependencies aiosignal
pip3 install --no-cache-dir --no-dependencies charset-normalizer

Option 2. Install gcc so the accelerated build install is possible This will work but the gcc ipk file is very big ~40MB. It can be removed after installing frozenlist.

opkg install gcc
pip3 install --no-cache-dir --no-dependencies frozenlist
pip3 install --no-cache-dir --no-dependencies aiosignal
pip3 install --no-cache-dir --no-dependencies charset-normalizer
opkg remove gcc

Hardware WG1608 - ZBT Dual band WiFi router, 1x WAN, 4x LAN, 1x USB 3.0, 1x SIM, 1x microSDXC, 1x M-PCIE, 1x M.2 RAM: 512MB DDR3
Flash: 32MB (SPI Flash) MT7621A - MediaTek: MIPS 1004Kc @880MHz 2C/4T (Dual Core/Quad Thread) Aliexpress product page

Software Custom build of OpenWrt master branch for my target hardware (>2022.03.02). Why, because of the numpy requirement for homeassistant I needed to compile my own openwrt image and ipk package of numpy with SOFT_FLOAT (target options) disabled so numpy can be selected inside the menuconfig for compilation. To make numpy work Floating Point emulation needs to be enabled in the kernel_menuconfig this is why a custom openWrt image was required for me to get homeassistant working. (Note because of the custom kernel all required packages need to be recompiled, packages downloaded from the openwrt feeds will not work.

littleboot commented 1 year ago

I modified my post above so the fix is complete. Here is why: After frozenlist is installed the script fails again, because pip is checking for dependencies and gives an error:

Successfully built frozenlist
Installing collected packages: frozenlist
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
aiohttp 3.8.3 requires aiosignal>=1.1.2, which is not installed.
aiohttp 3.8.3 requires charset-normalizer<3.0,>=2.0, which is not installed.

These missing dependencies need to be installed, but the error message needs to be suppressed else it will break the install

devbis commented 1 year ago

frozenlist is not mentioned in the homeassistant code. Of what component is this dependency?

It seems that your aiohttp was upgraded from the version in OpenWrt. The pkg version if 3.7.4. Which package is the culprit?