In San Jose, California–recently ranked as the least affordable place in the country to buy a home, where a typical rental goes for $3441, around 50% more than it did six years ago–the local school district now wants to turn some schools into hundreds of housing units for teachers .

“Right now, we’re losing about one in seven classroom teachers every school year, and the No. 1 cited reason for leaving the district is the cost of living,” says Stephen McMahon, deputy superintendent for the San Jose Unified School District.

Even the tech sector is challenged to recruit employees because local housing is so unaffordable, he says. But while tech jobs are concentrated in Silicon Valley, teachers can easily move a few hours away and get a job with a similar salary but pay far less in rent or for a mortgage. “There are almost unlimited options as a public school teacher, so we’re not able to compete in this marketplace,” he says.

A growing number of school districts are considering similar plans to turn district property, including old schools, into housing. In San Francisco, where at least one teacher has dealt with homelessness, plans to build a new development with more than 100 apartments for teachers. In Palo Alto, California, there’s a proposal to build teacher housing on county-owned land. Miami wants to build a new middle school with a residential floor for teachers and a new housing complex next to an elementary school. In Washington, D.C., a former college building will become affordable housing for local teachers. An empty elementary school in Chicago is slated to become a “teacher’s village.” The small but expensive town of Vail, Arizona, plans to build tiny houses for teachers.

Communities often oppose the plans, because they feel that less valuable rental units that might lower the property value of their single family homes or might lead to lower income people moving into the neighborhood. When the school district in Cupertino, California, where Apple is headquartered, announced that it wanted to build 200 housing units for teachers in an empty elementary school, there was so much opposition that it abandoned the idea. In nearby Millbrae, California–where the local superintendent has said that some teachers are forced to couch surf–some students protested a plan to build new housing for teachers.

In San Jose, the housing crisis is likely to get worse. Several new office complexes are planned in the city’s downtown, and new planned transit stations will attract more businesses and more demand for housing. Because the cost of living has already driven some families away, the school district sees an opportunity to consolidate some schools and turn newly vacant schools into teacher housing. The district also plans to build a new middle school and high school on undeveloped land. Neighbors have opposed these plans as well.

“We think it’s a win for everybody,” says McMahon. “Students get a state of the art facility, and we get an increased likelihood that we can get teachers to stay with us because we can support them with teacher housing. To us, it’s a great win. The community backlash is . . . just very negative on the term affordable housing. We’re trying to convince them that these are the same teachers you send your kids to every day. These teachers are going to make great neighbors.”