when do i apply for a study permit in canada

when do i apply for a study permit in canada