Pip3.9 install via pip command on firstboot

In. my firstboot script I have a command:
pip3.9 install --no-index --no-deps /Volumes/resources/system/pipdownloads/python3/*

This installs pip packages too /usr/local/lib64/python3.9/site-packages/. But it does not seem to install anything on the above location. If I run this command once i have logged into the system or via ssh then it seems to run fine and installs the packages into the correct place.

If i do the same with python2.7 then it works for that:
pip2.7 install --no-index --no-deps /Volumes/resources/system/pipdownloads/python2/*

What could be wrong?

Did you check the status of systemd-firstboot.service? If so what did it report to you? My first suspicion would be that maybe ConditionFirstBoot=yes was not met, if so maybe you already have a /etc/machine-id file, in which case it is not considered the first boot.

I had to fully qualify the path in the script to pip3.9. This is not the firstboot service or script that is provided by rocky. This is one that I knocked up to set various setting on first boot.