Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: upgrade fails if existing venv was created with symlinks #2489

Merged
merged 3 commits into from
Feb 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion installer/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,14 @@ def app_venv(self, path: str = None):
else:
venv_dir = self.dest / ".venv"

venv.create(venv_dir, with_pip=True)
# Prefer to copy python executables
# so that updates to system python don't break InvokeAI
try:
venv.create(venv_dir, with_pip=True)
# If installing over an existing environment previously created with symlinks,
# the executables will fail to copy. Keep symlinks in that case
except shutil.SameFileError:
venv.create(venv_dir, with_pip=True, symlinks=True)

# upgrade pip in Python 3.9 environments
if int(platform.python_version_tuple()[1]) == 9:
Expand Down