Closed light-and-ray closed 1 month ago
Can you test the last commit, does it work?
nope not working and worse
for I belive one your append sys.path is worng and so have no effect
so I try this
if platform.system() == 'Windows':
extra_ldflags.append(f"/LIBPATH:{os.path.join(sys.base_prefix, 'libs')}")
good news this dose make a diffrence, bad news webui seems to hangs
more bad news
the copy python310.lib
trick also hangs
in a way this can be a good news?
at this point IDK
In my system sys.base_prefix
is /usr
. But I need /usr/lib/python3.10/
among python2.7/ python3/ python3.10/ python3.11/
Also sys.path
is not the same as PATH
env variable, it's a python's thing. For me it defiantly contains required path:
...
/usr/lib/python310.zip
/usr/lib/python3.10
/usr/lib/python3.10/lib-dynload
...
So adding sys.path
I think is correct. Also if it helped you and gave the same result as coping.
Next trouble is hanging... I also have no idea. If you haven't installed cuda toolkit, if shouldn't hang, it should give CUDA_HOME not found while inference
I faced with hanging when I used pip install dlib
instead of pip install dlib-bin
. Because it tries to compile, and crashes in the end. But it supports Windows https://pypi.org/project/dlib-bin/. Can you try with --skip-install flag
maybe be a windows thing for me in venv
import sys
for path in sys.path:
print(path)
B:\GitHub\stable-diffusion-webui\my test <----- this is the root dir of the test script
C:\Programs\Python\3.10.6\python310.zip
C:\Programs\Python\3.10.6\DLLs
C:\Programs\Python\3.10.6\lib <----- lib is not libs
C:\Programs\Python\3.10.6
B:\GitHub\stable-diffusion-webui\venv
B:\GitHub\stable-diffusion-webui\venv\lib\site-packages
B:\GitHub\stable-diffusion-webui\venv\lib\site-packages\win32
B:\GitHub\stable-diffusion-webui\venv\lib\site-packages\win32\lib
B:\GitHub\stable-diffusion-webui\venv\lib\site-packages\Pythonwin
C:\Programs\Python\3.10.6\libs
is not in sys.path
note my python is installed in a custom loacation a default install will be in
C:\Users\<username>\AppData\Local\Programs\Python\Python310
and the libs should be under the libs dir<python install dir>/libs
Oh yes, it has lib but doesn't have libs. I will make sofisticated algorithm which will make path to libs using this sys.path
forund some thing worse when running on windows using webui-user.bat I don't think we actually even activate the venv makeing a PR to change this
Wew Wow, nice catch
So does it work now for you? I've added info about this patch in readme
If yes, maybe it's better to merge this PR after webui 1.10 release, if Auto will add your PR in it
it it possible to get ninja working
tldr add ninja path of not found
def is_ninja_available():
r'''
from https://github.com/pytorch/pytorch/blob/63d5e9221bedd1546b7d364b5ce4171547db12a9/torch/utils/cpp_extension.py#L1838-L1845
Returns ``True`` if the `ninja <https://ninja-build.org/>`_ build system is
available on the system, ``False`` otherwise.
'''
try:
subprocess.check_output('ninja --version'.split())
except Exception:
return False
else:
return True
def add_ninja_to_path():
if not is_ninja_available():
print('Ninja not found in PATH. Trying to add it...')
if os.name == 'nt':
try:
import ninja
os.environ["PATH"] += os.pathsep + ninja.BIN_DIR
is_ninja_available()
except ImportError as e:
print(e)
add_ninja_to_path()
Ah I understood why it didn't required ninja for me. I installed it a long ago in the system
Also it is in PATH
after venv activation
$ . venv/bin/activate
(venv) $ whereis ninja
ninja: /usr/bin/ninja .../stable-diffusion-webui/venv/bin/ninja /usr/share/man/man1/ninja.1.gz
Maybe in windows you need to use
"%VENV_DIR%\Scripts\activate.bat"
With no call
I used this method in VM windows
call "%VENV_DIR%\Scripts\activate.bat"
works
but I still can't get extra_ldflags
working
so far it only works if I copy libs
to venv\Scripts\libys
Similar problem in vanilla webui https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/13465
Note: deforum is not an extension, it's a part of old face restoration repo
Look, it seems I've found https://github.com/andyljones/megastep/blob/d18b1667accd2b357ed0fcc0dd8c363e7b68e23d/docs/tutorials/kernels/compiler.py#L13
>>> import sysconfig
>>> sysconfig.get_config_var('LIBDIR')
'/usr/lib/x86_64-linux-gnu'
And it actully contains python lib
$ ls /usr/lib/x86_64-linux-gnu | grep python
libpyldb-util.cpython-310-x86-64-linux-gnu.so.2
libpyldb-util.cpython-310-x86-64-linux-gnu.so.2.4.4
libpytalloc-util.cpython-310-x86-64-linux-gnu.so.2
libpytalloc-util.cpython-310-x86-64-linux-gnu.so.2.3.3
libpython3.10.a
libpython3.10.so
libpython3.10.so.1
libpython3.10.so.1.0
libsamba-policy.cpython-310-x86-64-linux-gnu.so.0
libsamba-policy.cpython-310-x86-64-linux-gnu.so.0.0.1
I've commited, can you check it
In Windows in VM it doesn't have this variable. But it has others useful:
>>> import sysconfig
>>> sysconfig.get_config_var('LIBDIR')
>>>
>>> sysconfig.get_config_vars()
>>> for var in sysconfig.get_config_vars().items(): print(var)
...
('prefix', 'Z:\\resynthesizer-python-lib\\venv')
('exec_prefix', 'Z:\\resynthesizer-python-lib\\venv')
('py_version', '3.12.4')
('py_version_short', '3.12')
('py_version_nodot', '312')
('installed_base', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312')
('base', 'Z:\\resynthesizer-python-lib\\venv')
('installed_platbase', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312')
('platbase', 'Z:\\resynthesizer-python-lib\\venv')
('projectbase', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312')
('platlibdir', 'DLLs')
('abiflags', '')
('py_version_nodot_plat', '312')
('LIBDEST', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Lib')
('BINLIBDEST', 'Z:\\resynthesizer-python-lib\\venv\\Lib')
('INCLUDEPY', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312\\Include')
('EXT_SUFFIX', '.cp312-win_amd64.pyd')
('EXE', '.exe')
('VERSION', '312')
('BINDIR', '\\\\VBoxSvr\\public\\resynthesizer-python-lib\\venv\\Scripts')
('TZPATH', '')
('VPATH', '..\\..')
('userbase', 'C:\\Users\\User\\AppData\\Roaming\\Python')
('srcdir', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python312')
So I've commited this patch:
def get_extra_ldflags():
path = os.path.join(sysconfig.get_config_var('installed_base'), 'libs')
if os.name == 'nt':
return [f"/LIBPATH:{path}"]
else:
return []
I think should work now, according to my virtual machine. It has this directory:
(venv) C:\Users\User\AppData\Local\Programs\Python\Python312\libs>ls
_tkinter.lib python3.lib python312.lib
at this point I don't know why it hang for me when using extra_ldflags but works when manually copying python310.lib to venv I could be an issue caused by me because the streange things I've done to my system in the past considering this even it does work as is on my system I don't care at this point
when you decide you want to have this merge, now or wait to the venv patch, tell me and I will merge it
You can merge
Info
https://github.com/light-and-ray/sd-webui-face-manipulation-extras
Adds zerodim model zerodim-ffhq-x256 model into Extras tab. Changing of age, gender, ethnicity, hair, facial hair, glasses
Checklist:
Readme.md
index.json
andextension_template.json
have not been modified.entry
is placed in theextensions
directory with the.json
file extension.