mrlt8 / docker-wyze-bridge

WebRTC/RTSP/RTMP/LL-HLS bridge for Wyze cams in a docker container
GNU Affero General Public License v3.0
2.58k stars 158 forks source link

Service 'wyzecam-bridge' failed to build av - Failed building wheel for av #6

Closed SomebodySysop closed 3 years ago

SomebodySysop commented 3 years ago

Fired up a new Ubuntu system, installed docker, docker-compose. git cloned wyze-bridge. Ran:

docker-compose up also tried: docker-compose up -d

It fails to build with error:

The command '/bin/sh -c pip3 install requests opencv-python av wyzecam' returned a non-zero code: 1

Also "Failed to build av"

Some steps I took to try and correct:

https://github.com/PyAV-Org/PyAV/issues/599 apt install ffmpeg

It was already installed the last time I installed wyze-bridge under Ubuntu

https://github.com/PyAV-Org/PyAV/issues/491 apt install libavdevice-dev libavfilter-dev

Same error.

Collecting typing-extensions>=3.7.4.3 Downloading typing_extensions-3.10.0.0-py3-none-any.whl (26 kB) Building wheels for collected packages: av, xxtea Building wheel for av (setup.py): started Building wheel for av (setup.py): finished with status 'error'

The following is what ends up mostly in red:

ERROR: Command errored out with exit status 1: command: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6ky4u2vd/av_07c572dcd644453d866be3cec4659c83/setup.py'"'"'; file='"'"'/tmp/pip-install-6ky4u2vd/av_07c572dcd644453d866be3cec4659c83/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-y_dz4yv7 cwd: /tmp/pip-install-6ky4u2vd/av_07c572dcd644453d866be3cec4659c83/ Complete output (29 lines): running bdist_wheel running build running build_py creating build creating build/lib.linux-aarch64-3.8 creating build/lib.linux-aarch64-3.8/av copying av/main.py -> build/lib.linux-aarch64-3.8/av copying av/deprecation.py -> build/lib.linux-aarch64-3.8/av copying av/datasets.py -> build/lib.linux-aarch64-3.8/av copying av/init.py -> build/lib.linux-aarch64-3.8/av creating build/lib.linux-aarch64-3.8/av/sidedata copying av/sidedata/init.py -> build/lib.linux-aarch64-3.8/av/sidedata creating build/lib.linux-aarch64-3.8/av/audio copying av/audio/init.py -> build/lib.linux-aarch64-3.8/av/audio creating build/lib.linux-aarch64-3.8/av/codec copying av/codec/init.py -> build/lib.linux-aarch64-3.8/av/codec creating build/lib.linux-aarch64-3.8/av/video copying av/video/init.py -> build/lib.linux-aarch64-3.8/av/video creating build/lib.linux-aarch64-3.8/av/container copying av/container/init.py -> build/lib.linux-aarch64-3.8/av/container creating build/lib.linux-aarch64-3.8/av/subtitles copying av/subtitles/init.py -> build/lib.linux-aarch64-3.8/av/subtitles creating build/lib.linux-aarch64-3.8/av/filter copying av/filter/init.py -> build/lib.linux-aarch64-3.8/av/filter creating build/lib.linux-aarch64-3.8/av/data copying av/data/init.py -> build/lib.linux-aarch64-3.8/av/data running build_ext running config pkg-config is required for building PyAV

ERROR: Failed building wheel for av Running setup.py clean for av Building wheel for xxtea (setup.py): started Building wheel for xxtea (setup.py): finished with status 'done' Created wheel for xxtea: filename=xxtea-2.0.0.post0-cp38-cp38-linux_aarch64.whl size=9780 sha256=102fe0b43f239d48461d0f442875ec0d2efaf90a186b38a09eaf6fbdf3653d8b Stored in directory: /root/.cache/pip/wheels/70/15/83/b38311486594aa7da569537839becbbd9245a49fb68b26be85 Successfully built xxtea Failed to build av Installing collected packages: typing-extensions, xxtea, urllib3, pydantic, numpy, idna, chardet, certifi, wyzecam, requests, opencv-python, av Running setup.py install for av: started Running setup.py install for av: finished with status 'error' ERROR: Command errored out with exit status 1: command: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6ky4u2vd/av_07c572dcd644453d866be3cec4659c83/setup.py'"'"'; file='"'"'/tmp/pip-install-6ky4u2vd/av_07c572dcd644453d866be3cec4659c83/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-hvfyu92d/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/av cwd: /tmp/pip-install-6ky4u2vd/av_07c572dcd644453d866be3cec4659c83/ Complete output (29 lines): running install running build running build_py creating build creating build/lib.linux-aarch64-3.8 creating build/lib.linux-aarch64-3.8/av copying av/main.py -> build/lib.linux-aarch64-3.8/av copying av/deprecation.py -> build/lib.linux-aarch64-3.8/av copying av/datasets.py -> build/lib.linux-aarch64-3.8/av copying av/init.py -> build/lib.linux-aarch64-3.8/av creating build/lib.linux-aarch64-3.8/av/sidedata copying av/sidedata/init.py -> build/lib.linux-aarch64-3.8/av/sidedata creating build/lib.linux-aarch64-3.8/av/audio copying av/audio/init.py -> build/lib.linux-aarch64-3.8/av/audio creating build/lib.linux-aarch64-3.8/av/codec copying av/codec/init.py -> build/lib.linux-aarch64-3.8/av/codec creating build/lib.linux-aarch64-3.8/av/video copying av/video/init.py -> build/lib.linux-aarch64-3.8/av/video creating build/lib.linux-aarch64-3.8/av/container copying av/container/init.py -> build/lib.linux-aarch64-3.8/av/container creating build/lib.linux-aarch64-3.8/av/subtitles copying av/subtitles/init.py -> build/lib.linux-aarch64-3.8/av/subtitles creating build/lib.linux-aarch64-3.8/av/filter copying av/filter/init.py -> build/lib.linux-aarch64-3.8/av/filter creating build/lib.linux-aarch64-3.8/av/data copying av/data/init.py -> build/lib.linux-aarch64-3.8/av/data running build_ext running config pkg-config is required for building PyAV

ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"

Then tried reinstall:

git reset --hard HEAD git pull docker-compose up --build --force-recreate --remove-orphans

Same errors.

What am I missing?

Distributor ID: Ubuntu Description: Ubuntu 21.04 Release: 21.04 Codename: hirsute Running on Raspberry P1 4

Was trying to build a wyze-bridge box!

mrlt8 commented 3 years ago

Raspberry Pi 4? Yeah, I had some issues with tutk for aarch64/arm64...

For now, it's only compatible with x64 systems.

SomebodySysop commented 3 years ago

Arrrrggghhh.... ThisClose!

OK, but in case it helps, I can install all those packages individually:

root@Raspberry-Ubuntu:/home/ron/docker/docker-wyze-bridge# pip3 install av Collecting av Using cached av-8.0.3-cp39-cp39-linux_aarch64.whl Installing collected packages: av Successfully installed av-8.0.3 root@Raspberry-Ubuntu:/home/ron/docker/docker-wyze-bridge# pip3 install opencv-python Collecting opencv-python Downloading opencv_python-4.5.2.54-cp39-cp39-manylinux2014_aarch64.whl (34.9 MB) |████████████████████████████████| 34.9 MB 31 kB/s Collecting numpy>=1.19.3 Downloading numpy-1.21.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.0 MB) |████████████████████████████████| 13.0 MB 10.7 MB/s Installing collected packages: numpy, opencv-python Successfully installed numpy-1.21.0 opencv-python-4.5.2.54

root@Raspberry-Ubuntu:/home/ron/docker/docker-wyze-bridge# pip3 install requests Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.25.1)

mrlt8 commented 3 years ago

I pushed a new dockerfile which removes opencv-python and av. That should clear up those errors, but we still need to get the tutk library for arm64/aarch64.

SomebodySysop commented 3 years ago

Yes, breezed through that error and only getting stuck on tutk. Thank you!

FYI, I am trying to get this running on Raspberry for two reasons:

1) It might provide an easier way to get noobs (like myself) to get a wyze-bridge rtsp streamer running inexpensively and relatively easily. I am actually documenting the steps in a video to assist folks to that end.

2) I have cameras in and outside my garage which are connected to a router in the garage which is connected to my home network via a wireless bridge. The wifi speed between home and garage is very slow. So I need a wyze-bridge box actually in the garage for the streaming from cameras to be usable.

Yes, I could just run an ethernet cable from the house to the garage, but I live in an apartment building and that creates a whole new set of problems.

mrlt8 commented 3 years ago

Hey @SomebodySysop I created a new arm64 branch that uses an armhf/arm32 base image since there is a working arm 32 bit tutk library.

SomebodySysop commented 3 years ago

Great news!

git question: I went to the branch and copied the uri, it's the same as the main branch. Will the install know which branch to install automatically?

Thanks so much for doing this!

SomebodySysop commented 3 years ago

OK, think I found how to do it:

root@Raspberry-Ubuntu:/home/ron/docker# git clone --branch arm64 https://github.com/mrlt8/docker-wyze-bridge.git Cloning into 'docker-wyze-bridge'... remote: Enumerating objects: 81, done. remote: Counting objects: 100% (81/81), done. remote: Compressing objects: 100% (69/69), done. remote: Total 81 (delta 27), reused 62 (delta 12), pack-reused 0 Receiving objects: 100% (81/81), 15.82 KiB | 1.58 MiB/s, done. Resolving deltas: 100% (27/27), done.

SomebodySysop commented 3 years ago

OK!

git clone --branch arm64 https://github.com/mrlt8/docker-wyze-bridge.git

docker-compose up

It builds the project branch and reports the following:

Creating rtsp-server ... done Creating wyze-bridge ... done Attaching to wyze-bridge, rtsp-server rtsp-server | 2021/07/01 17:59:29 I [0/0] rtsp-simple-server v0.16.3 rtsp-server | 2021/07/01 17:59:29 I [0/0] [RTSP] TCP listener opened on :8554 rtsp-server | 2021/07/01 17:59:29 I [0/0] [RTMP] listener opened on :1935 rtsp-server | 2021/07/01 17:59:29 I [0/0] [HLS] listener opened on :8888 wyze-bridge | STARTING ALL 4 CAMERAS wyze-bridge | 2021/07/01 17:59:30 [WyzeCam305] Starting Camera (WYZE_CAKP2JFUS) on 192.168.1.154... wyze-bridge | 2021/07/01 17:59:30 [WyzeCam304] Starting Camera (WYZE_CAKP2JFUS) on 192.168.1.211... wyze-bridge | 2021/07/01 17:59:30 [WyzeCam302] Starting Camera (WYZE_CAKP2JFUS) on 192.168.1.167... wyze-bridge | 2021/07/01 17:59:30 [WyzeCam303] Starting Camera (WYZE_CAKP2JFUS) on 192.168.1.190... wyze-bridge | 2021/07/01 17:59:32 [WyzeCam302] requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://auth-prod.api.wyze.com/user/login wyze-bridge | 2021/07/01 17:59:32 [WyzeCam302] Killing FFmpeg... wyze-bridge | 2021/07/01 17:59:33 [WyzeCam302] Starting Camera (WYZE_CAKP2JFUS) on 192.168.1.167... rtsp-server | 2021/07/01 17:59:50 I [0/0] [RTMP] [conn 172.18.0.3:39178] opened wyze-bridge | 2021/07/01 17:59:50 [WyzeCam302] Output #0, flv, to 'rtmp://rtsp-server:1935/wyzecam302': rtsp-server | 2021/07/01 17:59:50 I [1/0] [RTMP] [conn 172.18.0.3:39178] is publishing to path 'wyzecam302', 1 track rtsp-server | 2021/07/01 18:00:29 I [1/0] [RTMP] [conn 172.18.0.3:39180] opened wyze-bridge | 2021/07/01 18:00:29 [WyzeCam304] Output #0, flv, to 'rtmp://rtsp-server:1935/wyzecam304': rtsp-server | 2021/07/01 18:00:29 I [2/0] [RTMP] [conn 172.18.0.3:39180] is publishing to path 'wyzecam304', 1 track rtsp-server | 2021/07/01 18:00:35 I [2/0] [RTMP] [conn 172.18.0.3:39182] opened rtsp-server | 2021/07/01 18:00:35 I [3/0] [RTMP] [conn 172.18.0.3:39182] is publishing to path 'wyzecam303', 1 track wyze-bridge | 2021/07/01 18:00:35 [WyzeCam303] Output #0, flv, to 'rtmp://rtsp-server:1935/wyzecam303':

All cameras except one were connected. The one that wasn't connected is offline.

Inserted one of the Raspberry rtsp uris into VLC->media->open network stream

Works!

This is super cool! Thank you for this effort! I think a lot of people are going to find this very useful.

mrlt8 commented 3 years ago

Hey @SomebodySysop, I pushed a new update to the main branch.

You'll need to specify the arm library by adding dockerfile: Dockerfile.arm to the new docker-compose.yml:

    wyzecam-bridge:
        container_name: wyze-bridge
        restart: always
        build: 
            context: ./app
            dockerfile: Dockerfile.arm
        environment:
            - WYZE_EMAIL=
            - WYZE_PASSWORD=

Please let me know if you have any issues!

SomebodySysop commented 3 years ago

Got it! Do I still specify the branch in git clone command?

git clone --branch arm64 https://github.com/mrlt8/docker-wyze-bridge.git

mrlt8 commented 3 years ago

I merged it into the main branch, so you can just do a regular git clone.