LOS ANGELES — “Pan” produced no Neverland magic at the box office.

The fantasy, which cost an estimated $150 million to produce, earned $15.5 million in its opening weekend, according to Rentrak estimates Sunday, making it one of the worst bombs of the year. Early tracking did not look promising for the Joe Wright-directed film but still predicted that “Pan” would open at least in the $20 million range.

The PG-rated epic, sold as a Peter Pan origin story and a lavish visual feast, has had a bumpy ride from the beginning, starting when actress Rooney Mara, who is white, was cast as Tiger Lily, who is historically Native American. The film, starring Hugh Jackman and Garrett Hedlund, also had been pushed from July to October. It has not been well-received by critics, either.

“Pan” now ranks among 2015’s biggest flops, including “Fantastic Four” and “Tomorrowland.” International earnings don’t look promising either. The film brought in a weak $20.5 million. By comparison, “The Martian” earned $58.1 million.

“This had a lot going against it,” said Paul Dergarabedian, a senior media analyst for Rentrak.

“Family films always have an audience, but that audience is extremely fickle and hard to please, just like the kids who go to these movies,” Dergarabedian said. “You just never know what’s going to resonate.”

Sony’s high-wire spectacle “The Walk” also stumbled in its first weekend in wide release, after debuting on IMAX screens last week. The tale of Philippe Petit’s tight-rope walk between the towers of the World Trade Center earned $3.7 million this weekend, bringing its total to $6.4 million. Joseph Gordon-Levitt stars.