I faced the same problem a year ago. In my case, it was due to trying to install everything manually. However, jafingerhut has nice scripts to get everything set up and running correctly on a fresh Ubuntu 20.04/22.04/24.04 install. And virtual machine images too, in case that's an option for you.
See here: https://github.com/jafingerhut/p4-guide/blob/master/bin/README-install-troubleshooting.md