Skip to content

Commit

Permalink
add logic for finding the root (runtime) directory (#1948)
Browse files Browse the repository at this point in the history
This commit fixes the root search logic to be as follows:

1) The `--root_dir` command line argument
2) The contents of environment variable INVOKEAI_ROOT
3) The VIRTUAL_ENV environment variable, plus '..'
4) $HOME/invokeai

(3) is the new feature. Since we are now recommending to install
InvokeAI and its dependencies into the .venv in the root directory,
this should be a reliable choice.
  • Loading branch information
lstein committed Dec 12, 2022
1 parent 7314f1a commit 36e6908
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ldm/invoke/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
'''

import os
import os.path as osp
from argparse import Namespace

Globals = Namespace()

# This is usually overwritten by the command line and/or environment variables
Globals.root = os.path.abspath(os.environ.get('INVOKEAI_ROOT') or os.path.expanduser('~/invokeai'))
Globals.root = osp.abspath(os.environ.get('INVOKEAI_ROOT') or osp.abspath(osp.join(os.environ.get('VIRTUAL_ENV'),'..')) or osp.expanduser('~/invokeai'))

# Where to look for the initialization file
Globals.initfile = 'invokeai.init'
Expand Down

0 comments on commit 36e6908

Please sign in to comment.