A sour gas pipeline that ruptured in Turner Valley has now been contained, say officials.

An emergency alert had been issued earlier for the hazardous materials release that is "threatening life and the environment" in the town, located southwest of Calgary.

Barry Williamson, a town councillor, said emergency crews had evacuated 50 homes in a 100-metre zone near the pipeline. Some homes have also evacuated because of flooding in the area.

He said the pipeline ruptured when it was hit by river debris from rising flood waters in the area.

The rupture caused a release of sour gas containing one per cent hydrogen sulfide (H2S) — a colourless, flammable gas that smells like rotten eggs. The gas is poisonous if inhaled.

Officials say air quality monitoring at the break point isn't detecting dangerous sour gas levels.

The pipeline is owned by Legacy Oil and Gas. The Alberta Energy Regulator says it is aware of the leak, and crews are on the way to Turner Valley.

Officials are advising people to stay indoors, but also be prepared to relocate.

Gerald Pfeil, a town councillor, says residents who live on or near Okalta Road had been told to stay in their homes.

"Emergency services are going door-to-door asking people ... ensuring they are aware of the problem," he said.

Officials suggest people seek medical attention if they are experiencing breathing difficulties.