When Valerie Lines moved from Portland to the Bay Area to start a teaching career, she had a five-year plan: pay off her student loans, save money and buy a starter home. But nearly a decade later, the Oakland teacher has shelved those dreams. She’s still renting and just trying to get by.

“I can make a whole chicken last a week or two,” said Lines, a Montclair Elementary teacher who shares an Oakland apartment. “I’m incredibly frugal. … I know all the tricks like, when you use the oven, you leave the oven door open after you use it to warm your house during winter.”

Lines is among the many teachers throughout the Bay Area struggling to find stable, affordable housing near their jobs. Many are commuting long distances to work; some, like Lines, are taking in roommates; and still others are working extra jobs to make ends meet. The situation has grown so severe that some are considering moving away or leaving the profession altogether.

Officials say the state is already grappling with a teacher shortage because of those who left the profession during the recession and a decline in those seeking teaching careers. Enrollment in teacher-preparation programs decreased by more than 70 percent between early 2000 and 2013, said Leib Sutcher, a research assistant at the Learning Policy Institute. The housing crisis is only making it worse.

To try to retain their teachers, and compete for new ones, a number of districts, including West Contra Costa, Oakland, San Ramon, San Leandro and Pittsburg, have recently given their teachers healthy bumps in pay — ranging from 5 percent to 14 percent over the life of the contract.

But it has not been enough to keep pace with the high cost of living here, driven by skyrocketing housing prices gripping nearly every town and city in the region.

From 2007 to 2015, average pay for teachers in Alameda, Contra Costa and Santa Clara counties rose about 12 percent, from $67,275 to $75,500, according to an analysis of the most recent California Department of Education data. By comparison, from 2007 to 2016, the median asking price for available rentals increased 66 percent in Alameda County, 50 percent in Contra Costa County and 64 percent in Santa Clara County, according to apartment tracker RealFacts of Novato.

“We’ve had an ongoing affordable housing crisis in the Bay Area, and now we’re at a critical level where we’re seeing that … teachers and other core professionals are not going to be able to live in the community,” said Amie Fishman, executive director of the Non-Profit Housing Association of Northern California.

For a teacher earning $73,000 — the average teacher salary in the nine-county Bay Area — a rent payment of $1,800 would eat up 30 percent of monthly income. And just finding a rental at that price would be very difficult in this economy. The average monthly price for studio apartments in the Bay Area is $2,137, according to RealFacts, and two-bedroom, two-bath apartments are going for $2,850 — and for much more in hot markets.

“Every year we have a problem. It’s always a challenge to make sure that the schools are staffed,” said Jody London, an Oakland Unified school board trustee. “But with the rapidly rising housing market, the fact is it’s crazy right now. And it’s getting harder for teachers to stay in Oakland.”

Whether a community’s educators can afford to live where they work is often considered a touchstone for the health, welfare and future success of a community, many say.

“It’s not a mistake that the Silicon Valley and the tech boom happened here. … We had the right people, including an educated workforce. And our teachers and public education system provide that,” said Eric Heins, president of the California Teachers Association.

Teachers in wealthier districts, while often better paid, are facing the same problems.

Derrall Garrison is a fifth-grade teacher at R.I. Meyerholz Elementary in San Jose in the prosperous Cupertino Union School district. After 16 years of teaching, his salary will rise to $92,000, following a 7 percent bump in pay negotiated last week. He bought a home in Castro Valley five years ago when it was clear he couldn’t afford to buy near his school.

“I like driving, but definitely the commute can be wearing,” Garrison said of his 44-mile commute. “And it definitely does affect your quality of life somewhat, with young children in particular.”

Indeed, many teachers with long-standing Bay Area roots are starting to give up their dreams of living close to family and their jobs.

Maria Smith, 45, a fourth-grade teacher at San Ramon Valley Unified School District’s Bollinger Canyon Elementary for 15 years,﻿ said she and her husband, Timothy, also a teacher, are contemplating a move to Elk Grove.

Despite making about $165,000 a year in combined income, it’s not enough to buy a home in San Ramon, where the median home price was $862,000 in 2015, according to CoreLogic.

She said they could buy a four-bedroom home for $425,000 in the Sacramento suburbs, which would give them more disposable income for dance or music classes, and more to sock away for college. But if they move, their 3-year-old daughter won’t see as much of her grandparents, who are retired San Ramon Valley teachers.

“My parents are getting older, and they are not going to be around forever …,” she said. “But it’s the best thing for my family, and my parents understand that.”

Amberle Mitchell, a music teacher at Washington High school in Fremont, her own alma mater, finds herself in a similar dilemma. Despite working two part-time jobs, as a private music teacher and playing private theatrical and orchestral gigs, she can’t afford the rent in the city where her parents, grandparents, aunts and uncles live, so she rents in Hayward.

“I do like teaching, but it’s just that I can’t see myself last under the pressure of all these things,” she said.

Districts are feeling the pressure, too. Credentials issued to new teachers are at a historic low at the very time districts have increased their hiring to expand programs and restore teaching positions eliminated during the recession, when schools lost about $20 billion in funding, Sutcher said. Many districts, struggling to find fully qualified teachers, are hiring teachers on emergency credentials, which comprised a third of all new credentials issued in the 2014-2015 school year.

Districts located in cities where housing prices are rising the fastest are facing the most pressure to give raises or other incentives to ease the pain, Sutcher said.

Oakland is a case in point. Before the new contract was signed in June, awarding 14 percent pay raises over 18 months, teacher salaries had gone up only 8.25 percent from the 2005 to 2015 school years. Teachers in the district earned on average $58,000 last year.

The raise is significant but cannot keep pace with one of the hottest housing markets in the country. Prices have nearly doubled in the past four years, and rose 16.9 percent in the past year alone, according to CoreLogic, with a median home price of $520,000 and climbing. As a double whammy, average rents have gone up by 55 percent during the past four years, according to RealFacts.

Some districts, such as Pittsburg, are giving $2,500 bonuses to try to woo new teachers in certain subjects, and other districts have proposed affordable housing developments for teachers.

Although school budgets have increased since the recession ended, the state scores each year in the bottom 10 in state-by-state rankings of school expenditures, student-teacher ratios and per-pupil spending.

Oakland Superintendent Antwan Wilson said he hears from teachers every day distressed that their rents are going up $500 a month. He fears that will further worsen the district’s teacher turnover rate, which already is at 20 percent.

“Having a consistent educator allows (students) to learn and grow,” Wilson said. “And we don’t want our teachers to have to make such sacrifices in their well-being to work with our students.”

And even pay raises aren’t a cure-all. When Lines got a raise, it put her over the maximum salary range of about $46,000 to stay in an East Oakland affordable housing complex. She’s now sharing a one-bedroom apartment with a friend near Lake Merritt, using a partition to retain some semblance of privacy.

“Unfortunately, the school districts can’t do it themselves,” she said. “There’s a housing problem, and fixing it goes beyond giving teachers raises.”

Staff writers Sharon Noguchi and Danny Willis contributed to this story.

Contact Joyce Tsai at 925-945-4764. Follow her at Twitter.com/joycetsainews.