[Guide] Linux Install Guide: Installer Method

Installing and setting up FaceSwap


Forum rules

Read the FAQs and search the forum before posting a new topic.

Please mark any answers that fixed your problems so others can find the solutions.

User avatar
torzdf
Posts: 2761
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 141 times
Been thanked: 644 times

Re: [Guide] Linux Install Guide: Installer Method

Post by torzdf »

jiapei100 wrote: Tue Aug 01, 2023 6:26 pm

Did anybody successfully install faceswap without conda?

Yes, I have. But it means managing your Cuda/cuDNN dependencies yourself, and we don't provide support for that, sadly.

Last edited by torzdf on Tue Aug 01, 2023 7:17 pm, edited 1 time in total.

My word is final


Tags:
User avatar
jiapei100
Posts: 6
Joined: Sun Jul 30, 2023 5:30 am
Has thanked: 1 time

Re: [Guide] Linux Install Guide: Installer Method

Post by jiapei100 »

Thank you ... @torzdf.
Oh... That's you, who replied my message from github?

Yeah, I've been managing my cuda and cudnn.

And successfully ran python setup.py build, which clearly allows me to build faceswap without conda. I mean, there is options in it.
But I cannot build a wheel out...

User avatar
torzdf
Posts: 2761
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 141 times
Been thanked: 644 times

Re: [Guide] Linux Install Guide: Installer Method

Post by torzdf »

Ah, that's because it's not a pypi package, so there is no wheel

Setup.py is just a convenience wrapper for the requirements.txt files and other things which can get installed through Conda.

If running in normal python (needs to be 3.10) then I would create a python venv virtual environment and just run

Code: Select all

pip install -r ./requirements/requirements_nvidia.txt

My word is final

User avatar
jiapei100
Posts: 6
Joined: Sun Jul 30, 2023 5:30 am
Has thanked: 1 time

Re: [Guide] Linux Install Guide: Installer Method

Post by jiapei100 »

All runned already...

Just have NO idea why python faceswap.py gui won't pop up anything....

I found a file gui.py. It seems there is a chance to run python gui.py directly??
Still testing...

User avatar
jiapei100
Posts: 6
Joined: Sun Jul 30, 2023 5:30 am
Has thanked: 1 time

Re: [Guide] Linux Install Guide: Installer Method

Post by jiapei100 »

Code: Select all

➜  faceswap git:(master) ✗ python gui.py
Setting Faceswap backend to NVIDIA
~/.local/lib/python3.10/site-packages/numpy/core/getlimits.py:549: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  setattr(self, word, getattr(machar, word).flat[0])
~/.local/lib/python3.10/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  return self._float_to_str(self.smallest_subnormal)
~/.local/lib/python3.10/site-packages/numpy/core/getlimits.py:549: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.
  setattr(self, word, getattr(machar, word).flat[0])
~/.local/lib/python3.10/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.
  return self._float_to_str(self.smallest_subnormal)
2023-08-01 15:16:09.657119: E tensorflow/compiler/xla/stream_executor/cuda/cuda_dnn.cc:9342] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2023-08-01 15:16:09.657157: E tensorflow/compiler/xla/stream_executor/cuda/cuda_fft.cc:609] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2023-08-01 15:16:09.657167: E tensorflow/compiler/xla/stream_executor/cuda/cuda_blas.cc:1518] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2023-08-01 15:16:09.662649: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: SSE3 SSE4.1 SSE4.2 AVX AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
WARNING:tensorflow:From ~/.local/lib/python3.10/site-packages/tensorflow/python/ops/distributions/distribution.py:259: ReparameterizationType.__init__ (from tensorflow.python.ops.distributions.distribution) is deprecated and will be removed after 2019-01-01.
Instructions for updating:
The TensorFlow Distributions library has moved to TensorFlow Probability (https://github.com/tensorflow/probability). You should update all references to use `tfp.distributions` instead of `tf.distributions`.
WARNING:tensorflow:From ~/.local/lib/python3.10/site-packages/tensorflow/python/ops/distributions/bernoulli.py:165: RegisterKL.__init__ (from tensorflow.python.ops.distributions.kullback_leibler) is deprecated and will be removed after 2019-01-01.
Instructions for updating:
The TensorFlow Distributions library has moved to TensorFlow Probability (https://github.com/tensorflow/probability). You should update all references to use `tfp.distributions` instead of `tf.distributions`.

That is all what I obtained so far...

User avatar
torzdf
Posts: 2761
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 141 times
Been thanked: 644 times

Re: [Guide] Linux Install Guide: Installer Method

Post by torzdf »

No. Launching as you are is the correct way that is:

Code: Select all

python faceswap.py gui

Any other way simply will not work because that isn't how the program is built.

Ultimately, this is exactly why we standardise an install through Conda. Sure, it isn't for everyone, and has some major issues, but it standardises the install making these kinds of problems far easier to solve.

As it is, I have no idea about your individual Python setup, what's in your base environment, what site-packages you have, and which are available in the virtual environment, how your Cuda is installed, etc. etc. etc.

So, unfortunately, we have to take the approach that you are entirely entitled (and indeed capable) to install Faceswap whichever way you please, but at that point you are, unfortunately, on your own.

You are welcome to open a thread re: manual installs to see if anyone can help, but that's the best I can offer. As it is, this thread is for installing on Linux through the installer, so isn't the best place for this dicussion.

Last edited by torzdf on Tue Aug 01, 2023 10:23 pm, edited 2 times in total.

My word is final

User avatar
jiapei100
Posts: 6
Joined: Sun Jul 30, 2023 5:30 am
Has thanked: 1 time

Re: [Guide] Linux Install Guide: Installer Method

Post by jiapei100 »

@torzdf

Done now... I‘ve got a 2nd questions . Check this: https://forum.faceswap.dev/viewtopic.php?t=2763

Thank you ...

User avatar
SoCalFoxx
Posts: 1
Joined: Sun Mar 31, 2024 9:18 pm

Re: [Guide] Linux Install Guide: Installer Method

Post by SoCalFoxx »

I have read all the forum post, I even googled to see if I was missing anything. I can not get it load. I tried moving to the ~/Downloads dir then add the code. I tried to add the ~/Download dir with the code at the same time and nothing works.

See error:

Code: Select all

chris@chris-MacBookPro:~$ ~/Downloads$ bash ./faceswap_setup_x64.sh
bash: /home/chris/Downloads$: No such file or directory
chris@chris-MacBookPro:~$ ~/Downloads
bash: /home/chris/Downloads: Is a directory
chris@chris-MacBookPro:~$ bash ./faceswap_setup_x64.sh
bash: ./faceswap_setup_x64.sh: No such file or directory
chris@chris-MacBookPro:~$
Last edited by torzdf on Mon Apr 01, 2024 11:20 am, edited 2 times in total.
User avatar
torzdf
Posts: 2761
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 141 times
Been thanked: 644 times

Re: [Guide] Linux Install Guide: Installer Method

Post by torzdf »

Do you have the correct installer? This is the Linux thread, you need the macOS version:
viewtopic.php?t=2748

Then it's as simple as entering your Downloads folder in terminal and entering:

Code: Select all

bash faceswap_setup_macos.sh

My word is final

User avatar
FaceRunner
Posts: 5
Joined: Fri Jan 06, 2023 5:47 pm
Been thanked: 2 times

Re: [Guide] Linux Install Guide: Installer Method

Post by FaceRunner »

Hi, I was able to install this before but that was linux mint cinnamon 21. now I am on mint 22 cinnamon (6.2.9)
nvidia, drivers up to date

The installer installed everything except the last bit.

' _install_setup_packages ERROR Unable to install package: pexpect>=4.8.0. Process aborted'

faceswap won't launch

full log:

01/13/2025 13:49:21 setup <module> DEBUG Setup called with args: ['/home/user/faceswap/setup.py', '--installer', '--nvidia']
01/13/2025 13:49:21 setup _process_arguments DEBUG ['/home/user/faceswap/setup.py', '--installer', '--nvidia']
01/13/2025 13:49:21 setup _check_permission INFO Running without root/admin privileges
01/13/2025 13:49:21 setup _check_system INFO The tool provides tips for installation and installs required python packages
01/13/2025 13:49:21 setup _check_system INFO Setup in Linux 6.8.0-51-generic
01/13/2025 13:49:21 setup _check_python INFO Installed Python: 3.10.16 64bit
01/13/2025 13:49:21 setup _output_runtime_info INFO Running in Conda
01/13/2025 13:49:21 setup _output_runtime_info INFO Running in a Virtual Environment
01/13/2025 13:49:21 setup _output_runtime_info INFO Encoding: UTF-8
01/13/2025 13:49:21 setup _upgrade_pip INFO Installed pip: 24.2
01/13/2025 13:49:21 setup _set_env_vars INFO Cuda search path set to '/home/user/miniconda3/envs/faceswap/lib'
01/13/2025 13:49:21 setup set_config INFO Faceswap config written to: /home/user/faceswap/config/.faceswap
01/13/2025 13:49:21 setup _update_backend_specific_conda INFO Adding conda required package '['cudatoolkit>=11.2,<11.3', 'cudnn>=8.1,<8.2']' for backend 'nvidia')
01/13/2025 13:49:21 setup _get_installed_packages DEBUG {}
01/13/2025 13:49:22 setup get_installed_conda_packages DEBUG {'libgcc_mutex': '0.1', '_openmp_mutex': '5.1', 'bzip2': '1.0.8', 'c-ares': '1.19.1', 'ca-certificates': '2024.12.31', 'curl': '8.11.1', 'expat': '2.6.4', 'gettext': '0.21.0', 'git': '2.40.1', 'icu': '73.1', 'krb5': '1.20.1', 'ld_impl_linux-64': '2.40', 'libcurl': '8.11.1', 'libedit': '3.1.20230828', 'libev': '4.33', 'libffi': '3.4.4', 'libgcc-ng': '11.2.0', 'libgomp': '11.2.0', 'libnghttp2': '1.57.0', 'libssh2': '1.11.1', 'libstdcxx-ng': '11.2.0', 'libuuid': '1.41.5', 'libxml2': '2.13.5', 'lz4-c': '1.9.4', 'ncurses': '6.4', 'openssl': '3.0.15', 'pcre2': '10.42', 'perl': '5.38.2', 'pip': '24.2', 'python': '3.10.16', 'readline': '8.2', 'setuptools': '75.1.0', 'sqlite': '3.45.3', 'tk': '8.6.14', 'tzdata': '2024b', 'wheel': '0.44.0', 'xz': '5.4.6', 'zlib': '1.2.13', 'zstd': '1.5.6'}
01/13/2025 13:49:22 setup get_required_packages DEBUG [('tqdm', [('>=', '4.65')]), ('psutil', [('>=', '5.9.0')]), ('numexpr', [('>=', '2.8.7')]), ('numpy', [('>=', '1.26.0'), ('<', '2.0.0')]), ('opencv-python', [('>=', '4.9.0.0')]), ('pillow', [('<', '10.0.0'), ('>=', '9.4.0')]), ('scikit-learn', [('>=', '1.3.0')]), ('fastcluster', [('>=', '1.2.6')]), ('matplotlib', [('>=', '3.8.0')]), ('imageio', [('>=', '2.33.1')]), ('imageio-ffmpeg', [('>=', '0.4.9')]), ('ffmpy', [('>=', '0.3.0')]), ('nvidia-ml-py', [('<', '300'), ('>=', '12.535')]), ('tensorflow', [('<', '2.11.0'), ('>=', '2.10.0')])]
01/13/2025 13:49:22 setup check_missing_dependencies DEBUG [('tqdm', [('>=', '4.65')]), ('psutil', [('>=', '5.9.0')]), ('numexpr', [('>=', '2.8.7')]), ('numpy', [('>=', '1.26.0'), ('<', '2.0.0')]), ('opencv-python', [('>=', '4.9.0.0')]), ('pillow', [('<', '10.0.0'), ('>=', '9.4.0')]), ('scikit-learn', [('>=', '1.3.0')]), ('fastcluster', [('>=', '1.2.6')]), ('matplotlib', [('>=', '3.8.0')]), ('imageio', [('>=', '2.33.1')]), ('imageio-ffmpeg', [('>=', '0.4.9')]), ('ffmpy', [('>=', '0.3.0')]), ('nvidia-ml-py', [('<', '300'), ('>=', '12.535')]), ('tensorflow', [('<', '2.11.0'), ('>=', '2.10.0')])]
01/13/2025 13:49:22 setup check_conda_missing_dependencies DEBUG [('tk==xft', 'conda-forge'), ('xorg-libxft', 'conda-forge'), (['cudatoolkit>=11.2,<11.3', 'cudnn>=8.1,<8.2'], 'conda-forge')]
01/13/2025 13:49:22 setup init INFO Installing Required Python Packages. This may take some time...
01/13/2025 13:49:22 setup init INFO Installing pexpect>=4.8.0
01/13/2025 13:49:22 setup init DEBUG argv: ['conda', 'install', '-y', '"pexpect>=4.8.0"']
01/13/2025 13:49:22 setup _seen_line_log DEBUG
01/13/2025 13:49:22 setup _seen_line_log DEBUG InvalidMatchSpec: Invalid spec '"pexpect>=4.8.0"': Invalid version '4.8.0"': invalid character(s)
01/13/2025 13:49:22 setup call DEBUG Package: pexpect>=4.8.0, returncode: 1
01/13/2025 13:49:22 setup _install_setup_packages ERROR Unable to install package: pexpect>=4.8.0. Process aborted

User avatar
FaceRunner
Posts: 5
Joined: Fri Jan 06, 2023 5:47 pm
Been thanked: 2 times

Re: [Guide] Linux Install Guide: Installer Method

Post by FaceRunner »

I was able to get past the install error I mentioned above by installing the full Anaconda (not miniconda) and use this conda env for the faceswap install.

So, install Anaconda first, then run the Faceswap installer.

Last edited by FaceRunner on Sat Jan 18, 2025 8:36 pm, edited 1 time in total.
User avatar
korrupt78
Posts: 51
Joined: Wed Jan 29, 2020 1:34 am
Has thanked: 4 times
Been thanked: 1 time

Re: [Guide] Linux Install Guide: Installer Method

Post by korrupt78 »

Same problem. Brand new Ubuntu 24.10 install. I downloaded and ran the linux install script (faceswap_setup_x64.sh), but it choked on pexpect.

I then tried your suggestion of starting over, installing Anaconda first, then faceswap. That got me past the pexpect point, but it still generated errors:

Code: Select all

INFO     Installing pexpect>=4.8.0
Traceback (most recent call last):
  File "/home/me/faceswap/setup.py", line 1731, in <module>
    Install(ENV)
  File "/home/me/faceswap/setup.py", line 1036, in __init__
    self._install_setup_packages()
  File "/home/me/faceswap/setup.py", line 1101, in _install_setup_packages
    if installer() != 0:
  File "/home/me/faceswap/setup.py", line 1623, in __call__
    returncode = self.call()
  File "/home/me/faceswap/setup.py", line 1635, in call
    with Popen(self._command,
  File "/home/me/anaconda3/envs/faceswap/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/home/me/anaconda3/envs/faceswap/lib/python3.10/subprocess.py", line 1863, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'conda'
INFO    Faceswap installation is complete!
INFO    You can launch Faceswap from the icon on your desktop

I looked at the contents of the Faceswap desktop file and followed that to ~/faceswap/faceswap_gui_launcher.sh, which contained the following:

Code: Select all

source "/home/me/anaconda3/etc/profile.d/conda.sh" activate &&
conda activate 'faceswap' &&
python "/home/me/faceswap/faceswap.py" gui

I then tried running each of those commands manually, and on the last one:

Code: Select all

(faceswap) me@laptop:~/faceswap$ python "/home/me/faceswap/faceswap.py" gui
Traceback (most recent call last):
  File "/home/me/faceswap/faceswap.py", line 12, in <module>
    from lib.cli import args as cli_args  # pylint:disable=wrong-import-position
  File "/home/me/faceswap/lib/cli/args.py", line 12, in <module>
    from lib.utils import get_backend
  File "/home/me/faceswap/lib/utils.py", line 20, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'

Then, I took a chance and guessed that running python setup.py (while I was still in the conda shell) might help, and that spent several minutes installing all kinds of stuff.

After that, I clicked on the desktop file and the GUI launched successfully.

Last edited by korrupt78 on Mon Jan 27, 2025 5:24 am, edited 3 times in total.
Post Reply