As has been said the ability to learn spells is based on int. However in BG2 you start at level 7 by which point the margin for error is so small that you aren't realistically going to fail.
------------------
Holy Avenger of the OHF and part time Pinguindiebjäger