fangfufu / Linux-Fake-Background-Webcam

Faking your webcam background under GNU/Linux, now supports background blurring, animated background, colour map effect, hologram effect and on-demand processing.
GNU General Public License v3.0
1.61k stars 161 forks source link

Connnect call failed, Cannot connect to host 127.0.0.1:9000 #87

Closed filipejunqueira closed 3 years ago

filipejunqueira commented 3 years ago

Hi, sorry to troubleshoot this here but I can't seem to find what seems to be the issue with this. I have both akvcam and v4l2loopback installed. I get the same timeout message with eitherpython3 fake.pyor python3 fake.py --akvcam I'm somewhat new in the linux enviroment. With that said, I think for some reason I can't connect to the 127.0.0.1:9000 for some reason. I checked if 9000 is in use by sudo netstat -tulpn | grep LISTEN and I don't see port 9000 in the list.

Bellow is my output:

I'm getting the following message after running node app.js:

Found a GPU at /dev/nvidia0
2021-02-23 17:54:43.995884: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2021-02-23 17:54:44.042887: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3800185000 Hz
2021-02-23 17:54:44.043367: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5eef500 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2021-02-23 17:54:44.043379: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2021-02-23 17:54:44.048966: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2021-02-23 17:54:44.069206: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] 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-02-23 17:54:44.069572: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: 
name: GeForce GTX 1070 major: 6 minor: 1 memoryClockRate(GHz): 1.7085
pciBusID: 0000:0a:00.0
2021-02-23 17:54:44.069632: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcudart.so.10.0'; dlerror: libcudart.so.10.0: cannot open shared object file: No such file or directory
2021-02-23 17:54:44.069660: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcublas.so.10.0'; dlerror: libcublas.so.10.0: cannot open shared object file: No such file or directory
2021-02-23 17:54:44.069688: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcufft.so.10.0'; dlerror: libcufft.so.10.0: cannot open shared object file: No such file or directory
2021-02-23 17:54:44.069715: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcurand.so.10.0'; dlerror: libcurand.so.10.0: cannot open shared object file: No such file or directory
2021-02-23 17:54:44.069741: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcusolver.so.10.0'; dlerror: libcusolver.so.10.0: cannot open shared object file: No such file or directory
2021-02-23 17:54:44.069766: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcusparse.so.10.0'; dlerror: libcusparse.so.10.0: cannot open shared object file: No such file or directory
2021-02-23 17:54:44.069791: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcudnn.so.7'; dlerror: libcudnn.so.7: cannot open shared object file: No such file or directory
2021-02-23 17:54:44.069797: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1641] 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...
2021-02-23 17:54:44.128086: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-02-23 17:54:44.128109: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165]      0 
2021-02-23 17:54:44.128115: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0:   N 
Platform node has already been set. Overwriting the platform with [object Object].
/home/captainbroccoli/software/fake_background_cam/bodypix/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/engine.js:542
                out = _this.tidy(function () { return forwardFunc(_this.backend, saveFunc_1); });
                                                      ^

TypeError: forwardFunc is not a function
    at /home/captainbroccoli/software/fake_background_cam/bodypix/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/engine.js:542:55
    at /home/captainbroccoli/software/fake_background_cam/bodypix/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/engine.js:388:22
    at Engine.scopedRun (/home/captainbroccoli/software/fake_background_cam/bodypix/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/engine.js:398:23)
    at Engine.tidy (/home/captainbroccoli/software/fake_background_cam/bodypix/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/engine.js:387:21)
    at kernelFunc (/home/captainbroccoli/software/fake_background_cam/bodypix/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/engine.js:542:29)
    at /home/captainbroccoli/software/fake_background_cam/bodypix/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/engine.js:553:27
    at Engine.scopedRun (/home/captainbroccoli/software/fake_background_cam/bodypix/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/engine.js:398:23)
    at Engine.runKernelFunc (/home/captainbroccoli/software/fake_background_cam/bodypix/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/engine.js:551:14)
    at Engine.runKernel (/home/captainbroccoli/software/fake_background_cam/bodypix/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/engine.js:449:21)
    at pad_ (/home/captainbroccoli/software/fake_background_cam/bodypix/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:15179:19)

And I'm also getting the following message after running python3 fake.py:

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "fake.py", line 311, in mask_frame
    mask = await self._get_mask(frame, session)
  File "fake.py", line 184, in _get_mask
    async with session.post(
  File "/home/captainbroccoli/.local/lib/python3.8/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/home/captainbroccoli/.local/lib/python3.8/site-packages/aiohttp/client.py", line 480, in _request
    conn = await self._connector.connect(
  File "/home/captainbroccoli/.local/lib/python3.8/site-packages/aiohttp/connector.py", line 523, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/home/captainbroccoli/.local/lib/python3.8/site-packages/aiohttp/connector.py", line 858, in _create_connection
    _, proto = await self._create_direct_connection(
  File "/home/captainbroccoli/.local/lib/python3.8/site-packages/aiohttp/connector.py", line 1004, in _create_direct_connection
    raise last_exc
  File "/home/captainbroccoli/.local/lib/python3.8/site-packages/aiohttp/connector.py", line 980, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/home/captainbroccoli/.local/lib/python3.8/site-packages/aiohttp/connector.py", line 943, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 127.0.0.1:9000 ssl:default [Connect call failed ('127.0.0.1', 9000)]
Mask request failed, retrying: Cannot connect to host 127.0.0.1:9000 ssl:default [Connect call failed ('127.0.0.1', 9000)]
Traceback (most recent call last):
  File "/home/captainbroccoli/.local/lib/python3.8/site-packages/aiohttp/connector.py", line 936, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
  File "/home/captainbroccoli/anaconda3/envs/def38/lib/python3.8/asyncio/base_events.py", line 1025, in create_connection
    raise exceptions[0]
  File "/home/captainbroccoli/anaconda3/envs/def38/lib/python3.8/asyncio/base_events.py", line 1010, in create_connection
    sock = await self._connect_sock(
  File "/home/captainbroccoli/anaconda3/envs/def38/lib/python3.8/asyncio/base_events.py", line 924, in _connect_sock
    await self.sock_connect(sock, address)
  File "/home/captainbroccoli/anaconda3/envs/def38/lib/python3.8/asyncio/selector_events.py", line 494, in sock_connect
    return await fut
  File "/home/captainbroccoli/anaconda3/envs/def38/lib/python3.8/asyncio/selector_events.py", line 526, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 9000)
filipejunqueira commented 3 years ago

Just to clarify I get the output above repeatedly after running python3 fake.py.

mlyjones commented 3 years ago

I'm also getting the same errors as filipejunqueria

  1. "TypeError: forwardFunc is not a function" with node app.js
  2. "ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 9000)" with python3 fake.py

I have v4l2loopback installed, and have a 'video2' in /dev/

ejdrien commented 3 years ago

Same issue.

pezhore commented 3 years ago

I had the same issue - but fixed it by removing the node_modules folder under bodypix, then did a npm install.

It warned me that there were some fixes necessary, so I ran npm audit fix --force, and that seemed to fix the error.

mlyjones commented 3 years ago

@pezhore That worked!! Thank you so much!

fangfufu commented 3 years ago

I had the same issue - but fixed it by removing the node_modules folder under bodypix, then did a npm install.

It warned me that there were some fixes necessary, so I ran npm audit fix --force, and that seemed to fix the error.

Do you reckon this needs to be patched?

filipejunqueira commented 3 years ago

Hi @fangfufu I think it does (IMO). Without @pezhore comment I would still be stuck. I had no idea that was the problem and I'm still unsure of what really happenend, only that this worked! :-)

Aurifier commented 3 years ago

I had the same issue. I realized it was a tensor installation issue and tried npm install after removing node_modules, but I did not realize we needed the newest major versions of @tensorflow/tfjs, @tensorflow/tfjs-node-gpu, and @tensorflow/tfjs-node.

rahra commented 3 years ago

I had the same issue - but fixed it by removing the node_modules folder under bodypix, then did a npm install.

It warned me that there were some fixes necessary, so I ran npm audit fix --force, and that seemed to fix the error.

This definitely fixed the problem! Thanks! After this I successfully run it on Debian/Bullseye.

Just to clarify the subject of this thread since I think it is a little bit misleading. The socket connection of fake.py fails because the bodypix app fails and thus in turn closes the socket. So the primary error message is UnhandledPromiseRejectionWarning: TypeError: forwardFunc is not a function of bodypix because of some kind of version mismatch of Tensorflow in the node installation.

lawa42 commented 3 years ago

Can't this be fixed by simply updating the version string in bodypix/package.json

fangfufu commented 3 years ago

@lawa42 please suggest a patch.

ShayBox commented 3 years ago

Just update the dependencies in package.json... you don't need a patch file for that, just update the dependencies

https://github.com/fangfufu/Linux-Fake-Background-Webcam/blob/master/bodypix/package.json#L5-L7 Update them to the latest versions

fangfufu commented 3 years ago

@ShayBox to which version?

ShayBox commented 3 years ago

The latest versions. https://www.npmjs.com/search?q=tensorflow

fangfufu commented 3 years ago

@ShayBox , it is done. if it breaks, we know who to blame. ;)

ShayBox commented 3 years ago

It was broken already, that's the fix, The command npm audit fix --force just updates the dependencies to the latest ones without any reported security vulnerabilities

fangfufu commented 3 years ago

@ShayBox @lawa42 @filipejunqueira Please checkout the latest commit. I got rid off Bodypix. Node.js is no longer required.

lawa42 commented 3 years ago

Hi fangfufu, thanks for the recent update. It works like a charm with twice the frame rate. Excellent work