Summary
On Windows, pywrangler sync does not copy installed dependencies into python_modules/.
That makes local development fail when the Pyodide runtime starts:
ModuleNotFoundError: No module named 'workers'
The same project works on macOS and deploys successfully.
Environment
- OS: Windows
- Python: 3.13.14
- uv: 0.12.5
- pywrangler / workers-py: 1.16.2
Reproduction
With a Python Worker project that has dependencies:
uv sync
uv run pywrangler dev
pywrangler dev then fails because modules that should have been synced cannot be imported.
python_modules/ is empty, or does not contain the expected packages.
Cause
pywrangler/sync.py chooses the source site-packages directory from the host
operating system:
site_packages_path = (
f"lib/python{pyv}/site-packages" if os.name != "nt" else "Lib/site-packages"
)
On Windows, this makes it look in:
But this environment targets Pyodide (emscripten/wasm32), and uv installs the packages using the POSIX-style layout:
lib/python<version>/site-packages
The copy step therefore reads from an empty directory and produces an empty python_modules/ directory.
Expected behavior
pywrangler sync should include project dependencies in python_modules/ on Windows, and pywrangler dev should start successfully.
Workaround
Installing directly into the destination avoids the host-dependent site-packages lookup:
uv pip install --target python_modules/ ...
Using the Pyodide-style lib/python<version>/site-packages path also fixes the immediate problem.
The local patch works, but it is overwritten when workers-py is reinstalled.
Summary
On Windows,
pywrangler syncdoes not copy installed dependencies intopython_modules/.That makes local development fail when the Pyodide runtime starts:
The same project works on macOS and deploys successfully.
Environment
Reproduction
With a Python Worker project that has dependencies:
pywrangler devthen fails because modules that should have been synced cannot be imported.python_modules/is empty, or does not contain the expected packages.Cause
pywrangler/sync.pychooses the source site-packages directory from the hostoperating system:
On Windows, this makes it look in:
But this environment targets Pyodide (
emscripten/wasm32), anduvinstalls the packages using the POSIX-style layout:The copy step therefore reads from an empty directory and produces an empty
python_modules/directory.Expected behavior
pywrangler syncshould include project dependencies inpython_modules/on Windows, andpywrangler devshould start successfully.Workaround
Installing directly into the destination avoids the host-dependent site-packages lookup:
Using the Pyodide-style
lib/python<version>/site-packagespath also fixes the immediate problem.The local patch works, but it is overwritten when
workers-pyis reinstalled.