Deep-Live-Cam icon indicating copy to clipboard operation
Deep-Live-Cam copied to clipboard

Error upon executing run.py

Open s2yao opened this issue 1 year ago • 6 comments

Whenever i run the run.py in vscode, the following error pops up:

** [Running] /usr/bin/env python3 "/Users/directory-to/Deep-Live-Cam/run.py" Traceback (most recent call last): File "/Users/directory-to/Deep-Live-Cam/run.py", line 3, in from modules import core File "/Users/directory-to/Deep-Live-Cam/modules/core.py", line 14, in import torch ModuleNotFoundError: No module named 'torch'

[Done] exited with code=1 in 0.078 seconds **

I suspect if its because I didn't install all the required libs sitting in ./requirement.txt

but when I try to install the libs and dependencies using the following line:

pip install --extra-index-url https://download.pytorch.org/whl/cu118 -r path/to/requirements.txt

it appears that I'm unable to install numpy, due to some version on python issue, the following error appears: ** Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu118, https://download.pytorch.org/whl/cu118 Ignoring torch: markers 'sys_platform != "darwin"' don't match your environment Ignoring torchvision: markers 'sys_platform != "darwin"' don't match your environment Ignoring onnxruntime: markers 'sys_platform == "darwin" and platform_machine != "arm64"' don't match your environment Ignoring onnxruntime-gpu: markers 'sys_platform != "darwin"' don't match your environment Ignoring tensorflow: markers 'sys_platform != "darwin"' don't match your environment Collecting numpy==1.23.5 (from -r ./requirements.txt (line 3)) Using cached numpy-1.23.5.tar.gz (10.7 MB) Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [33 lines of output] Traceback (most recent call last): File "/Users/name/env_pytorch/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in main() File "/Users/name/env_pytorch/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/name/env_pytorch/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel backend = _build_backend() ^^^^^^^^^^^^^^^^ File "/Users/name/env_pytorch/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend obj = import_module(mod_path) ^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1310, in _find_and_load_unlocked File "", line 488, in _call_with_frames_removed File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "/private/var/folders/9l/2vtltm696wb3fcpjqjt1c5cm0000gn/T/pip-build-env-3sl4ybsv/overlay/lib/python3.12/site-packages/setuptools/init.py", line 16, in import setuptools.version File "/private/var/folders/9l/2vtltm696wb3fcpjqjt1c5cm0000gn/T/pip-build-env-3sl4ybsv/overlay/lib/python3.12/site-packages/setuptools/version.py", line 1, in import pkg_resources File "/private/var/folders/9l/2vtltm696wb3fcpjqjt1c5cm0000gn/T/pip-build-env-3sl4ybsv/overlay/lib/python3.12/site-packages/pkg_resources/init.py", line 2172, in register_finder(pkgutil.ImpImporter, find_on_path) ^^^^^^^^^^^^^^^^^^^ AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'? [end of output]

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

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.**

i have checked the version of python, its 3.8

I have tried installing numpy separately, same problem pops up

thank you

s2yao avatar Aug 30 '24 05:08 s2yao

Can you try using a virtual environment?

MYusufY avatar Aug 30 '24 05:08 MYusufY

pip install --upgrade setuptools

duhow avatar Aug 30 '24 07:08 duhow

pip install --upgrade setuptools

still doesn't work :(((, same error comes up saying that everything "doesn't match my environment"

s2yao avatar Aug 31 '24 10:08 s2yao

Can you try using a virtual environment?

how do I do that?

s2yao avatar Aug 31 '24 10:08 s2yao

Can you try using a virtual environment?

how do I do that?

python3 -m venv my_venv to create a virtual environment. Then: source my_venv/bin/activate to activate your virtual environment.

And then you can try to install using pip :)

MYusufY avatar Aug 31 '24 10:08 MYusufY

Can you try using a virtual environment?

how do I do that?

python3 -m venv my_venv to create a virtual environment. Then: source my_venv/bin/activate to activate your virtual environment.

And then you can try to install using pip :)

Just did that, I did "successfully" downloaded all of them:

** pip install --extra-index-url https://download.pytorch.org/whl/cu118 -r ./requirements.txt Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu118, https://download.pytorch.org/whl/cu118 Ignoring torch: markers 'sys_platform != "darwin"' don't match your environment Ignoring torchvision: markers 'sys_platform != "darwin"' don't match your environment Ignoring onnxruntime: markers 'sys_platform == "darwin" and platform_machine != "arm64"' don't match your environment Ignoring onnxruntime-gpu: markers 'sys_platform != "darwin"' don't match your environment Ignoring tensorflow: markers 'sys_platform != "darwin"' don't match your environment Requirement already satisfied: numpy==1.23.5 in /Users/env_pytorch/lib/python3.8/site-packages (from -r ./requirements.txt (line 3)) (1.23.5) Collecting opencv-python==4.8.1.78 (from -r ./requirements.txt (line 4)) Using cached opencv_python-4.8.1.78-cp37-abi3-macosx_11_0_arm64.whl.metadata (19 kB) Collecting onnx==1.16.0 (from -r ./requirements.txt (line 5)) Using cached onnx-1.16.0-cp38-cp38-macosx_10_15_universal2.whl.metadata (16 kB) Collecting insightface==0.7.3 (from -r ./requirements.txt (line 6)) Using cached insightface-0.7.3.tar.gz (439 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting psutil==5.9.8 (from -r ./requirements.txt (line 7)) Using cached psutil-5.9.8-cp38-abi3-macosx_11_0_arm64.whl.metadata (21 kB) Collecting tk==0.1.0 (from -r ./requirements.txt (line 8)) Using cached tk-0.1.0-py3-none-any.whl.metadata (693 bytes) Collecting customtkinter==5.2.2 (from -r ./requirements.txt (line 9)) Using cached customtkinter-5.2.2-py3-none-any.whl.metadata (677 bytes) Collecting pillow==9.5.0 (from -r ./requirements.txt (line 10)) Using cached Pillow-9.5.0-cp38-cp38-macosx_11_0_arm64.whl.metadata (9.5 kB) Collecting torch==2.0.1 (from -r ./requirements.txt (line 12)) Using cached torch-2.0.1-cp38-none-macosx_11_0_arm64.whl.metadata (23 kB) Collecting torchvision==0.15.2 (from -r ./requirements.txt (line 14)) Using cached torchvision-0.15.2-cp38-cp38-macosx_11_0_arm64.whl.metadata (11 kB) ERROR: Could not find a version that satisfies the requirement onnxruntime-silicon==1.16.3 (from versions: 1.11.1, 1.13.1, 1.14.1, 1.15.0, 1.16.0) ERROR: No matching distribution found for onnxruntime-silicon==1.16.3 **

As you can see, onnxruntime-silicon is not downloaded properly so I did:

** pip install onnxruntime-silicon==1.16.0 **

And now, things should be correct, but the same error arises [sad face :( ]

I tried running the run.py, in the output it still gives me:

[Running] /usr/bin/env python3 "/Users/Deep-Live-Cam/run.py" Traceback (most recent call last): File "/Users/Deep-Live-Cam/run.py", line 3, in from modules import core File "/Users/Deep-Live-Cam/modules/core.py", line 14, in import torch ModuleNotFoundError: No module named 'torch'

[Done] exited with code=1 in 0.072 seconds

Which is the same issue at the beginning -- before I tried to download everything from requirement.txt which arises another problem thats apparently been "fixed"

Thank you so much for everyone's help, from the bottom of my heart

s2yao avatar Aug 31 '24 10:08 s2yao

A module that was compiled using NumPy 1.x cannot be run in NumPy 2.2.5 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last): File "J:\SOFTWARES\AI\NEW AI TOOLS\Deep-Live-Cam\run.py", line 3, in from modules import core File "J:\SOFTWARES\AI\NEW AI TOOLS\Deep-Live-Cam\modules\core.py", line 15, in import onnxruntime File "J:\SOFTWARES\AI\NEW AI TOOLS\Deep-Live-Cam\venv\lib\site-packages\onnxruntime_init_.py", line 23, in from onnxruntime.capi._pybind_state import ExecutionMode # noqa: F401 File "J:\SOFTWARES\AI\NEW AI TOOLS\Deep-Live-Cam\venv\lib\site-packages\onnxruntime\capi_pybind_state.py", line 33, in from .onnxruntime_pybind11_state import * # noqa AttributeError: _ARRAY_API not found ImportError: numpy.core.multiarray failed to import

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

SystemError: returned a result with an exception set Traceback (most recent call last): File "J:\SOFTWARES\AI\NEW AI TOOLS\Deep-Live-Cam\run.py", line 3, in from modules import core File "J:\SOFTWARES\AI\NEW AI TOOLS\Deep-Live-Cam\modules\core.py", line 16, in import tensorflow ModuleNotFoundError: No module named 'tensorflow'

still getting this how do I fix it ? non coding guy here please help

Yoktavya1990 avatar May 05 '25 10:05 Yoktavya1990