mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(installer): minor logic fixes
This commit is contained in:
parent
d397beaa47
commit
1c8fc908b2
@ -27,14 +27,14 @@ class Installer:
|
|||||||
Deploys an InvokeAI installation into a given path
|
Deploys an InvokeAI installation into a given path
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
reqs: list[str] = INSTALLER_REQS
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self.reqs = INSTALLER_REQS
|
|
||||||
if os.getenv("VIRTUAL_ENV") is not None:
|
if os.getenv("VIRTUAL_ENV") is not None:
|
||||||
print("A virtual environment is already activated. Please 'deactivate' before installation.")
|
print("A virtual environment is already activated. Please 'deactivate' before installation.")
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
self.bootstrap()
|
self.bootstrap()
|
||||||
|
|
||||||
|
|
||||||
def mktemp_venv(self) -> TemporaryDirectory:
|
def mktemp_venv(self) -> TemporaryDirectory:
|
||||||
"""
|
"""
|
||||||
Creates a temporary virtual environment for the installer itself
|
Creates a temporary virtual environment for the installer itself
|
||||||
@ -86,19 +86,12 @@ class Installer:
|
|||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
def app_venv(self, path: Optional[str] = None) -> Path:
|
def app_venv(self, venv_parent) -> Path:
|
||||||
"""
|
"""
|
||||||
Create a virtualenv for the InvokeAI installation
|
Create a virtualenv for the InvokeAI installation
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# explicit venv location
|
venv_dir = venv_parent / ".venv"
|
||||||
# currently unused in normal operation
|
|
||||||
# useful for testing or special cases
|
|
||||||
if path is not None:
|
|
||||||
venv_dir = Path(path)
|
|
||||||
|
|
||||||
else:
|
|
||||||
venv_dir = self.dest / ".venv"
|
|
||||||
|
|
||||||
# Prefer to copy python executables
|
# Prefer to copy python executables
|
||||||
# so that updates to system python don't break InvokeAI
|
# so that updates to system python don't break InvokeAI
|
||||||
@ -131,16 +124,16 @@ class Installer:
|
|||||||
|
|
||||||
messages.welcome()
|
messages.welcome()
|
||||||
|
|
||||||
default_path = Path(os.environ.get("INVOKEAI_ROOT") or Path(root).expanduser().resolve())
|
auto_dest = Path(os.environ.get("INVOKEAI_ROOT", root)).expanduser().resolve()
|
||||||
self.dest = default_path if yes_to_all else messages.dest_path(root)
|
destination = auto_dest if yes_to_all else messages.dest_path(root)
|
||||||
if self.dest is None:
|
if destination is None:
|
||||||
print("Could not find or create the destination directory. Installation cancelled.")
|
print("Could not find or create the destination directory. Installation cancelled.")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# create the venv for the app
|
# create the venv for the app
|
||||||
self.venv = self.app_venv()
|
self.venv = self.app_venv(venv_parent=destination)
|
||||||
|
|
||||||
self.instance = InvokeAiInstance(runtime=self.dest, venv=self.venv, version=version)
|
self.instance = InvokeAiInstance(runtime=destination, venv=self.venv, version=version)
|
||||||
|
|
||||||
# install dependencies and the InvokeAI application
|
# install dependencies and the InvokeAI application
|
||||||
(extra_index_url, optional_modules) = get_torch_source() if not yes_to_all else (None, None)
|
(extra_index_url, optional_modules) = get_torch_source() if not yes_to_all else (None, None)
|
||||||
|
Loading…
Reference in New Issue
Block a user