If you use magnets only, in what way would the motor be "electric"?
13thmonkey :
Also you'd need a monopole, as like poles repel, but the poles rotate you'll then put unlike poles together which attract, and would prevent the rotation from continuing.
... but that doesn't prevent the build of a magnetic motor the task of which is to keep the axle oriented in a single direction and revolve less than half a turn away in either direction.
If that limitation is acceptable then it's fine to do such a motor!
In fact, all electric motors that have permanent magnets function like that to a lesser degree. If you try to rotate the axle of a motor that's not connected to power you'll find that the axle has a finite number of stable positions.