Skip to content

Commit d81394c

Browse files
committed
fix directory permissions after install
1 parent a775c77 commit d81394c

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

ldm/invoke/config/invokeai_configure.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,12 @@ def initialize_rootdir(root: str, yes_to_all: bool = False):
669669
dirs_exist_ok=True,
670670
copy_function=shutil.copyfile,
671671
)
672+
# Fix up directory permissions so that they are writable
673+
# This can happen when running under Nix environment which
674+
# makes the runtime directory template immutable.
675+
for root,dirs,_ in os.walk(os.path.join(root,name)):
676+
for d in dirs:
677+
Path(root,d).chmod(0o775)
672678

673679
# -------------------------------------
674680
def run_console_ui(

ldm/invoke/config/invokeai_update.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,13 @@ def do_post_install():
4747
'''
4848
Run postinstallation script.
4949
'''
50-
from ldm.invoke.config.post_install.py import post_install
51-
post_install()
52-
50+
print("Looking for postinstallation script to run on this version...")
51+
try:
52+
from ldm.invoke.config.post_install.py import post_install
53+
post_install()
54+
except:
55+
print("Postinstallation script not available for this version of InvokeAI")
56+
5357
def welcome(versions: dict):
5458

5559
@group()

ldm/invoke/config/model_install_backend.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,12 @@ def update_config_file(successfully_downloaded: dict, config_file: Path):
394394
dirs_exist_ok=True,
395395
copy_function=shutil.copyfile,
396396
)
397+
# Fix up directory permissions so that they are writable
398+
# This can happen when running under Nix environment which
399+
# makes the runtime directory template immutable.
400+
for root,dirs,_ in os.walk(default_config_file().parent):
401+
for d in dirs:
402+
Path(root,d).chmod(0o775)
397403

398404
yaml = new_config_file_contents(successfully_downloaded, config_file)
399405

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dependencies = [
3434
"clip_anytorch",
3535
"compel~=1.1.0",
3636
"datasets",
37-
"diffusers[torch]~=0.14",
37+
"diffusers[torch]==0.14",
3838
"dnspython==2.2.1",
3939
"einops",
4040
"eventlet",

0 commit comments

Comments
 (0)