Overview

Two-factor authentication is becoming mandatory on PyPI.

https://blog.pypi.org/posts/2023-05-25-securing-pypi-with-2fa/

After setting up two-factor authentication and attempting to upload, the following error occurred.

U1WEp0ARl0RRo%NOaIRdNiGngEHUuxrTspxrTelxoProxrEa.r<dwdrhuoilrrni:npg4l0>au1cphelUaonsoaafdut.twphoaRoserfstiawrzcoyetrdodwr.iftrahoumtthhhetetnpa2sb2v:l.e/e2r/d/bu,2op2sla.eon2aodAkp.PBtpIiyopTnio0.k0foe:orn0rg0/omlroergT6ear5cu.dys2e/tteMadBi/lPssu.blishermustbeusedto

Solution

I had ~/.pypirc configured as follows.

[uppsayesprsinw]aomred==<<>>

Changing it to the following resolved the error. The API token can be created in the PyPI account settings page.

[uppsayesprsinw]aomred==<_tokeAnP_I_>

Summary

In my case, I needed to change from the method described at the following page when using nbdev.

https://nbdev.fast.ai/tutorials/tutorial.html#upload-to-pypi

Whether or not you are using nbdev, I hope this serves as a useful reference for anyone experiencing the same issue.