stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: Cannot locate TCMalloc

Open RiverBankChild opened this issue 1 year ago • 5 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

when i run webui.sh on centos server, it came out a error : Cannot locate TCMalloc (improves CPU memory usage) 1683283094278

Steps to reproduce the problem

  1. git pull
  2. ./webui.sh

What should have happened?

this error should not happen

Commit where the problem happens

5ab7f213

What platforms do you use to access the UI ?

No response

What browsers do you use to access the UI ?

No response

Command Line Arguments

eval "$(conda shell.bash hook)"
conda activate sdwebui
export COMMANDLINE_ARGS="--share --xformers --enable-insecure-extension-access"

List of extensions

1683283368017

Console logs

(base) [zjh@VM-0-2-centos stable-diffusion-webui]$ ./webui.sh

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on zjh user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
Cannot locate TCMalloc (improves CPU memory usage)
Python 3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:36:39) [GCC 10.4.0]
Commit hash: 5ab7f213bec2f816f9c5644becb32eb72c8ffb89
Installing requirements


Launching Web UI with arguments: --share --xformers --enable-insecure-extension-access
==============================================================================
You are running torch 1.13.1+cu117.
The program is tested to work with torch 2.0.0.
To reinstall the desired version, run with commandline flag --reinstall-torch.
Beware that this will cause a lot of large files to be downloaded, as well as
there are reports of issues with training tab on the latest version.

Use --skip-version-check commandline argument to disable this check.
==============================================================================
=================================================================================
You are running xformers 0.0.16rc425.
The program is tested to work with xformers 0.0.17.
To reinstall the desired version, run with commandline flag --reinstall-xformers.

Use --skip-version-check commandline argument to disable this check.
=================================================================================
Civitai Helper: Get Custom Model Folder
Civitai Helper: Load setting from: /home/zjh/stable-diffusion-webui/extensions/Stable-Diffusion-Webui-Civitai-Helper/setting.json
Civitai Helper: No setting file, use default
ControlNet v1.1.112
ControlNet v1.1.112
Loading weights [db220d90e5] from /home/zjh/stable-diffusion-webui/models/Stable-diffusion/chilloutmix-Ni-non-ema-fp32.safetensors
Creating model from config: /home/zjh/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(0): 
Model loaded in 3.5s (load weights from disk: 0.2s, create model: 0.5s, apply weights to model: 0.7s, apply half(): 0.2s, load VAE: 1.3s, move model to device: 0.6s).
Running on local URL:  http://127.0.0.1:7860
Running on public URL: https://77e0ebb4f66b51594b.gradio.live

This share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces
Startup time: 9.7s (import torch: 0.9s, import gradio: 1.1s, import ldm: 0.4s, other imports: 0.7s, load scripts: 0.8s, load SD checkpoint: 3.6s, create ui: 0.6s, gradio launch: 1.5s).

Additional information

No response

RiverBankChild avatar May 05 '23 10:05 RiverBankChild

Did you install TCMalloc from your OS repositories?

Here is mine on Ubuntu

(venv) dsalvat1@leviathan:~/stable-diffusion-webui$ dpkg -l |grep malloc
ii  libgoogle-perftools-dev:amd64              2.9.1-0ubuntu3                          amd64        libraries for CPU and heap analysis, plus an efficient thread-caching malloc
ii  libgoogle-perftools4:amd64                 2.9.1-0ubuntu3                          amd64        libraries for CPU and heap analysis, plus an efficient thread-caching malloc
ii  libtcmalloc-minimal4:amd64                 2.9.1-0ubuntu3                          amd64        efficient thread-caching malloc

dpsalvatierra avatar May 05 '23 11:05 dpsalvatierra

On my system the reason for this was that ldconfig (in the Debian package libc-bin), despite being installed, was not found. It is installed in /usr/sbin/ldconfig and /usr/sbin is not in the PATH if webui.sh is started as normal user. (ldconfigis internally used to locate libtcmalloc.so.4).

phispi avatar May 05 '23 13:05 phispi

On Ubuntu-22.04 with WSL2, installing google-perftools improved the situation sudo apt install --no-install-recommends google-perftools

acncagua avatar May 05 '23 15:05 acncagua

Did you install TCMalloc from your OS repositories?

Here is mine on Ubuntu

(venv) dsalvat1@leviathan:~/stable-diffusion-webui$ dpkg -l |grep malloc
ii  libgoogle-perftools-dev:amd64              2.9.1-0ubuntu3                          amd64        libraries for CPU and heap analysis, plus an efficient thread-caching malloc
ii  libgoogle-perftools4:amd64                 2.9.1-0ubuntu3                          amd64        libraries for CPU and heap analysis, plus an efficient thread-caching malloc
ii  libtcmalloc-minimal4:amd64                 2.9.1-0ubuntu3                          amd64        efficient thread-caching malloc

this is helpful in ubuntu20.04: sudo apt-get install libgoogle-perftools4 libtcmalloc-minimal4 -y

QureL avatar May 07 '23 05:05 QureL

On my system the reason for this was that ldconfig (in the Debian package libc-bin), despite being installed, was not found. It is installed in /usr/sbin/ldconfig and /usr/sbin is not in the PATH if webui.sh is started as normal user. (ldconfigis internally used to locate libtcmalloc.so.4).

Hi, can you tell me how to solve this, thank you.

LUisCArlosRO avatar May 15 '23 10:05 LUisCArlosRO

Hi, can you tell me how to solve this, thank you.

I added the line

PATH=$PATH:/usr/sbin

to webui-user.sh.

phispi avatar May 15 '23 19:05 phispi

sudo apt install --no-install-recommends google-perftools

thanks, this is worked for me !

frostdecker99 avatar May 16 '23 00:05 frostdecker99

Hi, can you tell me how to solve this, thank you.

I added the line

PATH=$PATH:/usr/sbin

to webui-user.sh.

Thank you very much. This solved the problem in Debian.

LUisCArlosRO avatar May 16 '23 07:05 LUisCArlosRO

If you are in the Centos system, try performing the following actions

sudo yum install gperftools sudo vi /etc/profile export LD_LIBRARY_PATH=/usr/local/lib source /etc/profile

cuihp avatar Jun 01 '23 09:06 cuihp

This is not an error, it's just a warning that tcmalloc isn't being used.

Anyway, closing because there's a bunch of solutions in this thread, mainly "installing tcmalloc". 😁

akx avatar Jun 14 '23 10:06 akx

On Archlinux: pacman -S gperftools

Using TCMalloc: libtcmalloc_minimal.so.4

woaiseeit avatar Sep 07 '23 20:09 woaiseeit

Did you install TCMalloc from your OS repositories? Here is mine on Ubuntu

(venv) dsalvat1@leviathan:~/stable-diffusion-webui$ dpkg -l |grep malloc
ii  libgoogle-perftools-dev:amd64              2.9.1-0ubuntu3                          amd64        libraries for CPU and heap analysis, plus an efficient thread-caching malloc
ii  libgoogle-perftools4:amd64                 2.9.1-0ubuntu3                          amd64        libraries for CPU and heap analysis, plus an efficient thread-caching malloc
ii  libtcmalloc-minimal4:amd64                 2.9.1-0ubuntu3                          amd64        efficient thread-caching malloc

this is helpful in ubuntu20.04: sudo apt-get install libgoogle-perftools4 libtcmalloc-minimal4 -y

Great. This works for me.

marks202309 avatar Sep 23 '23 15:09 marks202309

I had to install these packages on open suse libtcmalloc4 libgthread-2_0-0

ademar111190 avatar Oct 13 '23 14:10 ademar111190

I had to install these packages on open suse libtcmalloc4 libgthread-2_0-0

hey, thank you

hkpD avatar Oct 14 '23 18:10 hkpD

Just curious, do I need to re-install stable-diffusion-webui after I installed TCMalloc, because it already built with GCC without it? Or can I just install TCMalloc after installing stable-diffusion-webui ?

didibus avatar Oct 14 '23 21:10 didibus

Just curious, do I need to re-install stable-diffusion-webui after I installed TCMalloc, because it already built with GCC without it? Or can I just install TCMalloc after installing stable-diffusion-webui ?

You do not need to reinstall stable-diffusion-webui, it is not a compiled binary. The tcmalloc reference is initialized in webui.sh and was introduced in commit 8af4b3b

nero-dv avatar Oct 24 '23 02:10 nero-dv

In openSUSE 15.5 change line in webui.sh TCMALLOC="$(PATH=/usr/sbin:$PATH ldconfig -p | grep -Po "libtcmalloc(_minimal|).so.\d" | head -n 1)" to TCMALLOC="$(PATH=/sbin:$PATH ldconfig -p | grep -Po "libtcmalloc(_minimal|).so.\d" | head -n 1)"

p0lfilt3r avatar Oct 24 '23 06:10 p0lfilt3r

For Debian: sudo apt install libtcmalloc-minimal4

DSI-dot-Guru avatar Jul 25 '24 01:07 DSI-dot-Guru