Skip to content

Commit b89a4a0

Browse files
authored
Add warning for existing build/ directory in env setup (#441)
1 parent ab840ed commit b89a4a0

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
@@ -205,8 +205,26 @@ else
205205
log_warn "Skipping monarch torch import hack (monarch may not be installed yet)"
206206
fi
207207

208-
# Step 4: Install forge package
209-
log_info "Step 4: Installing forge package..."
208+
# Step 4: Check for existing build directory and warn user
209+
log_info "Step 4: Checking for existing build directory..."
210+
if [ -d "build" ]; then
211+
log_warn "Detected existing build/ directory at: $(pwd)/build"
212+
log_warn "This directory may contain artifacts from a previous pip installation"
213+
log_warn "that could interfere with the current installation."
214+
log_warn "If you encounter issues, manually remove it with: rm -rf build"
215+
echo ""
216+
read -p "$(echo -e ${YELLOW}Do you want to continue anyway? [y/N]:${NC} )" -n 1 -r
217+
echo ""
218+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
219+
log_info "Installation cancelled by user"
220+
log_info "You can manually remove the build/ directory with: rm -rf build"
221+
exit 0
222+
fi
223+
log_warn "Continuing with existing build/ directory. Things might go wrong!"
224+
fi
225+
226+
# Step 5: Install forge package
227+
log_info "Step 5: Installing forge package..."
210228
pip install --no-deps --force-reinstall .
211229
if [ $? -ne 0 ]; then
212230
log_error "Failed to install forge package"
@@ -248,7 +266,7 @@ log_info "Unsetting CUDA_HOME and overwriting the LD_LIBRARY_PATH"
248266
unset CUDA_HOME
249267
export LD_LIBRARY_PATH=${CONDA_PREFIX}/lib
250268

251-
# Step 5: Ask user to test
269+
# Step 6: Ask user to test
252270
echo ""
253271
log_info "Installation completed successfully!"
254272
echo ""

0 commit comments

Comments
 (0)