Born in Pavia, he attended the Pharmacy School created by Count Karl Joseph von Firmian at the University of Pavia where he was a pupil of Giovanni Antonio Scopoli who urged him to practice the medical profession, which he did without neglecting his interests in chemistry.