This paper investigates how the social environment to which a Ph.D. student is exposed during her training relates to her scientific productivity. We investigate how supervisor and peers' characteristics are associated with the student's publication quantity, quality, and co-authorship network size. Unique to our study, we cover the entire Ph.D. student population of a European country for all the STEM fields analyzing 77,143 students who graduated in France between 2000 and 2014. We find that having a productive, mid-career, low-experienced, female supervisor who benefits from a national grant is positively associated with the student's productivity. Furthermore, we find that having few productive freshman peers and at least one female pee...