Fix “ImportError: no module named 'network'” on the Pico
The firmware on your board has no Wi-Fi support. Usually it is the plain Pico UF2 flashed onto a Pico W — flash the Pico W (or Pico 2 W) build instead.
Community draft — report a mistake
What you see
MicroPython v1.24.1 on 2024-11-29; Raspberry Pi Pico with RP2040
Type "help()" for more information.
>>> import network
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'network'MicroPython v1.24.1 on 2024-11-29; Raspberry Pi Pico with RP2040 Type "help()" for more information. >>> import network Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: no module named 'network'
MicroPython only includes the network module in builds made for boards that have a radio. The Pico and Pico W share one chip but need different firmware files, and it is easy to flash the wrong one.
The quick test after flashing the right UF2:
import network
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
print(wlan.scan()) # list of nearby 2.4 GHz networks
If that prints a list of networks, the firmware and the Wi-Fi chip are both fine.
Quick fix — try in order
- 1
Read the banner line
Press Ctrl-D in the REPL. The banner ends with the build name:
Raspberry Pi Pico W with RP2040has Wi-Fi;Raspberry Pi Pico with RP2040does not — even if the board itself is a W. - 2
Flash the W firmware
Hold BOOTSEL, plug in, and copy the RPI_PICO_W UF2 (Pico 2 W: RPI_PICO2_W) from micropython.org onto the RPI-RP2 / RP2350 drive. Your files in flash stay unless you also nuke it.
- 3
Check the board really is a W
The Pico W has a silver metal can (the CYW43439 Wi-Fi chip) next to the USB socket and the word “Pico W” on the silkscreen. A plain Pico has no radio — no firmware can add Wi-Fi.
- 4
On a plain Pico, drop network code
Remove
import network, or add an ESP-01 / ESP32 as a Wi-Fi co-processor over UART.
Why it happens
Why does the plain Pico UF2 even run on a Pico W?
Both use the same RP2040, so the plain build boots — it just has no driver for the Wi-Fi chip. The on-board LED also stops working, because on the Pico W it is wired to the Wi-Fi chip (Pin('LED')), not GP25.
Thonny installed the wrong firmware
Thonny’s “Install or update MicroPython” lists variants. Pick Raspberry Pi • Pico W / Pico WH, not Pico / Pico H.
ESP32 says the same thing
Every normal ESP32 build includes network. If it is missing you are not talking to the ESP32 — check Thonny’s interpreter (bottom-right) is the ESP32 and not “Local Python 3”.
Board-specific notes
Pico W: Pinout and the correct UF2 on the Pico W board page.
Pico 2 W: Uses the RP2350 — the RP2040 UF2 will not even start. Download the RPI_PICO2_W build.
Raspberry Pi Pico: No Wi-Fi hardware. See the Pico board page.
Did this fix it?
Thanks — that helps us keep this page right.