How to calculate $E_b/N_0$ for a 8-PSK?
Assuming that you have the correct formula for the BER (which is probably based on the assumption that a Gray code is used), then - as mentioned by MBaz in a comment - you would have to invert the $Q$ function, which is a problem for which no analytic solution exists. You can use numerical methods implemented in Matlab and probably in other software packages, but you can also just estimate the required value of $E_b/N_0$ from a graph of the bit error rate. I would assume that the latter is what you're supposed to do if that's a homework problem.

Simple approximations (actually bounds) of the $Q$ functions exist, but inverting them will very likely result in very inaccurate estimates of $E_b/N_0$.