(Bloomberg) -- The Warner Bros. film “Dune,” another attempt to bring the popular sci-fi novel to film and TV audiences, took the No. 1 spot in U.S. and Canadian theaters this weekend.

“Dune” generated $40.1 million in ticket sales in its North American theatrical debut, according to estimates from Comscore Inc. on Sunday. That met the $40 million forecast of Boxoffice Pro, a website that tracks the industry. The studio had been projecting $30 million. The film was released simultaneously on WarnerMedia’s HBO Max service.

“Dune,” which is based on a 1965 book by Frank Herbert, tells the story of a young aristocrat trying to maintain order on an inhospitable desert planet. It features Timothée Chalamet, who received an Academy Award nomination for “Call Me By Your Name,” as the lead character, Paul Atreides, and “Spider-Man: Homecoming” star Zendaya as Chani.

The film was directed by Denis Villeneuve, whose credits include “Blade Runner 2049.” Villeneuve was an early critic of WarnerMedia’s plan to release its 2021 movies simultaneously in theaters and online to deal with the pandemic and boost its HBO Max streaming service. Jason Kilar, the architect of that strategy as chief executive officer of AT&T Inc.’s WarnerMedia unit, defended the dual release for “Dune” in an interview last week.

“I do think it looks incredible on a big screen,” Kilar said of the film. “That’s my choice on how I watch it, but the customer ultimately gets to decide.”

“Halloween Kills,” the latest installment of that horror franchise finished at No. 2 in its second week with $14.5 million, according to Comscore’s estimates. “Ron’s Gone Wrong,” a new animated feature from Walt Disney Co.’s 20th Century Studios, came in fifth with $7.3 million in its debut.

Producers and directors have been captivated by the “Dune” story for decades, with many projects fizzling out. A 1984 version, featuring Kyle MacLachlan in his first big screen role, is considered one of the industry’s more notorious bombs.

Success in Hollywood is famously unpredictable, with even dependable franchises like Batman producing some failures. The science fiction genre has also been iffy, with notable flops including 2012’s “John Carter” and 2013’s “Ender’s Game.”

About 83% of critics recommended “Dune,” according to Rotten Tomatoes. It benefited from some early buzz after a well-received premiere at the Venice International Film Festival last month. The picture got off to a strong start overseas, taking in more than $129 million before this weekend, according to IMDb. 

Not including marketing, “Dune” had a budget of $165 million. It was financed largely by Dalian Wanda Group’s Legendary Pictures. It’s one of only a few films in recent months to also get a release date in China, where it also debuted this weekend.

©2021 Bloomberg L.P.