The error serves to remind you that when you call numpy(), you are leaving autograd-land. The most local fix is to take the advice literally and replace .numpy() by .detach().numpy() You will not be able to backpropagate through env.step, but instead have to use one of the RL techniques to get something to put into the .backward(SOMETHINGHERE) of (log)prob (?, likely).
Best regards
Thomas