Skip to content

Commit 09a3215

Browse files
HanSur94claude
andcommitted
fix: install MATLAB Engine API fully offline with --no-build-isolation
The MATLAB Engine files are already local on disk but pip was trying to download setuptools into an isolated build env, which failed behind corporate SSL proxies. Using --no-build-isolation tells pip to use the venv's existing setuptools instead of downloading anything. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f55f9a3 commit 09a3215

1 file changed

Lines changed: 20 additions & 13 deletions

File tree

install.bat

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -198,25 +198,32 @@ echo [OK] Virtual environment ready at %VENV_DIR%
198198
echo.
199199

200200
:: ----------------------------------------------------------------------------
201-
:: 4b. Upgrade pip, setuptools, wheel (required before any other installs)
202-
:: --trusted-host flags handle corporate proxies with SSL inspection
201+
:: 4b. Ensure setuptools and wheel are available in the venv.
202+
:: Python 3.10 venv ships these by default, but verify to be safe.
203+
:: --trusted-host flags handle corporate proxies with SSL inspection.
203204
:: ----------------------------------------------------------------------------
204205
set "PIP_TRUST=--trusted-host pypi.org --trusted-host files.pythonhosted.org"
205206

206-
echo Upgrading pip, setuptools, and wheel...
207-
python -m pip install --upgrade pip setuptools wheel %PIP_TRUST% --quiet 2>&1
207+
:: Check if setuptools is already in the venv (it usually is from python -m venv)
208+
python -c "import setuptools" >nul 2>&1
208209
if %errorlevel% neq 0 (
209-
echo [WARNING] Could not upgrade pip. Trying with certificate verification disabled...
210-
python -m pip install --upgrade pip setuptools wheel %PIP_TRUST% --quiet --cert "" 2>nul
210+
echo Bootstrapping setuptools and wheel...
211+
python -m pip install --upgrade pip setuptools wheel %PIP_TRUST% --quiet 2>&1
211212
if %errorlevel% neq 0 (
212-
echo [WARNING] pip upgrade failed. Continuing with existing pip version.
213-
echo If installs fail below, check your network/proxy settings.
213+
echo [WARNING] Could not install setuptools from network.
214+
echo MATLAB Engine API install may fail if build tools are missing.
214215
)
216+
) else (
217+
echo [OK] setuptools already available in venv.
218+
:: Try upgrading pip quietly — not critical if it fails
219+
python -m pip install --upgrade pip %PIP_TRUST% --quiet 2>nul
215220
)
216221
echo.
217222

218223
:: ----------------------------------------------------------------------------
219-
:: 5. Install MATLAB Engine API (into the venv — no admin needed)
224+
:: 5. Install MATLAB Engine API (fully offline — no downloads needed)
225+
:: --no-build-isolation tells pip to use the venv's setuptools instead of
226+
:: downloading a fresh copy into an isolated build environment.
220227
:: ----------------------------------------------------------------------------
221228
echo [4/6] Installing MATLAB Engine API for Python...
222229

@@ -230,17 +237,17 @@ python -c "import matlab.engine" >nul 2>&1
230237
if %errorlevel% equ 0 (
231238
echo MATLAB Engine API already installed. Skipping.
232239
) else (
233-
echo Installing from !ENGINE_API_DIR! ...
234-
pip install "!ENGINE_API_DIR!" %PIP_TRUST% --quiet 2>&1
240+
echo Installing from !ENGINE_API_DIR! (offline, no download needed^)...
241+
pip install "!ENGINE_API_DIR!" --no-build-isolation --quiet 2>&1
235242
if %errorlevel% neq 0 (
236243
echo.
237244
echo [WARNING] MATLAB Engine API installation failed.
238245
echo This can happen if your MATLAB version is incompatible
239-
echo with Python %PYTHON_VERSION%, or due to network/proxy issues.
246+
echo with Python %PYTHON_VERSION%.
240247
echo.
241248
echo To install manually later, run:
242249
echo call "%VENV_DIR%\Scripts\activate.bat"
243-
echo pip install "!ENGINE_API_DIR!"
250+
echo pip install "!ENGINE_API_DIR!" --no-build-isolation
244251
echo.
245252
echo Continuing with MCP server installation...
246253
) else (

0 commit comments

Comments
 (0)