Skip to content

Commit f1596eb

Browse files
committed
Add warning for existing build/ directory in env setup
The env_setup.sh script now checks for an existing build/ directory before installing the forge package. If found, it warns the user that the directory may contain artifacts from a previous pip installation that could interfere with the current installation. The user is prompted to continue or cancel, with instructions on how to manually remove the build/ directory if they encounter issues.
1 parent ad3f3f5 commit f1596eb

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

.meta/mast/env_setup.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,26 @@ else
259259
log_warn "Skipping monarch torch import hack (monarch may not be installed yet)"
260260
fi
261261

262-
# Step 6: Install forge package
263-
log_info "Step 6: Installing forge package..."
262+
# Step 6: Check for existing build directory and warn user
263+
log_info "Step 6: Checking for existing build directory..."
264+
if [ -d "$FORGE_REPO_DIR/build" ]; then
265+
log_warn "Detected existing build/ directory at: $FORGE_REPO_DIR/build"
266+
log_warn "This directory may contain artifacts from a previous pip installation"
267+
log_warn "that could interfere with the current installation."
268+
log_warn "If you encounter issues, manually remove it with: rm -rf $FORGE_REPO_DIR/build"
269+
echo ""
270+
read -p "$(echo -e ${YELLOW}Do you want to continue anyway? [y/N]:${NC} )" -n 1 -r
271+
echo ""
272+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
273+
log_info "Installation cancelled by user"
274+
log_info "You can manually remove the build/ directory with: rm -rf $FORGE_REPO_DIR/build"
275+
exit 0
276+
fi
277+
log_warn "Continuing with existing build/ directory. Things might go wrong!"
278+
fi
279+
280+
# Step 7: Install forge package
281+
log_info "Step 7: Installing forge package..."
264282
pip install --no-deps --force-reinstall .
265283
if [ $? -ne 0 ]; then
266284
log_error "Failed to install forge package"
@@ -298,7 +316,7 @@ pip list | grep -E "(forge|monarch)" || log_warn "No forge/monarch packages foun
298316
log_info "Environment setup complete! You can now run your scripts."
299317
log_info "Mounted workspace available at: /mnt/wsfuse"
300318

301-
# Step 6: Ask user to deactivate and activate conda env conda environment
319+
# Step 8: Ask user to deactivate and activate conda env conda environment
302320
echo ""
303321
log_info "Installation completed successfully!"
304322
echo ""

0 commit comments

Comments
 (0)