PolyHedra / docs /POWERSHELL_FIX.md
yf176
Deploy Polyhedra to HF Spaces
891fe52
|
Raw History Blame Contribute Delete
2.11 kB

PowerShell Execution Policy Fix

Problem Description

Windows PowerShell blocks script execution by default as a security policy.

🚀 Solutions (3 Methods)

Method 1: Use Batch Files (Easiest)

No settings changes needed, just double-click to run:

test_quick.bat    # Quick diagnostic
run_demo.bat      # Run demo

Or in command line:

test_quick.bat

Method 2: Temporarily Allow Current Session (Recommended)

Run each time you open a new PowerShell window:

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process

Then you can run .ps1 scripts:

.\test_quick.ps1

Method 3: Permanent Change (Requires Admin)

Open PowerShell as Administrator, then run:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Select Y to confirm.

After this, you can run scripts normally.


Method 4: Use Python Directly (No Scripts Needed)

No dependency on PowerShell or batch files:

# Quick diagnostic
.venv\Scripts\python.exe test_fix.py

# Run demo
.venv\Scripts\python.exe demo_search.py

# Run tests
.venv\Scripts\python.exe -m pytest

⚡ Start Immediately (No Policy Changes Needed)

Option A: Use Batch Files

test_quick.bat

Option B: Use Python Directly

.venv\Scripts\python.exe test_fix.py

Option C: Temporary Bypass (Single Command)

powershell -ExecutionPolicy Bypass -File .\test_quick.ps1

Recommended Workflow

REM 1. Quick diagnostic
.venv\Scripts\python.exe test_fix.py

REM 2. Run demo
.venv\Scripts\python.exe demo_search.py

REM 3. VS Code will auto-start MCP server
REM    Just reload the window

Security Notes

  • Bypass: Only affects current PowerShell session, reverts after closing
  • RemoteSigned: Only allows local scripts and signed remote scripts (recommended)
  • Unrestricted: Allows all scripts (not recommended)

More info: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_execution_policies