Skip to content

Commit b185931

Browse files
authored
[Bugfix] Pip - Access is denied durring installation (#3123)
Now, for python 3.9 installer run upgrade pip command like this: `pip install --upgrade pip` And because pip binary locked as running process this lead to error(at least on windows): ``` ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'e:\invokeai\.venv\scripts\pip.exe' Check the permissions. ``` To prevent this recomended command to upgrade pip is: `python -m pip install --upgrade pip` Which not locking pip file.
2 parents 4e4fa1b + 1a4d229 commit b185931

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

installer/lib/installer.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ def app_venv(self, path: str = None):
144144

145145
from plumbum import FG, local
146146

147-
pip = local[get_pip_from_venv(venv_dir)]
148-
pip[ "install", "--upgrade", "pip"] & FG
147+
python = local[get_python_from_venv(venv_dir)]
148+
python[ "-m", "pip", "install", "--upgrade", "pip"] & FG
149149

150150
return venv_dir
151151

@@ -412,6 +412,22 @@ def get_pip_from_venv(venv_path: Path) -> str:
412412
return str(venv_path.expanduser().resolve() / pip)
413413

414414

415+
def get_python_from_venv(venv_path: Path) -> str:
416+
"""
417+
Given a path to a virtual environment, get the absolute path to the `python` executable
418+
in a cross-platform fashion. Does not validate that the python executable
419+
actually exists in the virtualenv.
420+
421+
:param venv_path: Path to the virtual environment
422+
:type venv_path: Path
423+
:return: Absolute path to the python executable
424+
:rtype: str
425+
"""
426+
427+
python = "Scripts\python.exe" if OS == "Windows" else "bin/python"
428+
return str(venv_path.expanduser().resolve() / python)
429+
430+
415431
def set_sys_path(venv_path: Path) -> None:
416432
"""
417433
Given a path to a virtual environment, set the sys.path, in a cross-platform fashion,

0 commit comments

Comments
 (0)