Skip to content

Instantly share code, notes, and snippets.

@xenogenesi
Last active February 19, 2025 16:13
Show Gist options
  • Save xenogenesi/e62d3d13dadbc164124c830e9c453668 to your computer and use it in GitHub Desktop.
Save xenogenesi/e62d3d13dadbc164124c830e9c453668 to your computer and use it in GitHub Desktop.
Docker file for Wav2Lip
# Ignore everything
**
# Allow files and directories
!/audio.py
!/Dockerfile
!/hparams.py
!/preprocess.py
!/checkpoints/
!/evaluation/
!/hq_wav2lip_train.py
!/README.md
!/temp/
!/color_syncnet_train.py
!/face_detection/
!/inference.py
!/requirements.txt
!/filelists/
!/models/
!/results/
!/wav2lip_train.py
# Ignore unnecessary files inside allowed directories
# This should go after the allowed directories
**/*~
**/*.log
**/.DS_Store
**/Thumbs.db
# 1. install a version of docker with gpu support (docker-ce >= 19.03)
# 2. enter the project directory and build the wav2lip image:
# docker build -t wav2lip .
# 3. allow root user to connect to the display
# xhost +local:root
# 4. instantiate the container
# docker run --rm --gpus all -v /tmp/.X11-unix:/tmp/.X11-unix -v $PWD:/workspace/src -e DISPLAY=$DISPLAY --device /dev/dri -ti wav2lip bash
# NOTES:
# export CUDA_VISIBLE_DEVICES="" ## force cpu only
# Based on https://github.com/1adrianb/face-alignment/blob/master/Dockerfile
FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04
RUN export DEBIAN_FRONTEND=noninteractive RUNLEVEL=1 ; \
apt-get update && apt-get install -y --no-install-recommends \
build-essential cmake git curl ca-certificates \
vim \
python3-pip python3-dev python3-wheel \
libglib2.0-0 libxrender1 python3-soundfile \
ffmpeg && \
rm -rf /var/lib/apt/lists/* && \
pip3 install --upgrade setuptools
# RUN curl -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
# chmod +x ~/miniconda.sh && \
# ~/miniconda.sh -b -p /opt/conda && \
# rm ~/miniconda.sh
# ENV PATH /opt/conda/bin:$PATH
# RUN conda config --set always_yes yes --set changeps1 no && conda update -q conda
# RUN conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
# # Install Wav2Lip package
# # NOTE we use the git clone to install the requirements only once
# # (if we use COPY it will invalidate the cache and reinstall the dependencies for every change in the sources)
WORKDIR /workspace
RUN chmod -R a+w /workspace
RUN git clone https://github.com/Rudrabha/Wav2Lip
WORKDIR /workspace/Wav2Lip
RUN pip3 install -r requirements.txt
RUN mkdir -p /root/.cache/torch/checkpoints && \
curl -SL -o /root/.cache/torch/checkpoints/s3fd-619a316812.pth "https://www.adrianbulat.com/downloads/python-fan/s3fd-619a316812.pth"
# !!! NOTE !!! nvidia-driver version must match the version installed on the host(/docker server)
RUN export DEBIAN_FRONTEND=noninteractive RUNLEVEL=1 ; \
apt-get update && apt-get install -y --no-install-recommends \
nvidia-driver-450 mesa-utils && \
rm -rf /var/lib/apt/lists/*
# create the working directory, to be mounted with the bind option
RUN mkdir /workspace/src
WORKDIR /workspace/src
@rudolfKischer
Copy link

The base image FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04 seems to be deprecated. Any pre-built image ready to run available?

Did any find a resolution for this?

I am having some issues trying to use newer base images

@slopcop
Copy link

slopcop commented Dec 13, 2023

Having issues with the regular conda dev too. Maybe some dependency stuff?

@vido89
Copy link

vido89 commented Feb 17, 2025

Hi there!
Im on Mint 22.1 and Im facing with this error

Step 1/11 : FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04
manifest for nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04 not found: manifest unknown: manifest unknown

So with which version should I replace cuda:10.1-cudnn7-devel-ubuntu18.04 in docker Im not familiar with it ?
Tnx

@xenogenesi
Copy link
Author

Hi there! Im on Mint 22.1 and Im facing with this error

Step 1/11 : FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04
manifest for nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04 not found: manifest unknown: manifest unknown

So with which version should I replace cuda:10.1-cudnn7-devel-ubuntu18.04 in docker Im not familiar with it ? Tnx

It depends on several factors: the PC architecture and graphics card, the NVIDIA driver version. (I haven't used Docker with NVIDIA or Wav2Lip for a long time. I mainly use Conda, but I'm not sure if it works with Wav2Lip, I've never tried. Aside from giving you a couple of links I wouldn't know how to help you)

https://docs.nvidia.com/deeplearning/cudnn/backend/latest/reference/support-matrix.html
https://nvidia.github.io/container-wiki/toolkit/container-images.html
https://hub.docker.com/r/nvidia/cuda/

Good luck

@vido89
Copy link

vido89 commented Feb 17, 2025

Hi @xenogenesi tnx for quick reply I installed Docker CE (a.k.a Docker Engine) and finally got the sexy output:
sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi

Mon Feb 17 15:18:49 2025       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.120                Driver Version: 550.120        CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 750 Ti      Off |   00000000:05:00.0  On |                  N/A |
| 34%   31C    P8              1W /   38W |     298MiB /   2048MiB |     12%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
+-----------------------------------------------------------------------------------------+

so when I run sudo docker build -t wav2lip . Im getting

RROR: failed to solve: nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04: failed to resolve source metadata for docker.io/nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04: docker.io/nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04: not found

@xenogenesi
Copy link
Author

xenogenesi commented Feb 17, 2025

Hi @vido89

so, your setup is:

gtx 750 ti
gpu arch: maxwell
CUDA (compute capability of the gpu): 5.0
installed driver: 550.120
cuda installed libs: 12.4

Looking at the matrix link I think you should be able to use you gpu, but I see only nvidia docker images for cuda libs >= 12.8, and I think you need to match that on your host (not sure). Once you got 12.8 on your system just change the link in the Dockerfile with one from the nvidia site (eg: 12.8.0-cudnn-devel-ubuntu24.04). I don't even know if you need the devel version, maybe the runtime is enough.

@xenogenesi
Copy link
Author

@vido89

nvidia also have some unsupported images, but the 12.4 need cudnn8 and I don't think you can get it working with your driver version (not sure about that either)

https://gitlab.com/nvidia/container-images/cuda/blob/master/doc/unsupported-tags.md

@vido89
Copy link

vido89 commented Feb 17, 2025

Hi @xenogenesi OK tnx for the tip I updated cuda, but now Im facing this error

1816.1 ERROR: Cannot install -r requirements.txt (line 1), -r requirements.txt (line 4) and numpy==1.17.1 because these package versions have conflicting dependencies.
1816.1 
1816.1 The conflict is caused by:
1816.1     The user requested numpy==1.17.1
1816.1     librosa 0.7.0 depends on numpy>=1.15.0
1816.1     opencv-python 4.10.0.82 depends on numpy>=1.17.0; python_version >= "3.7"
1816.1     opencv-python 4.10.0.82 depends on numpy>=1.17.3; python_version >= "3.8"
1816.1 
1816.1 To fix this you could try to:
1816.1 1. loosen the range of package versions you've specified
1816.1 2. remove package versions to allow pip attempt to solve the dependency conflict
1816.1 
1816.1 ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
------
Dockerfile:46

@xenogenesi
Copy link
Author

xenogenesi commented Feb 17, 2025

@vido89

Have you seen/tried this?

I had to add RUN pip3 install --upgrade pip to the docker file just before RUN pip3 install -r requirements.txt to get it to install the requirements correctly

You may also need to change nvidia-driver-450 on line 54, not sure with what version, nvidia-driver only (the latest) or a specific version

@vido89
Copy link

vido89 commented Feb 17, 2025

@xenogenesi I saw that but I totally forgot about it tnx for pointing it out for me. Ok I added RUN pip3 install --upgrade pip before RUN pip3 install -r requirements.txt to docker file. And I replaced nvidia-driver-450 with nvidia-driver-550, how do I clear "chache" from docker work place Im uptating requirements.txt in /var/lib/docker/overlay2/l/VU7YL3WYJAON6BBFKDT3QKWZQZ/workspace/Wav2Lip/requirements.txt ? I did not add [pre-trained model] in to face_detection/detection/sfd/s3fd.pth ?
Edit: Now Im getting

ERROR: Could not find a version that satisfies the requirement opencv-python==4.1.2.30 (from versions: 3.4.0.14, 3.4.10.37, 3.4.11.41, 3.4.11.43, 3.4.11.45, 3.4.13.47, 3.4.15.55, 3.4.16.57, 3.4.16.59, 3.4.17.63, 3.4.18.65, 4.3.0.38, 4.4.0.40, 4.4.0.46, 4.5.1.48, 4.5.3.56, 4.5.4.60, 4.5.5.64, 4.6.0.66, 4.7.0.72, 4.8.0.74, 4.8.0.76, 4.8.1.78, 4.9.0.80, 4.10.0.82, 4.10.0.84, 4.11.0.86)
13.27 ERROR: No matching distribution found for opencv-python==4.1.2.30

@xenogenesi
Copy link
Author

xenogenesi commented Feb 17, 2025

@vido89
docker build should have an option to ignore the cache --no-cache.

ERROR: Could not find a version that satisfies the requirement opencv-python==4.1.2.30

I see two options but both annoying

  1. test and eventually fix (if needed) Wav2Lip to support 4.3.0.38 (the next nearest supported release, but being 4.1 -> 4.3 will have api compatibility breaks I guess)
  2. you could try to install some specific version of conda/python3 which supports that version of opencv-python (don't know if there's one nor how to check)

https://docs.anaconda.com/miniconda/install/#quick-command-line-install (see "To download an older version)
https://repo.anaconda.com/miniconda/

and then replace the line with Miniconda3-latest-Linux-x86_64.sh

@xenogenesi
Copy link
Author

xenogenesi commented Feb 17, 2025

@vido89 , I think you should try this one: Miniconda3-py38_23.11.0-2-Linux-x86_64.sh

python 3.8, miniconda 23.11.0-2 (3.6 and 3.7 should also support opencv-python==4.1.2.30)

@vido89
Copy link

vido89 commented Feb 18, 2025

@xenogenesi Ok so it should go like this

mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-py38_23.11.0-2-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm ~/miniconda3/miniconda.sh

After installing, close and reopen your terminal application or refresh it by running the following command:
source ~/miniconda3/bin/activate
then
conda init --all

But are you sure that I need Miniconda3-py38_23.11.0-2-Linux-x86_64.sh should that be py36 ?

Edit: I need
librosa==0.7.0
numpy==1.17.1
opencv-contrib-python>=4.2.0.34
opencv-python==4.1.0.25
torch==1.1.0
torchvision==0.3.0
tqdm==4.45.0
numba==0.48

Edit:2
How will docker "see" opencv-python==4.1.0.25 from conda ? Should I install conda "in side of docker" ?

@xenogenesi
Copy link
Author

@vido89 I suggested 3.8 because is the most recent version, but 3.6 and 3.7 should support the opencv package too.

You know, I didn't notice that the miniconda section is commented out, before proceeding with conda you might want to consider if miniconda is the best option to install and run python3.[6-8] on that nvidia/ubuntu docker image, might be there's some ppa? or build it from sources? install some prepackaged binary?

If you proceed using conda I think you can avoid to install python stuff with apt-get (python3-pip python3-dev python3-wheel python3-soundfile) but need to understand how to install the corresponding packages using pip in your Dockerfile after conda python3.x is installed and running,
the commented ENV line 34 should avoid the need for calling activate (I guess, never tested), also I don't think conda init --all is needed, only to initialize available shells

line 36 conda commands looks useful too, to config the installed conda, keep the standard prompt and update the installed conda

so it should be:

RUN curl -o ~/miniconda.sh -O  https://repo.anaconda.com/miniconda/Miniconda3-py38_23.11.0-2-Linux-x86_64.sh  && \
     chmod +x ~/miniconda.sh && \
     ~/miniconda.sh -b -p /opt/conda && \
     rm ~/miniconda.sh

ENV PATH /opt/conda/bin:$PATH

RUN conda config --set always_yes yes --set changeps1 no && conda update -q conda

# RUN pip install the python packages that were installed with apt-get ...

I don't think you need to uncomment the conda pytorch install line, I guess Wav2Lip install what it needs from the requirements file

@vido89
Copy link

vido89 commented Feb 18, 2025

@xenogenesi Oh I need to uncomment those lines in dockerfile-wav2lip. Ah sorry about that, I did not looked it carefully

@vido89
Copy link

vido89 commented Feb 18, 2025

@xenogenesi

11.14   Downloading opencv_contrib_python-4.11.0.86-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (20 kB)
11.52 ERROR: Ignored the following yanked versions: 3.4.11.39, 3.4.17.61, 4.4.0.42, 4.4.0.44, 4.5.4.58, 4.5.5.62, 4.7.0.68
11.52 ERROR: Could not find a version that satisfies the requirement opencv-python==4.1.0.25 (from versions: 3.4.0.14, 3.4.10.37, 3.4.11.41, 3.4.11.43, 3.4.11.45, 3.4.13.47, 3.4.15.55, 3.4.16.57, 3.4.16.59, 3.4.17.63, 3.4.18.65, 4.3.0.38, 4.4.0.40, 4.4.0.46, 4.5.1.48, 4.5.3.56, 4.5.4.60, 4.5.5.64, 4.6.0.66, 4.7.0.72, 4.8.0.74, 4.8.0.76, 4.8.1.78, 4.9.0.80, 4.10.0.82, 4.10.0.84, 4.11.0.86)
11.94 ERROR: No matching distribution found for opencv-python==4.1.0.25
------
Dockerfile:47
--------------------
  45 |     WORKDIR /workspace/Wav2Lip
  46 |     RUN pip3 install --upgrade pip
  47 | >>> RUN pip3 install -r requirements.txt
  48 |     
  49 |     RUN mkdir -p /root/.cache/torch/checkpoints && \
--------------------
ERROR: failed to solve: process "/bin/sh -c pip3 install -r requirements.txt" did not complete successfully: exit code: 1

Edit: I dont have conda in /opt/

@vido89
Copy link

vido89 commented Feb 18, 2025

@xenogenesi Oh sorry I was editing wrong file, but still opencv-python==4.1.0.25 is not available, closest available is 4.1.2.30 but here you tried that version and it gave you an error

@xenogenesi
Copy link
Author

@xenogenesi Oh sorry I was editing wrong file, but still opencv-python==4.1.0.25 is not available, closest available is 4.1.2.30 but here you tried that version and it gave you an error

@vido89 completely forgot about that, so 3.6 is the best choice, nice catch

@vido89
Copy link

vido89 commented Feb 18, 2025

@xenogenesi So 3.6 is not available in conda ?

@xenogenesi
Copy link
Author

xenogenesi commented Feb 18, 2025

@vido89 I see that they started versioning in the filename from 37, but there are older versions

gpt tell to use something like that:

RUN wget https://repo.anaconda.com/miniconda/Miniconda3-4.3.30-Linux-x86_64.sh -O /tmp/miniconda.sh && \
    bash /tmp/miniconda.sh -b -p /opt/miniconda && \
    rm /tmp/miniconda.sh && \
    /opt/miniconda/bin/conda install -y python=3.6 && \
    /opt/miniconda/bin/conda clean -ya

# Add Conda to PATH
ENV PATH="/opt/miniconda/bin:$PATH"

# Verify Python version
RUN python --version

which beside the /opt/miniconda /opt/conda is very similar to what we use

@vido89
Copy link

vido89 commented Feb 18, 2025

@xenogenesi

 > [ 3/15] RUN wget https://repo.anaconda.com/miniconda/Miniconda3-4.3.30-Linux-x86_64.sh -O /tmp/miniconda.sh &&     bash /tmp/miniconda.sh -b -p /opt/miniconda &&     rm /tmp/miniconda.sh &&     /opt/miniconda/bin/conda install -y python=3.6 &&     /opt/miniconda/bin/conda clean -ya:
1.026 /bin/sh: 1: wget: not found
Dockerfile:29

@xenogenesi
Copy link
Author

@vido89 yeah, I would use our version fixed with what is interesting in the gpt example

RUN curl -o ~/miniconda.sh -O  https://repo.anaconda.com/miniconda/Miniconda3-4.3.30-Linux-x86_64.sh  && \
     chmod +x ~/miniconda.sh && \
     ~/miniconda.sh -b -p /opt/conda && \
     rm ~/miniconda.sh && \
     /opt/conda/bin/conda install -y python=3.6 && \
     /opt/conda/bin/conda clean -ya

ENV PATH /opt/conda/bin:$PATH

# RUN conda config --set always_yes yes --set changeps1 no && conda update -q conda

# Verify Python version
RUN python --version

I wonder if the conda config line is necessary given that we added conda install, also I just noticed this pip3 install --upgrade setuptools in the original Dockerfile, this need to be moved after python is installed and running, perhaps even after pip upgrade

@vido89
Copy link

vido89 commented Feb 18, 2025

@xenogenesi Ok I moved pip3 install --upgrade setuptools after pip upgrade

RUN pip3 install --upgrade pip
RUN pip3 install --upgrade setuptools
RUN pip3 install -r requirements.txt
525.4 /bin/sh: 1: RUN: not found
------

 1 warning found (use docker --debug to expand):
 - NoEmptyContinuation: Empty continuation line (line 33)
Dockerfile:19
--------------------
  18 |     
  19 | >>> RUN export DEBIAN_FRONTEND=noninteractive RUNLEVEL=1 ; \
  20 | >>>      apt-get update && apt-get install -y --no-install-recommends \
  21 | >>>           build-essential cmake git curl ca-certificates \
  22 | >>>           vim \
  23 | >>>           python3-pip python3-dev python3-wheel \
  24 | >>>           libglib2.0-0 libxrender1 python3-soundfile \
  25 | >>>           ffmpeg && \
  26 | >>> 	rm -rf /var/lib/apt/lists/* && \
  27 | >>>      
  28 | >>> 
  29 | >>> RUN wget https://repo.anaconda.com/miniconda/Miniconda3-4.3.30-Linux-x86_64.sh -O /tmp/miniconda.sh && \
  30 | >>>     bash /tmp/miniconda.sh -b -p /opt/miniconda && \
  31 | >>>     rm /tmp/miniconda.sh && \
  32 | >>>     /opt/miniconda/bin/conda install -y python=3.6 && \
  33 | >>>     /opt/miniconda/bin/conda clean -ya
  34 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c export DEBIAN_FRONTEND=noninteractive RUNLEVEL=1 ;      apt-get update && apt-get install -y --no-install-recommends           build-essential cmake git curl ca-certificates           vim           python3-pip python3-dev python3-wheel           libglib2.0-0 libxrender1 python3-soundfile           ffmpeg && \trm -rf /var/lib/apt/lists/* && RUN wget https://repo.anaconda.com/miniconda/Miniconda3-4.3.30-Linux-x86_64.sh -O /tmp/miniconda.sh &&     bash /tmp/miniconda.sh -b -p /opt/miniconda &&     rm /tmp/miniconda.sh &&     /opt/miniconda/bin/conda install -y python=3.6 &&     /opt/miniconda/bin/conda clean -ya" did not complete successfully: exit code: 127

@xenogenesi
Copy link
Author

xenogenesi commented Feb 18, 2025

@vido89 you need to remove the last && \ from the previous RUN, \ is a line continuation

and you also should remove python3-pip python3-dev python3-wheel python3-soundfile installation trough apt-get, those are ubuntu packages which I doubt will work with the conda environment

  • python3-dev
  • python3-wheel
  • python3-soundfile

for those packages you need to find the corresponding replacement from the conda/python36 environment

you can use && to limit the number of filesystem layers that docker create, keep install requirements separate until it execute without failing so the other two will be cached

RUN pip3 install --upgrade pip && pip3 install --upgrade setuptools
RUN pip3 install -r requirements.txt

@vido89
Copy link

vido89 commented Feb 18, 2025

@xenogenesi

errors
conda-4.10.3-p 100% |###############################| Time: 0:00:01   2.18 MB/s0  B/s
113.8 Traceback (most recent call last):
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/exceptions.py", line 1079, in __call__
113.8     return func(*args, **kwargs)
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/cli/main.py", line 84, in _main
113.8     exit_code = do_call(args, p)
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 83, in do_call
113.8     return getattr(module, func_name)(args, parser)
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/cli/main_clean.py", line 288, in execute
113.8     json_result = _execute(args, parser)
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/cli/main_clean.py", line 240, in _execute
113.8     pkgs_dirs, totalsize = find_tarballs()
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/cli/main_clean.py", line 20, in find_tarballs
113.8     from ..core.package_cache_data import PackageCacheData
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/core/package_cache_data.py", line 14, in <module>
113.8     from .path_actions import CacheUrlAction, ExtractPackageAction
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/core/path_actions.py", line 30, in <module>
113.8     from ..gateways.connection.download import download
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/gateways/connection/__init__.py", line 21, in <module>
113.8     from requests import ConnectionError, HTTPError, Session
113.8   File "/opt/conda/lib/python3.6/site-packages/requests/__init__.py", line 84, in <module>
113.8     from urllib3.contrib import pyopenssl
113.8   File "/opt/conda/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
113.8     import OpenSSL.SSL
113.8   File "/opt/conda/lib/python3.6/site-packages/OpenSSL/__init__.py", line 8, in <module>
113.8     from OpenSSL import rand, crypto, SSL
113.8   File "/opt/conda/lib/python3.6/site-packages/OpenSSL/rand.py", line 169, in <module>
113.8     _lib.ERR_load_RAND_strings()
113.8 AttributeError: module 'lib' has no attribute 'ERR_load_RAND_strings'
113.8 
113.8 During handling of the above exception, another exception occurred:
113.8 
113.8 Traceback (most recent call last):
113.8   File "/opt/conda/bin/conda", line 13, in <module>
113.8     sys.exit(main())
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/cli/main.py", line 152, in main
113.8     return conda_exception_handler(_main, *args, **kwargs)
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/exceptions.py", line 1371, in conda_exception_handler
113.8     return_value = exception_handler(func, *args, **kwargs)
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/exceptions.py", line 1082, in __call__
113.8     return self.handle_exception(exc_val, exc_tb)
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/exceptions.py", line 1126, in handle_exception
113.8     return self.handle_unexpected_exception(exc_val, exc_tb)
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/exceptions.py", line 1137, in handle_unexpected_exception
113.8     self.print_unexpected_error_report(error_report)
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/exceptions.py", line 1207, in print_unexpected_error_report
113.8     from .cli.main_info import get_env_vars_str, get_main_info_str
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/cli/main_info.py", line 19, in <module>
113.8     from ..core.index import _supplement_index_with_system
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/core/index.py", line 13, in <module>
113.8     from .package_cache_data import PackageCacheData
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/core/package_cache_data.py", line 14, in <module>
113.8     from .path_actions import CacheUrlAction, ExtractPackageAction
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/core/path_actions.py", line 30, in <module>
113.8     from ..gateways.connection.download import download
113.8   File "/opt/conda/lib/python3.6/site-packages/conda/gateways/connection/__init__.py", line 21, in <module>
113.8     from requests import ConnectionError, HTTPError, Session
113.8   File "/opt/conda/lib/python3.6/site-packages/requests/__init__.py", line 84, in <module>
113.8     from urllib3.contrib import pyopenssl
113.8   File "/opt/conda/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
113.8     import OpenSSL.SSL
113.8   File "/opt/conda/lib/python3.6/site-packages/OpenSSL/__init__.py", line 8, in <module>
113.8     from OpenSSL import rand, crypto, SSL
113.8   File "/opt/conda/lib/python3.6/site-packages/OpenSSL/rand.py", line 169, in <module>
113.8     _lib.ERR_load_RAND_strings()
113.8 AttributeError: module 'lib' has no attribute 'ERR_load_RAND_strings'
------

 1 warning found (use docker --debug to expand):
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 35)
Dockerfile:28
--------------------
  27 |     
  28 | >>> RUN curl -o ~/miniconda.sh -O  https://repo.anaconda.com/miniconda/Miniconda3-4.3.30-Linux-x86_64.sh  && \
  29 | >>>      chmod +x ~/miniconda.sh && \
  30 | >>>      ~/miniconda.sh -b -p /opt/conda && \
  31 | >>>      rm ~/miniconda.sh && \
  32 | >>>      /opt/conda/bin/conda install -y python=3.6 && \
  33 | >>>      /opt/conda/bin/conda clean -ya
  34 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c curl -o ~/miniconda.sh -O  https://repo.anaconda.com/miniconda/Miniconda3-4.3.30-Linux-x86_64.sh  &&      chmod +x ~/miniconda.sh &&      ~/miniconda.sh -b -p /opt/conda &&      rm ~/miniconda.sh &&      /opt/conda/bin/conda install -y python=3.6 &&      /opt/conda/bin/conda clean -ya" did not complete successfully: exit code: 1

@vido89
Copy link

vido89 commented Feb 18, 2025

@xenogenesi So line 28

RUN curl -o ~/miniconda.sh -O  https://repo.anaconda.com/miniconda/Miniconda3-4.3.30-Linux-x86_64.sh  && \
     chmod +x ~/miniconda.sh && \
     ~/miniconda.sh -b -p /opt/conda && \
     rm ~/miniconda.sh && \
     /opt/conda/bin/conda install -y python=3.6 && \
     /opt/conda/bin/conda clean -ya

ENV PATH /opt/conda/bin:$PATH

@xenogenesi
Copy link
Author

xenogenesi commented Feb 18, 2025

@vido89 gpt says is a library version problem and propose some solution (I don't know if this is really the problem, seems legit but ...)

That error is caused by an OpenSSL compatibility issue. Python 3.6 relies on older OpenSSL APIs that have been removed in OpenSSL 3.x, which ships with Ubuntu 24.04. Specifically, ERR_load_RAND_strings was removed in OpenSSL 3.0.

Option 2: Install OpenSSL 1.1.1 alongside OpenSSL 3.x
Manually install OpenSSL 1.1.1 and make Python 3.6 use it

add libssl1.1 to the apt-get installed packages install -y wget bzip2 build-essential libssl1.1
set LD_LIBRARY_PATH to use it

ENV LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/opt/conda/lib:$LD_LIBRARY_PATH
ENV PATH="/opt/conda/bin:$PATH"

and check it is using it

RUN python --version && python -c "import ssl; print(ssl.OPENSSL_VERSION)"

but, this could be the first of many issues given by the old conda/python3.6 environment installing on a recent ubuntu release ...

@vido89
Copy link

vido89 commented Feb 18, 2025

@xenogenesi Ok I placed install -y wget bzip2 build-essential libssl1.1 on line 20
where should I put

ENV LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/opt/conda/lib:$LD_LIBRARY_PATH
ENV PATH="/opt/conda/bin:$PATH"

In Docker on in /home/slobodan/~/.bashrc ?

Edit:

48.11 Reading package lists...
49.16 Reading package lists...
50.09 Building dependency tree...
50.28 Reading state information...
50.36 E: Unable to locate package libssl1.1
50.36 E: Couldn't find any package by glob 'libssl1.1'
50.36 E: Couldn't find any package by regex 'libssl1.1'

@xenogenesi
Copy link
Author

@vido89 in the Dockerfile where there was ENV PATH "/opt/conda/bin:$PATH"

can you update your fork with your latest Dockerfile so I can see it? Or attach it here? You can use the details tag in the markdown to make it clickable and avoid long messages

<details>
  <summary>content name</summary>
raw  content
</details>
content name raw content

@vido89
Copy link

vido89 commented Feb 18, 2025

Ok here it is

MyDockerfile
# 1. install a version of docker with gpu support (docker-ce >= 19.03)

# 2.  enter the project directory and build the wav2lip image:
# docker build -t wav2lip .

# 3. allow root user to connect to the display
# xhost +local:root

# 4. instantiate the container
# docker run --rm --gpus all -v /tmp/.X11-unix:/tmp/.X11-unix -v $PWD:/workspace/src -e DISPLAY=$DISPLAY --device /dev/dri -ti wav2lip bash

# NOTES:
# export CUDA_VISIBLE_DEVICES="" ## force cpu only

# Based on https://github.com/1adrianb/face-alignment/blob/master/Dockerfile

FROM nvidia/cuda:12.2.0-base-ubuntu22.04

RUN export DEBIAN_FRONTEND=noninteractive RUNLEVEL=1 ; \
     apt-get update && apt-get install -y wget bzip2 build-essential libssl1.1 --no-install-recommends \
          build-essential cmake git curl ca-certificates \
          vim \
          libglib2.0-0 libxrender1 python3-soundfile \
          ffmpeg && \
	rm -rf /var/lib/apt/lists/*


RUN curl -o ~/miniconda.sh -O  https://repo.anaconda.com/miniconda/Miniconda3-4.3.30-Linux-x86_64.sh  && \
     chmod +x ~/miniconda.sh && \
     ~/miniconda.sh -b -p /opt/conda && \
     rm ~/miniconda.sh && \
     /opt/conda/bin/conda install -y python=3.6 && \
     /opt/conda/bin/conda clean -ya

ENV LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/opt/conda/lib:$LD_LIBRARY_PATH
ENV PATH="/opt/conda/bin:$PATH"

# RUN conda config --set always_yes yes --set changeps1 no && conda update -q conda

# Verify Python version
RUN python --version

RUN conda config --set always_yes yes --set changeps1 no && conda update -q conda
# RUN conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

# # Install Wav2Lip package
# # NOTE we use the git clone to install the requirements only once
# # (if we use COPY it will invalidate the cache and  reinstall the dependencies for every change in the sources)
WORKDIR /workspace
RUN chmod -R a+w /workspace
RUN git clone https://github.com/Rudrabha/Wav2Lip
WORKDIR /workspace/Wav2Lip
RUN pip3 install --upgrade pip
RUN pip3 install --upgrade setuptools
RUN pip3 install -r requirements.txt

RUN mkdir -p /root/.cache/torch/checkpoints && \
     curl -SL -o /root/.cache/torch/checkpoints/s3fd-619a316812.pth "https://www.adrianbulat.com/downloads/python-fan/s3fd-619a316812.pth"

# !!! NOTE !!! nvidia-driver version must match the version installed on the host(/docker server)
RUN export DEBIAN_FRONTEND=noninteractive RUNLEVEL=1 ; \
	apt-get update && apt-get install -y --no-install-recommends \
          nvidia-driver-550 mesa-utils && \
	rm -rf /var/lib/apt/lists/*

# create the working directory, to be mounted with the bind option
RUN mkdir /workspace/src
WORKDIR /workspace/src

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment