lshqqytiger / stable-diffusion-webui-amdgpu

Stable Diffusion web UI
GNU Affero General Public License v3.0
1.8k stars 186 forks source link

[Bug]: AttributeError: module 'os' has no attribute 'statvfs' #229

Closed Diamondturtle99 closed 1 year ago

Diamondturtle99 commented 1 year ago

Is there an existing issue for this?

What happened?

I did it normally as I would, I added my command line args, renamed the webui-user.bat to webui.settings.bat (I got this error even before I renamed the file), it proceded as normal until it got to 'Launching Web UI with arguments: --opt-sub-quad-attention --lowvram --disable-nan-check' then I got this error:

image

Steps to reproduce the problem

Run it as normal with the args --opt-sub-quad-attention --lowvram --disable-nan-check

What should have happened?

It should have launched the ui like normal

Version or Commit where the problem happens

v1.5.1

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

Windows

What device are you running WebUI on?

No response

Cross attention optimization

None

What browsers do you use to access the UI ?

Microsoft Edge

Command Line Arguments

--opt-sub-quad-attention --lowvram --disable-nan-check

List of extensions

No

Console logs

venv "C:\Users\ryano\Music\stable-diffusion-webui-directml\venv\Scripts\Python.exe"
fatal: No names found, cannot describe anything.
Python 3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)]
Version: 1.5.1
Commit hash: b180d1df30125ed606f94a779536f2dfb8aca74a
Launching Web UI with arguments: --opt-sub-quad-attention --lowvram --disable-nan-check
Traceback (most recent call last):
  File "C:\Users\ryano\Music\stable-diffusion-webui-directml\launch.py", line 39, in <module>
    main()
  File "C:\Users\ryano\Music\stable-diffusion-webui-directml\launch.py", line 35, in main
    start()
  File "C:\Users\ryano\Music\stable-diffusion-webui-directml\modules\launch_utils.py", line 443, in start
    import webui
  File "C:\Users\ryano\Music\stable-diffusion-webui-directml\webui.py", line 44, in <module>
    import gradio  # noqa: F401
  File "C:\Users\ryano\Music\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\__init__.py", line 3, in <module>
    import gradio.components as components
  File "C:\Users\ryano\Music\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\components.py", line 56, in <module>
    from gradio.blocks import Block, BlockContext
  File "C:\Users\ryano\Music\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\blocks.py", line 26, in <module>
    from gradio import (
  File "C:\Users\ryano\Music\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\networking.py", line 17, in <module>
    from gradio.routes import App
  File "C:\Users\ryano\Music\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\routes.py", line 43, in <module>
    import gradio.ranged_response as ranged_response
  File "C:\Users\ryano\Music\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\ranged_response.py", line 12, in <module>
    from aiofiles.os import stat as aio_stat
  File "C:\Users\ryano\Music\stable-diffusion-webui-directml\venv\lib\site-packages\aiofiles\os.py", line 32, in <module>
    statvfs = wrap(os.statvfs)
AttributeError: module 'os' has no attribute 'statvfs'
Press any key to continue . . .

Additional information

No response

genok commented 1 year ago

I have the same error

Diamondturtle99 commented 1 year ago

Yeah. I'm going to try uninstalling everything and reinstalling it. I just rebooted and updated.

genok commented 1 year ago

I have clean installation, but have this error, rebot or reinstall not help

Diamondturtle99 commented 1 year ago

Yeah me too.

Diamondturtle99 commented 1 year ago

do you know how to git clone an earlier version of a repo

genok commented 1 year ago

I just don't understand why you have Python 3.10.0, I have Python 3.10.9, but it should be like Python 3.10.6

Diamondturtle99 commented 1 year ago

I just downloaded any version of 3.10.X

Diamondturtle99 commented 1 year ago

okay I'm trying to use version 3f69a46aced47d8b14a9abb24181231ae7976966

genok commented 1 year ago

This is my log

From https://github.com/AUTOMATIC1111/stable-diffusion-webui
 * branch              master     -> FETCH_HEAD
Already up to date.
venv "venv\Scripts\Python.exe"
fatal: No names found, cannot describe anything.
Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
Version: 1.5.1
Commit hash: 68f336bd994bed5442ad95bad6b6ad5564a5409a
Launching Web UI with arguments: --opt-sdp-attention --autolaunch
Traceback (most recent call last):
  File "d:\apps\stable-diffusion-portable-main\launch.py", line 39, in <module>
    main()
  File "d:\apps\stable-diffusion-portable-main\launch.py", line 35, in main
    start()
  File "d:\apps\stable-diffusion-portable-main\modules\launch_utils.py", line 390, in start
    import webui
  File "d:\apps\stable-diffusion-portable-main\webui.py", line 44, in <module>
    import gradio  # noqa: F401
  File "d:\apps\stable-diffusion-portable-main\venv\lib\site-packages\gradio\__init__.py", line 3, in <module>
    import gradio.components as components
  File "d:\apps\stable-diffusion-portable-main\venv\lib\site-packages\gradio\components.py", line 56, in <module>
    from gradio.blocks import Block, BlockContext
  File "d:\apps\stable-diffusion-portable-main\venv\lib\site-packages\gradio\blocks.py", line 26, in <module>
    from gradio import (
  File "d:\apps\stable-diffusion-portable-main\venv\lib\site-packages\gradio\networking.py", line 17, in <module>
    from gradio.routes import App
  File "d:\apps\stable-diffusion-portable-main\venv\lib\site-packages\gradio\routes.py", line 43, in <module>
    import gradio.ranged_response as ranged_response
  File "d:\apps\stable-diffusion-portable-main\venv\lib\site-packages\gradio\ranged_response.py", line 12, in <module>
    from aiofiles.os import stat as aio_stat
  File "d:\apps\stable-diffusion-portable-main\venv\lib\site-packages\aiofiles\os.py", line 32, in <module>
    statvfs = wrap(os.statvfs)
AttributeError: module 'os' has no attribute 'statvfs'
Diamondturtle99 commented 1 year ago

Seems the same as mine

Diamondturtle99 commented 1 year ago

I got the error with the previous version too.

genok commented 1 year ago

magic, two people hawe the same error, but google dont now about this problem, only this old chinese mention https://github.com/IDEA-CCNL/Fengshenbang-LM/issues/237

Diamondturtle99 commented 1 year ago

Got it: Modify line 422 of \stable-diffusion-webui\modules\images.py max_length = os.statvfs(dir_name).f_namemax For fixed value max_length = 255

MiZubiKi commented 1 year ago

Got it: Modify line 422 of \stable-diffusion-webui\modules\images.py max_length = os.statvfs(dir_name).f_namemax For fixed value max_length = 255

Have the same issu as you two...

But at line 422 i dont have this variable: image

genok commented 1 year ago

Got it: Modify line 422 of \stable-diffusion-webui\modules\images.py max_length = os.statvfs(dir_name).f_namemax For fixed value max_length = 255

did it help you? I didn't find it myself

genok commented 1 year ago

Have the same issu as you two...

But at line 422 i dont have this variable:

this is old information, 2022 year

MiZubiKi commented 1 year ago

ok i opened all files and found something in images.py in line 648 image

Changed max. length to 255 doesn't work for me...

0xBC13FE commented 1 year ago

I had this issue too. A friend helped me out with a work-around. The fault is a Gradio update. To fix this for now what you can do is change line 33 in stable-diffusion-webui\venv\Lib\site-packages\aiofiles\os.py from:

statvfs = wrap(os.statvfs)

to

if platform.system() == "Linux":
    statvfs = wrap(os.statvfs)

You're basically skipping the 'Is this machine a linux machine' check by this.

Diamondturtle99 commented 1 year ago

Ok I'll try these fixes. Thanks for the help!

MiZubiKi commented 1 year ago

I had this issue too. A friend helped me out with a work-around. The fault is a Gradio update. To fix this for now what you can do is change line 33 in stable-diffusion-webui\venv\Lib\site-packages\aiofiles\os.py from:

statvfs = wrap(os.statvfs)

to

if platform.system() == "Linux":
    statvfs = wrap(os.statvfs)

You're basically skipping the 'Is this machine a linux machine' check by this.

I did this: stat = wrap(os.stat) if platform.system() == "Linux": statvfs = wrap(os.statvfs) rename = wrap(os.rename)

And get this: File "D:\A1111\stable-diffusion-webui\venv\lib\site-packages\aiofiles\os.py", line 32, in if platform.system() == "Linux": NameError: name 'platform' is not defined

0xBC13FE commented 1 year ago

Try using mine. It's the same.. But it worked for a few people before. os.zip

Diamondturtle99 commented 1 year ago

So is this just the file?

0xBC13FE commented 1 year ago

So is this just the file?

Correct. If you don't trust it, understandable. It's my copy of the os.py file. If anything just run it through antivirus or w/e to be sure.

Diamondturtle99 commented 1 year ago

Okay ty

0xBC13FE commented 1 year ago

Or! You could just copy all of this and replace the contents of your original:

"""Async executor versions of file functions from the os module."""
import os
import platform

from . import ospath as path
from .ospath import wrap

__all__ = [
    "path",
    "stat",
    "statvfs",
    "rename",
    "renames",
    "replace",
    "remove",
    "unlink",
    "mkdir",
    "makedirs",
    "rmdir",
    "removedirs",
    "link",
    "symlink",
    "readlink",
    "listdir",
    "scandir",
    "access",
    "sendfile",
    "wrap",
]

stat = wrap(os.stat)
if platform.system() == "Linux":
    statvfs = wrap(os.statvfs)
rename = wrap(os.rename)
renames = wrap(os.renames)
replace = wrap(os.replace)
remove = wrap(os.remove)
unlink = wrap(os.unlink)
mkdir = wrap(os.mkdir)
makedirs = wrap(os.makedirs)
rmdir = wrap(os.rmdir)
removedirs = wrap(os.removedirs)
link = wrap(os.link)
symlink = wrap(os.symlink)
readlink = wrap(os.readlink)
listdir = wrap(os.listdir)
scandir = wrap(os.scandir)
access = wrap(os.access)

if hasattr(os, "sendfile"):
    sendfile = wrap(os.sendfile)
MiZubiKi commented 1 year ago

I copied your comment in my os.py and it worked :-) Thx [SOLVED]

Diamondturtle99 commented 1 year ago

Ty everyone

Diamondturtle99 commented 1 year ago

Yay. It worked :)

ThePriest69 commented 1 year ago

Or! You could just copy all of this and replace the contents of your original:

"""Async executor versions of file functions from the os module."""
import os
import platform

from . import ospath as path
from .ospath import wrap

__all__ = [
    "path",
    "stat",
    "statvfs",
    "rename",
    "renames",
    "replace",
    "remove",
    "unlink",
    "mkdir",
    "makedirs",
    "rmdir",
    "removedirs",
    "link",
    "symlink",
    "readlink",
    "listdir",
    "scandir",
    "access",
    "sendfile",
    "wrap",
]

stat = wrap(os.stat)
if platform.system() == "Linux":
    statvfs = wrap(os.statvfs)
rename = wrap(os.rename)
renames = wrap(os.renames)
replace = wrap(os.replace)
remove = wrap(os.remove)
unlink = wrap(os.unlink)
mkdir = wrap(os.mkdir)
makedirs = wrap(os.makedirs)
rmdir = wrap(os.rmdir)
removedirs = wrap(os.removedirs)
link = wrap(os.link)
symlink = wrap(os.symlink)
readlink = wrap(os.readlink)
listdir = wrap(os.listdir)
scandir = wrap(os.scandir)
access = wrap(os.access)

if hasattr(os, "sendfile"):
    sendfile = wrap(os.sendfile)

it worked for me. thank you so much.

Gasyary commented 1 year ago

It also works for me, Thank you. but now I had ModuleNotFoundError: No module named 'jsonmerge'

sheesh

Diamondturtle99 commented 1 year ago

okay this is getting sad now. This repo needs some more commits like now.

Diamondturtle99 commented 1 year ago

anyone know the creator's email?

snooki55 commented 1 year ago

Or! You could just copy all of this and replace the contents of your original:

"""Async executor versions of file functions from the os module."""
import os
import platform

from . import ospath as path
from .ospath import wrap

__all__ = [
    "path",
    "stat",
    "statvfs",
    "rename",
    "renames",
    "replace",
    "remove",
    "unlink",
    "mkdir",
    "makedirs",
    "rmdir",
    "removedirs",
    "link",
    "symlink",
    "readlink",
    "listdir",
    "scandir",
    "access",
    "sendfile",
    "wrap",
]

stat = wrap(os.stat)
if platform.system() == "Linux":
    statvfs = wrap(os.statvfs)
rename = wrap(os.rename)
renames = wrap(os.renames)
replace = wrap(os.replace)
remove = wrap(os.remove)
unlink = wrap(os.unlink)
mkdir = wrap(os.mkdir)
makedirs = wrap(os.makedirs)
rmdir = wrap(os.rmdir)
removedirs = wrap(os.removedirs)
link = wrap(os.link)
symlink = wrap(os.symlink)
readlink = wrap(os.readlink)
listdir = wrap(os.listdir)
scandir = wrap(os.scandir)
access = wrap(os.access)

if hasattr(os, "sendfile"):
    sendfile = wrap(os.sendfile)

it worked for me. thank you so much.

where do i copy this ?

smalllo commented 1 year ago

或者!您可以復制所有這些並替換原始內容:

"""Async executor versions of file functions from the os module."""
import os
import platform

from . import ospath as path
from .ospath import wrap

__all__ = [
    "path",
    "stat",
    "statvfs",
    "rename",
    "renames",
    "replace",
    "remove",
    "unlink",
    "mkdir",
    "makedirs",
    "rmdir",
    "removedirs",
    "link",
    "symlink",
    "readlink",
    "listdir",
    "scandir",
    "access",
    "sendfile",
    "wrap",
]

stat = wrap(os.stat)
if platform.system() == "Linux":
    statvfs = wrap(os.statvfs)
rename = wrap(os.rename)
renames = wrap(os.renames)
replace = wrap(os.replace)
remove = wrap(os.remove)
unlink = wrap(os.unlink)
mkdir = wrap(os.mkdir)
makedirs = wrap(os.makedirs)
rmdir = wrap(os.rmdir)
removedirs = wrap(os.removedirs)
link = wrap(os.link)
symlink = wrap(os.symlink)
readlink = wrap(os.readlink)
listdir = wrap(os.listdir)
scandir = wrap(os.scandir)
access = wrap(os.access)

if hasattr(os, "sendfile"):
    sendfile = wrap(os.sendfile)

stable-diffusion-webui\venv\Lib\site-packages\aiofiles\os.py THX P3kuru this helps me

Aryan384 commented 1 year ago

I had this issue too. A friend helped me out with a work-around. The fault is a Gradio update. To fix this for now what you can do is change line 33 in stable-diffusion-webui\venv\Lib\site-packages\aiofiles\os.py from:

statvfs = wrap(os.statvfs)

to

if platform.system() == "Linux":
    statvfs = wrap(os.statvfs)

You're basically skipping the 'Is this machine a linux machine' check by this.

or you could just do #statvfs = wrap(os.statvfs) and problem solved.

Nyksia commented 1 year ago

I had this issue too. A friend helped me out with a work-around. The fault is a Gradio update. To fix this for now what you can do is change line 33 in stable-diffusion-webui\venv\Lib\site-packages\aiofiles\os.py from:

statvfs = wrap(os.statvfs)

to

if platform.system() == "Linux":
    statvfs = wrap(os.statvfs)

You're basically skipping the 'Is this machine a linux machine' check by this.

or you could just do #statvfs = wrap(os.statvfs) and problem solved.

That can break functionality for Linux systems. statvfs is a Unix exclusive feature.

lshqqytiger commented 1 year ago

https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/12433