diff --git a/src/py/flwr/cli/new/new.py b/src/py/flwr/cli/new/new.py index a0a2dc98556d..9a996d63b342 100644 --- a/src/py/flwr/cli/new/new.py +++ b/src/py/flwr/cli/new/new.py @@ -16,6 +16,7 @@ import os import re +import subprocess from enum import Enum from string import Template from typing import Dict, Optional @@ -256,6 +257,21 @@ def new( context=context, ) + try: + subprocess.run( + ["pip", "install", "-e", project_dir, "--no-deps"], + capture_output=True, + text=True, + check=True, + ) + except subprocess.CalledProcessError as e: + typer.secho( + f"❌ Failed to install the package from {project_dir}:\n{e.stderr}", + fg=typer.colors.RED, + bold=True, + ) + raise typer.Exit(code=1) from e + print( typer.style( "🎊 Project creation successful.\n\n" @@ -268,7 +284,7 @@ def new( _add = " huggingface-cli login\n" if framework_str == "flowertune" else "" print( typer.style( - f" cd {package_name}\n" + " pip install -e .\n" + _add + " flwr run\n", + f" cd {package_name}\n" + _add + " flwr run\n", fg=typer.colors.BRIGHT_CYAN, bold=True, )