It’s not but there’s some association with psychosis, in which it appears that cannabis may trigger mental illness (of a psychotic nature) in the already predisposed. That said, I must add that the research does point to this association being more prevalent in young adolescents who use it heavily.
An article that summarises available research: Adolescent cannabis use and psychosis: epidemiology and neurodevelopmental models
An excerpt (emphasis mine):
The belief that cannabis can induce psychotic-like symptoms has been reported for over 50 years… However, whether cannabis use causes schizophrenia has been a matter for debate for decades. It is thought that in terms of the onset of cannabis use and the onset of the first symptoms of schizophrenia, a number of groups can be differentiated: (i) either patients abuse cannabis for a number of years before developing schizophrenic symptoms; (ii) patients develop symptoms immediately after the first use of cannabis; or (iii) cannabis consumption occurs after schizophrenic symptoms are already established (Hambrecht and Hafner, 2000). What does appear to be consistent is that in individuals with a predisposition for schizophrenia, ingesting cannabis exacerbates symptoms and worsens the schizophrenic prognosis [for review see Hall et al. (2004)].
In addition to cannabis producing acute psychotic-like symptoms, epidemiological data suggest that cannabis is a risk factor for the onset of schizophrenia. One of the most comprehensive studies investigating the epidemiological link between cannabis use and psychosis was published over 20 years ago (Andreasson et al., 1987).… Reviews of these and other longitudinal and case–control studies confer that lifetime cannabis use increases the risk of developing psychosis (Arseneault et al., 2004; Rey et al., 2004; Moore et al., 2007; Zammit et al., 2008).
Like I said, this isn’t the same as saying cannabis causes schizophrenia (it doesn’t)—the most that can be said is it certainly seems to be an important associated factor in some people.