Let the velocity at which the spacecraft travels be $v$. Then $$t=\frac{2.537\cdot10^6\mathrm{ly}}{v}\approx\frac{2.4\cdot10^{22}\mathrm{m}}{v}$$ is the time that elapses until the spacecraft reaches M31 as measured by the stationary observers on earth1 and $$t'=\frac{t}{\gamma}=t\sqrt{1-\frac{v^2}{c^2}}$$ is the time measured by the astronauts.
The average age of an astronaut is 34 (Source). So we would want the astronauts on such a mission to only age around 20 years. So
$$t'=20\mathrm{y}=6.307\cdot10^8\mathrm{s}=t\sqrt{1-\frac{v^2}{c^2}}\\6.307\cdot10^8\mathrm{s}=\frac{2.4\cdot10^{22}\mathrm{m}}{v}\sqrt{1-\frac{v^2}{c^2}}\\\implies v=299792\frac{\mathrm{km}}{\mathrm{s}}\simeq c=299792.458\frac{\mathrm{km}}{\mathrm{s}}$$
Link to the computation since I was too lazy to solve this equation myself.
So the required velocity for the astronauts to reach M31 alive is extremely close to the speed of light. If we assume the mass of the spaceship to be $10000000\mathrm{kg}$ which is listed on the Wikipedia page on Project Orion for an "Advanced interplanetary" vehicle, the energy required to get to this velocity is
$$E=(\gamma-1)m_oc^2\approx4.494\cdot10^{17}\mathrm{J}$$
Again, link to computation
For comparison, the tsar bomba yielded about $2.1\cdot10^{17}\mathrm{J}$. So it seems not generally impossible to accelerate a spaceship to the needed velocity, though the technology is not available at the moment.
Other problems could be the spacecraft not withstanding the extreme forces when accelerated to almost light speed or the spacecraft hitting debris at high velocities, which would probably damage it significantly.
1 Assuming no acceleration is needed – which of course would be necessary, but I will ignore it for the sake of simplicity.
Note: It is not impossible that I made mistakes during this calculation. If someone notices them, please comment so I can try to correct them.