diff --git a/helpers/llama-pack.ts b/helpers/llama-pack.ts index 01c26212662105f5cf89a0d0b0e98fd3da6b2169..f70bc909aa206cc64fb396127761938578bf3b1d 100644 --- a/helpers/llama-pack.ts +++ b/helpers/llama-pack.ts @@ -86,6 +86,6 @@ export const installLlamapackProject = async ({ await copyData({ root }); await installLlamapackExample({ root, llamapack }); if (postInstallAction !== "none") { - installPythonDependencies(root); + installPythonDependencies({ noRoot: true }); } }; diff --git a/helpers/poetry.ts b/helpers/poetry.ts index a42b2be02d6ea8ba386c59ef34968c7194572f73..fe8759d7cf62e0ed99ea6b03a5a44cab635ec3f9 100644 --- a/helpers/poetry.ts +++ b/helpers/poetry.ts @@ -10,9 +10,11 @@ export function isPoetryAvailable(): boolean { return false; } -export function tryPoetryInstall(): boolean { +export function tryPoetryInstall(noRoot: boolean): boolean { try { - execSync("poetry install", { stdio: "inherit" }); + execSync(`poetry install${noRoot ? " --no-root" : ""}`, { + stdio: "inherit", + }); return true; } catch (_) {} return false; diff --git a/helpers/python.ts b/helpers/python.ts index 163a2f6ba65cb5e843bd5b2f6551d3917acd072d..015e2c269033eb3a4afed8e03428cc6959a32503 100644 --- a/helpers/python.ts +++ b/helpers/python.ts @@ -92,12 +92,14 @@ export const addDependencies = async ( } }; -export const installPythonDependencies = (root: string) => { +export const installPythonDependencies = ( + { noRoot }: { noRoot: boolean } = { noRoot: false }, +) => { if (isPoetryAvailable()) { console.log( `Installing python dependencies using poetry. This may take a while...`, ); - const installSuccessful = tryPoetryInstall(); + const installSuccessful = tryPoetryInstall(noRoot); if (!installSuccessful) { console.error( red("Install failed. Please install dependencies manually."), @@ -181,6 +183,6 @@ export const installPythonTemplate = async ({ await addDependencies(root, addOnDependencies); if (postInstallAction !== "none") { - installPythonDependencies(root); + installPythonDependencies(); } };