[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: 2651
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 129 times
Been thanked: 622 times

[Guide] Linux Install Guide: Installer Method

Post by torzdf »

Installing Faceswap on Linux is a breeze. The Linux installer installs everything you need except for your Graphics drivers.

We recommend using a lightweight Distribution (such as Xubuntu) but the installer should work fine on all Linux flavors.

  1. If you are using a Graphics card (which is highly recommended. Faceswapping on CPU is incredibly slow), then make sure your drivers are up to date.

  2. Download the Faceswap Installer

  3. Open up a terminal emulator, navigate to the download location then enter the following command as a normal user (do not execute this command as sudo or root):

    Code: Select all

    bash ./faceswap_setup_x64.sh
    linux_install01.png
    linux_install01.png (15.54 KiB) Viewed 209708 times
  4. The Faceswap Logo will display followed by some information. Make sure you read it thoroughly (specifically the part about user permissions on destination folders) then press Enter to continue.

    linux_install02.png
    linux_install02.png (53.21 KiB) Viewed 209708 times
  5. Conda
    Faceswap uses Conda as it handles the installation of all prerequisites (git, Cuda, Tensorflow etc) and contains them within their own environment, away from the rest of your system.

    • If an existing Conda install is found you will be asked if you want to use it. You should select Yes. These next options will only be displayed if an existing Conda install was not found, or if you select No to using the existing Conda install.

    • The default install location for Conda will be fine in 99% of cases. If you do wish to install it elsewhere, then make sure that:

      1. Your user has permissions to write to the location you select.

      2. There are no spaces in the location that you provide (this is a Conda limitation and is outside of our control).

      If you are happy with the default location then just press Enter

      linux_install03.png
      linux_install03.png (24.47 KiB) Viewed 209708 times
    • You will be asked if you want to add Conda to PATH. This is up to you, but it will make life easier if you say Yes. It basically means that you will have access to the conda command from the command line, and won't need to search for the executable inside the miniconda3 folder. Hit Enter to select the default value or press n if you don't want Conda added to your path.

      linux_install04.png
      linux_install04.png (24.31 KiB) Viewed 209708 times
    • Faceswap is run inside a "virtual environment". This is a Python environment that is kept separate from the rest of your system to avoid conflicts. The environment needs a name. The default should be fine, but if you have multiple installs then you will want to set a specific environment name here. NB: If an environment already exists with the name you select then it will be deleted (you will be notified if this will occur prior to commencing install). Press Enter to use the default faceswap or enter your preferred name here.

      linux_install05.png
      linux_install05.png (20.03 KiB) Viewed 209708 times
  6. Faceswap

    • The location that you want Faceswap installed to. The default will be fine in 99% of cases, but as with the Conda install, if you do select a different location, then make sure your user has permission to write to it. NB: If a folder pre-exists at the location given, then it will be deleted (you will be notified if this will occur prior to commencing install). Press Enter to use the default location or enter your preferred location here.

      linux_install06.png
      linux_install06.png (19.66 KiB) Viewed 209708 times
    • Faceswap can be run on Nvidia or AMD GPUs or on CPU. The software it installs varies depending on what you select here, so make sure you select the correct option for your system.

      • AMD Users:
        • ROCm is the preferred method, but requires that a compatible version of ROCm is installed on your system. The Faceswap installer cannot take care of this for you.
          • Unfortunately ROCm will only work on newer GPUs. It is hard to find a list of supported GPUs, but from experience anything HAWAII (that's the R9 range) or before will not work, anything Navi might work, anything later should work.
          • The version of ROCm you install is important, as it must be compatible with the version of Tensorflow that faceswap will install. As the version of tensorflow changes, so will the required ROCm version. The easiest way to find out which ROCm versions are supported by faceswap is to look at this line from Faceswap's setup script. An example of this can be seen below:
            rocm.jpg
            rocm.jpg (12.3 KiB) Viewed 114487 times
            Note: whilst the ROCm requirement was correct at the time of writing, it is highly unlikely to be correct now, so you should check the actual version currently supported..
            In the above example, this shows that Faceswap is running Tensorflow 2.10.x and supports ROCm from 5.2.0 to 5.4.0
          • If you think your card is ROCm 5 compatible, then you can follow the ROCm installation instructions here: https://docs.amd.com/category/ROCm%E2%84%A2%20v5.x.

      Enter 1 for Nvidia, 2 for AMD (ROCm) or 3 for CPU

      linux_install07.jpg
      linux_install07.jpg (28.51 KiB) Viewed 114487 times
  7. Post Install Actions

    • If you are running a Desktop Environment you will be given the option to create a Desktop shortcut to enter the GUI. This makes opening Faceswap a lot easier, so unless you have a good reason not to, you should select Y here.

      linux_install08.png
      linux_install08.png (23.62 KiB) Viewed 209708 times
  8. Finally you will be able to review your options. If you are happy press Y to proceed with the install, or press Enter to abort.

    linux_install09.png
    linux_install09.png (32.48 KiB) Viewed 209708 times
  9. The installer will proceed to download the resources it needs from the internet and install as per your options. After a period of time Faceswap installation will complete and you will be ready to launch.

Last edited by torzdf on Fri Jul 14, 2023 1:06 pm, edited 2 times in total.

My word is final


Tags:
User avatar
alexbrus
Posts: 5
Joined: Wed Jan 08, 2020 2:45 pm

Re: [Guide]Linux Install Guide: Installer Method

Post by alexbrus »

Ubuntu : trying to run "TF_FORCE_GPU_ALLOW_GROWTH=true python3 faceswap.py gui" which is well working but this time via RDP to Ubuntu, it fails with error:

File "/usr/lib/python3.7/tkinter/init.py", line 2023, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display ":10.0"

Can you please tell me if possible to configure it and how to handle RPD display

User avatar
torzdf
Posts: 2651
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 129 times
Been thanked: 622 times

Re: [Guide]Linux Install Guide: Installer Method

Post by torzdf »

You're connecting to a headless server which doesn't have an X-Server installed.

It's outside the scope of Faceswap to go into configuration for this, but look into vnc4server for Ubuntu. You should find plenty of guides.

My word is final

User avatar
Taifun
Posts: 5
Joined: Mon Mar 01, 2021 7:46 pm

Re: [Guide]Linux Install Guide: Installer Method

Post by Taifun »

Hello, I have installed faceswap on Ubunt 18.04 but during the installation there was not point 7. where you can install a shortcut. So how can I start faceswap by using a terminal?

User avatar
torzdf
Posts: 2651
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 129 times
Been thanked: 622 times

Re: [Guide]Linux Install Guide: Installer Method

Post by torzdf »

Which desktop environment are you using?

You can access faceswap from cli:

Code: Select all

conda acrivate faceswap
cd faceswap
python faceswap.py -h

My word is final

User avatar
Taifun
Posts: 5
Joined: Mon Mar 01, 2021 7:46 pm

Re: [Guide]Linux Install Guide: Installer Method

Post by Taifun »

It is standard Ubuntu LTS 18.04.05
I think first line should be "conda activate faceswap"
And this is what I get when I put the command lines in...

Code: Select all

xxx@xxx:~$ conda activate faceswap
(faceswap) xxx@xxx:~$ cd faceswap
(faceswap) xxx@xxx:~/faceswap$ python faceswap.py -h
Setting Faceswap backend to CPU
There was an error reading from the Nvidia Machine Learning Library. Either you do not have an Nvidia GPU (in which case this warning can be ignored) or the most likely cause is incorrectly installed drivers. If this is the case, Please remove and reinstall your Nvidia drivers before reporting.Original Error: NVML Shared Library Not Found
No GPU detected. Switching to CPU mode
usage: faceswap.py [-h] {extract,train,convert,gui} ...

positional arguments:
  {extract,train,convert,gui}
    extract             Extract the faces from pictures or a video
    train               Train a model for the two faces A and B
    convert             Convert source pictures or video to a new one with the
                        face swapped
    gui                 Launch the Faceswap Graphical User Interface

optional arguments:
  -h, --help            show this help message and exit
(faceswap) xxx@xxx:~/faceswap$ 

Thats it, the gui does not appear:(

User avatar
torzdf
Posts: 2651
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 129 times
Been thanked: 622 times

Re: [Guide]Linux Install Guide: Installer Method

Post by torzdf »

There was an error reading from the Nvidia Machine Learning Library. Either you do not have an Nvidia GPU (in which case this warning can be ignored) or the most likely cause is incorrectly installed drivers. If this is the case, Please remove and reinstall your Nvidia drivers before reporting.Original Error: NVML Shared Library Not Found

Check your Nvidia drivers

My word is final

User avatar
Taifun
Posts: 5
Joined: Mon Mar 01, 2021 7:46 pm

Re: [Guide]Linux Install Guide: Installer Method

Post by Taifun »

I do not have have any Nvidia drivers. It is a hp Elitebook 2570p with Intel HD Graphics 4000.

User avatar
torzdf
Posts: 2651
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 129 times
Been thanked: 622 times

Re: [Guide]Linux Install Guide: Installer Method

Post by torzdf »

Then you selected the incorrect option when you installed. You should remove your Faceswap folder + re-run the install script ensuring that you select the "CPU" option

My word is final

User avatar
Logry
Posts: 5
Joined: Tue Apr 20, 2021 9:45 am

Re: [Guide]Linux Install Guide: Installer Method

Post by Logry »

Hi everyone, when I use the following instruction I receive the message : "No such file or document were found.".

Code: Select all

xxx@xxx:~$ conda activate faceswap
(faceswap) xxx@xxx:~$ cd faceswap
(faceswap) xxx@xxx:~/faceswap$ python faceswap.py -h

I precise I have chosen CPU.
Thanks in advance for your help.

User avatar
torzdf
Posts: 2651
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 129 times
Been thanked: 622 times

Re: [Guide]Linux Install Guide: Installer Method

Post by torzdf »

This is no way near enough information.

Please post the direct output of that command, and also a screengrab of your ~/faceswap folder

My word is final

User avatar
Logry
Posts: 5
Joined: Tue Apr 20, 2021 9:45 am

Re: [Guide]Linux Install Guide: Installer Method

Post by Logry »

Hi, thanks for this quick feedback. Here's the command and the directory of the software.
PS : I couldn't change the command line langue so I translated.

Attachments
bug.png
bug.png (153.35 KiB) Viewed 171055 times
User avatar
torzdf
Posts: 2651
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 129 times
Been thanked: 622 times

Re: [Guide]Linux Install Guide: Installer Method

Post by torzdf »

This should not be at the start of your faceswap line: /faceswap$

The command is:

Code: Select all

python faceswap.py -h

My word is final

User avatar
Logry
Posts: 5
Joined: Tue Apr 20, 2021 9:45 am

Re: [Guide]Linux Install Guide: Installer Method

Post by Logry »

Thank you ! It works just fine now .

User avatar
AlienHashHat
Posts: 1
Joined: Wed May 26, 2021 1:35 pm
Has thanked: 1 time

Re: [Guide]Linux Install Guide: Installer Method

Post by AlienHashHat »

Hi, I am new to all of this. I want to know if my chromebook can run this software with LINUX under "developer tools" these are pictures for reference. PLS let me know before I try to do this I donr want to mess up my laptop.

User avatar
torzdf
Posts: 2651
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 129 times
Been thanked: 622 times

Re: [Guide]Linux Install Guide: Installer Method

Post by torzdf »

No. A Chromebook will not have a good enough GPU

My word is final

User avatar
Chupz22
Posts: 2
Joined: Tue May 17, 2022 1:35 am
Been thanked: 1 time

Re: [Guide]Linux Install Guide: Installer Method

Post by Chupz22 »

Please help I am installing on Linux Mint 20.3 but this happens

chupz22@KikoPredatorMint:~/Downloads$ bash faceswap_setup_x64.sh
faceswap_setup_x64.sh: line 2: $'\r': command not found
faceswap_setup_x64.sh: line 6: $'\r': command not found
faceswap_setup_x64.sh: line 16: $'\r': command not found
faceswap_setup_x64.sh: line 19: $'\r': command not found
faceswap_setup_x64.sh: line 21: $'\r': command not found
faceswap_setup_x64.sh: line 22: syntax error near unexpected token $'{\r''
'aceswap_setup_x64.sh: line 22:
header() {

I am lost I tried alot of fixes on internet. I even used "chmod +x" command and try to run with "sudo sh ./faceswap_setup_x64.sh" but still returns the same syntax error. Thank you

User avatar
torzdf
Posts: 2651
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 129 times
Been thanked: 622 times

Re: [Guide]Linux Install Guide: Installer Method

Post by torzdf »

Chupz22 wrote: Tue May 17, 2022 1:38 am

Please help I am installing on Linux Mint 20.3 but this happens

chupz22@KikoPredatorMint:~/Downloads$ bash faceswap_setup_x64.sh
faceswap_setup_x64.sh: line 2: $'\r': command not found
faceswap_setup_x64.sh: line 6: $'\r': command not found
faceswap_setup_x64.sh: line 16: $'\r': command not found
faceswap_setup_x64.sh: line 19: $'\r': command not found
faceswap_setup_x64.sh: line 21: $'\r': command not found
faceswap_setup_x64.sh: line 22: syntax error near unexpected token $'{\r''
'aceswap_setup_x64.sh: line 22:
header() {

I am lost I tried alot of fixes on internet. I even used "chmod +x" command and try to run with "sudo sh ./faceswap_setup_x64.sh" but still returns the same syntax error. Thank you

Goddam Windows changed the row endings :/

I have re-uploaded a working version. Please get the latest installer and try again

My word is final

User avatar
Chupz22
Posts: 2
Joined: Tue May 17, 2022 1:35 am
Been thanked: 1 time

Re: [Guide]Linux Install Guide: Installer Method

Post by Chupz22 »

Worked like a charm! Thank you for all the hardwork. It is very much appreciated :D

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 »

Did anybody successfully install faceswap without conda?

Post Reply