---
title: "RP2040-HAT-Micropython fail import network"
url: "https://maker.wiznet.io/forum/14956"
markdown_url: "https://maker.wiznet.io/forum/14956/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "ibercomp"
created: "2023-06-30T08:24:18+09:00"
last_activity: "2024-01-11T04:21:45+09:00"
language: "en"
views: 317
replies: 1
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# RP2040-HAT-Micropython fail import network

## Question

Asked by ibercomp on 2023-06-30 in Ethernet Chips.

> We are trying to check the network functionalities from micropython on the W5100S-EVB-Pico. We have followed the instructions on:
>
> [https://github.com/Wiznet/RP2040-HAT-MicroPython/blob/main/Ethernet%20Example%20Getting%20Started%20\[Micropython\].md#wiznet5k-library](https://github.com/Wiznet/RP2040-HAT-MicroPython/blob/main/Ethernet%20Example%20Getting%20Started%20%5BMicropython%5D.md#wiznet5k-library)
>
> He have followed exactly same steps that in <https://www.youtube.com/watch?v=86opIykPE-U>
>
> The only step we haven’t followed from the getting started is the “2. Patch” step. What we should do there?
>
> All has build successfully and we can access to the board through Thonny. However, when trying to run the Ping sample:
>
> [https://github.com/Wiznet/RP2040-HAT-MicroPython/blob/main/Ethernet%20Example%20Getting%20Started%20\[Micropython\].md#ping](https://github.com/Wiznet/RP2040-HAT-MicroPython/blob/main/Ethernet%20Example%20Getting%20Started%20%5BMicropython%5D.md#ping)
>
> We get the error: ImportError: no module named ‘network’
>
> Then I go to /libraries/lib/wiznet5k directory and I see that is empty.
>
> What we are missing?

Kind Regards

## Replies

### Reply 1 by Acorn_, 2024-01-11

I will provide basic network connection Python code. After calling the network module, you can use network.WIZNET5K() to perform Ethernet communication.

```
import network
import socket

# Initialize WIZnet W5500 Ethernet interface
# For W5500-EVB-Pico, specific pin configuration for SPI and CS is not required as it's predefined on the board
nic = network.WIZNET5K()

# Configure static IP
# Replace with your network details
nic.ifconfig(('192.168.0.2', '255.255.255.0', '192.168.0.1', '8.8.8.8'))

# Server details
server_ip = '192.168.0.100'  # Replace with the server's IP
server_port = 5000           # Replace with the server's port

# Create a socket object
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# Connect to the server
s.connect((server_ip, server_port))
print("Connected to server")

# Send a message to the server
s.send(b'Hello, Wiznet!')

# Receive a response from the server
data = s.recv(1024)
print("Received data:", data)

# Close the socket
s.close()
```

This may not be the answer you were looking for, but I hope it clears up some of your questions about how to use WIZNET5K.

---

Source: https://maker.wiznet.io/forum/14956
