allo-/virtual_webcam_background

does unfortunately not work with debian 11

damnms opened this issue · 13 comments

see pypa/pip#9284 (comment)

had to modify the requirements.txt because debian 11 ships python 3.9. tensorflow requires the latest version available to have python 3.9 support

allo- commented

The problem seems to be a dependency from tfjs-graph-converter to tensorflow which is not satisfied by tf-nightly.

Can you try if you're able to install tfjs-graph-converter and possibly report a bug there? I guess they just need to change their dependencies to allow tensorflow or tf-nightly

allo- commented

The problem seems to go deeper, probably one needs to patch tensorflowjs.

Do you know the timeline for tensorflow to release a python3.9 version? Or can the tf-nightly version be built with the name tensorflow? I tried hacking some things in the tf-nightly metadata to make it appear like tensorflow and got a lot of other dependency problems, for example, pip downloading ten versions of pygments to check which one may be compatible.

The other, probably easier, option: create an environment with python3.8. I don't know what's the best way. The easiest may be a debian stable chroot, but tools like conda exist as well. When you do something like this, I would appreciate when you can add what worked for you to this issue.

i am not familiar with python, so there is no "hacking" for me ;)
i'll see if i can get a 3.8 working on debian 11

allo- commented

I tried copying around and renaming things in a the virtual environment. Don't bother, it only complicates things.
I wonder why Debian isn't packaging 3.8 anymore, when there are still important modules not available.
Probably there will be backports for py3.8 by someone.

i was able to install python 3.8 on debian, but no idea how i should now continue.
i copied pip to pip3.8 and modified it to:

oli@lucy:~$ cat /usr/local/bin/pip3.8 
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal.cli.main import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

but when i try to start it i get:

oli@lucy:~$ pip3.8
Traceback (most recent call last):
  File "/usr/local/bin/pip3.8", line 5, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'

not sure if i can use that python3.8 without pip for virtual_webcam_background

to install python 3.8

echo "deb  https://snapshot.debian.org/archive/debian/20201014T211806Z/ bullseye main" >> /etc/apt/sources.list
apt-get -o Acquire::Check-Valid-Until=false install python3.8

a docker (or better podman) image would be awesome, then there is no hassle with debian 11 or at least a nice workaround

allo- commented

How to install python3.8:

Compile python 3.8.2 like in this howto: https://linuxize.com/post/how-to-install-python-3-8-on-debian-10/

I chose to install it into a different prefix instead of using the altinstall into /usr/local

./configure --enable-optimizations --prefix=/opt/python3.8.2
make install # Installs into /opt/python3.8.2

Now you need to get virtualenv to use your new pip. I installed virtualenv into my $HOME:

/opt/python3.8.2/bin/pip install virtualenv

And created a python3.8 environment:

~/.local/bin/virtualenv -p /opt/python3.8.2/bin/python3.8 my_venv

Now you should be able to install the packages from requirements.txt into the virtual environment and use it to run the virtual webcam script.

great, i'll try that later!

but would be still awesome to have this running in podman too ;)
maybe i create a feature request or even try it by myself when i get python3.8 running

allo- commented

I likely won't create podman/docker containers, but I guess some people would be interested when you build one.
It's probably not too hard as it should be easy to find LTS distributions with python3.8 and maybe even some with CUDA (I am not sure about how this works with the CUDA license, though).

thanks, i am a bit further now

(my_venv) oli@lucy:~/Downloads/virtual_webcam_background-master$ ./virtual_webcam.py 
2021-03-22 12:52:01.843008: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2021-03-22 12:52:01.843029: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Reloading config.
2021-03-22 12:52:02.534032: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcuda.so.1
2021-03-22 12:52:02.560449: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-03-22 12:52:02.560836: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties: 
pciBusID: 0000:0a:00.0 name: GeForce GTX 1080 Ti computeCapability: 6.1
coreClock: 1.683GHz coreCount: 28 deviceMemorySize: 10.91GiB deviceMemoryBandwidth: 451.17GiB/s
2021-03-22 12:52:02.560887: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2021-03-22 12:52:02.560915: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcublas.so.10'; dlerror: libcublas.so.10: cannot open shared object file: No such file or directory
2021-03-22 12:52:02.561522: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcufft.so.10
2021-03-22 12:52:02.561831: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcurand.so.10
2021-03-22 12:52:02.561862: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcusolver.so.10'; dlerror: libcusolver.so.10: cannot open shared object file: No such file or directory
2021-03-22 12:52:02.561888: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcusparse.so.10'; dlerror: libcusparse.so.10: cannot open shared object file: No such file or directory
2021-03-22 12:52:02.561914: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudnn.so.7'; dlerror: libcudnn.so.7: cannot open shared object file: No such file or directory
2021-03-22 12:52:02.561919: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1753] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
Failed to reduce capture buffer size. Latency will be higher!
Traceback (most recent call last):
  File "./virtual_webcam.py", line 101, in <module>
    fakewebcam = FakeWebcam(config.get("virtual_video_device"), width, height)
  File "/home/oli/my_venv/lib/python3.8/site-packages/pyfakewebcam/pyfakewebcam.py", line 54, in __init__
    fcntl.ioctl(self._video_device, _v4l2.VIDIOC_S_FMT, self._settings)
OSError: [Errno 22] Invalid argument
(my_venv) oli@lucy:~/Downloads/virtual_webcam_background-master$ 

that it complains about gpu/cuda is i guess irrelevant, so wondering whats wrong

i have /dev/video0 /dev/video1 and /dev/video2 (last one created by modprobe v4l2loopback)
or is it required to have cuda support (i'll for sure use it later but atm just wanted to get it starting)

allo- commented

You're probably not using the right devices. I guess you need to use video0 as real device and video2 as fake device or maybe video1 as real device, I don't know why cameras create two devices and for my camera only the first one works.

great, had to use:
virtual_video_device: "/dev/video2"
real_video_device: "/dev/video0"

allo- commented

I currently load the loopback driver before plugging in the webcam (as I plug it out when I don't use it) so it is always video0, but maybe the docs should be updated to use a high number (e.g. /dev/video10) so it is always the same even the camera devices are there before loading the loopback driver.