You can apply for your Study Permit/Visa in your country of residence, your country of nationality or the country where you have been legally admitted.