From 8bbbef47912ba7cdf6877ca3f0dad1dc0adb9770 Mon Sep 17 00:00:00 2001 From: Believethehype Date: Wed, 20 Dec 2023 17:51:14 +0100 Subject: [PATCH] fix for creating venvs on windows --- nostr_dvm/interfaces/dvmtaskinterface.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nostr_dvm/interfaces/dvmtaskinterface.py b/nostr_dvm/interfaces/dvmtaskinterface.py index 3035ef4..0058591 100644 --- a/nostr_dvm/interfaces/dvmtaskinterface.py +++ b/nostr_dvm/interfaces/dvmtaskinterface.py @@ -3,6 +3,7 @@ import os import subprocess from subprocess import run import sys +from sys import platform from threading import Thread from venv import create from nostr_sdk import Keys @@ -59,15 +60,18 @@ class DVMTaskInterface: def install_dependencies(self, dvm_config): if dvm_config.SCRIPT != "": if self.dvm_config.USE_OWN_VENV: - dir = r'cache/venvs/' + os.path.basename(dvm_config.SCRIPT).split(".py")[0] + pip_location = 'bin/pip' + if platform == "win32": + pip_location = dir + '/Scripts/pip' + if not os.path.isdir(dir): - print(dir) + print("Creating Venv: " + dir) create(dir, with_pip=True, upgrade_deps=True) self.dependencies.append(("nostr-dvm", "nostr-dvm")) for (module, package) in self.dependencies: print("Installing Venv Module: " + module) - run(["bin/pip", "install", "--force-reinstall", package], cwd=dir) + run([pip_location, "install", "--force-reinstall", package], cwd=dir) else: for module, package in self.dependencies: if module != "nostr-dvm":