Thank you to user2693053 for solving this problem:
Sounds like a privilege issue, although I am not experienced enough with calling Python from php to know whether that could be an issue here.
and yes, it is a privilege issue! I fixed the problem by doing the
sudo chmod 777 * command in the