How are you trying to install the printer? Is the printer connected to your router?
You can use the HP Smart App too manage this See -
Printer setup guide for: HP Smart Tank 5102 All-in-One Printer https://support.hp.com/us-en/printer-setup/hp-smart-tank-5100-all-in-one-printer-series/2100992728/model/2101277344
HP printer setup (HP Smart app) https://support.hp.com/us-en/document/ish_1716406-1413451-16
You could alternatively check/set the WiFi connection manually.
Printers with a touchscreen control panel: Open the Setup, Network, or Wireless settings menu, select Wireless Setup Wizard, and then follow the instructions to select the network name and enter the password.