Turning a memoir into a film is never simple. Internal monologues need to be translated cinematically and the scope of an entire life has to be narrowed down to a three-act structure. Not surprisingly, the task becomes even trickier when the author spends as much time discussing his penis as Howard Stern did in his bestselling book “Private Parts.”

Released 20 years ago on March 7, 1997, the film adaptation of Stern’s memoir took the No. 1 spot at the box office the weekend it opened, eclipsing Disney’s PG-rated family film “Jungle 2 Jungle,” which debuted at the same time. The total box office gross only ended up at $41 million, but it went on to become a cult favorite on TV and video.

The culmination of a challenging development process that originally saw Oscar-winning director John G. Avildsen (“Rocky”) attached, the film’s early delays were primarily centered on story issues. Stern, whose development deal with Rysher Entertainment gave him final script approval, reportedly rejected upwards of 22 drafts and revisions.

“I was the very first writer on the film, and the first one fired,” says screenwriter Michael Kalesniko. “Not by Stern, but by the original producers. They wanted to make it more of a spectacle, I guess. I don’t know if I ever really understood their intention. I remember a note about Stern riding an elephant down Fifth Avenue at one point.”

Kalesniko, who shares a writing credit on the film with Len Blum, knew nothing about Stern before he was approached to work on the project. “I’d like to think that gave me a fresh perspective since I had no preconceived notions,” he says.

Before signing on, Kalesniko saw firsthand that Stern’s brand of humor might be a difficult sell for some movie audiences.

“When I mentioned that I was being considered to adapt his book, an East Coast friend of mine replied that if I did, she would never speak to me again,” Kalesniko says. “That friend still hasn’t spoken to me to this day, but believe me it was worth it.”

From the very beginning, the producers were aware that certain changes needed to be made from the literary source material. “I always got the sense that they felt the odds of success were very good, as long as we weren’t faithful in tone to the book,” Kalesniko says.

According to the screenwriter, that meant losing much of the raunchiness that fans were expecting. “Remember, the book was basically a compilation of dirty jokes,” Kalesniko says. “There were only two thin chapters that were remotely autobiographical.”

With an overall consensus on what needed to be lost, the question of what to include became more crucial than ever. Luckily, the production team was momentarily in sync.

“I wrote down several ideas and met with David Kirkpatrick, who was the producer at the time,” Kalesniko says. “He said that he saw the movie as an ‘Annie Hall’ for the nineties. And without saying a word, I simply held up one of my notes that read, ‘Annie Hall’ for the nineties. That pretty much sealed the deal.”

Turning “Private Parts” into a romantic comedy meant developing the role of Stern’s then-wife Alison, portrayed by Mary McCormack in the film. “I knew from the beginning that the story was about Alison and Howard’s relationship,” Kalesniko says. “It would be a love story that coincided with his rise to fame.”

While developing the script, Kalesniko appeared as a guest on Stern’s radio show, and spoke with him every day for weeks by phone. “Howard weighed in on every single scene in the outline stage,” Kalesniko says. “He signed off on it, no one else.”

Ultimately, however, additional drafts were commissioned, developed, and rejected.

In 1995, still without an agreed-upon script, Stern turned to producer/director Ivan Reitman for story advice. Together with Blum, they re-focused the script on Stern’s off-air life, and the production finally moved forward.

With Avildsen no longer attached to direct, Reitman suggested that Betty Thomas would be a strong choice to helm the film. He and Thomas had just wrapped HBO’s docudrama “The Late Shift,” which bore some similarities to the behind-the-scenes story of “Private Parts.”

Unfortunately, Thomas didn’t want the job. Though she found Stern interesting in small doses, she was a reluctant radio listener at best.

“My boyfriend at the time was a huge fan and I was forced to listen to Howard way too long, until I couldn’t take it anymore,” Thomas says. “The show would eventually get misogynistic or weird and I’d have to turn it off.”

Her mixed reaction was exactly what Reitman was looking for. “Ivan thought that might be good,” Thomas says. “Maybe it shouldn’t be a fan who directs it. Maybe it should be someone who approaches it in a more neutral way.”

A meeting with Stern at his radio studio caused her to reconsider. “Howard reached out to shake my hand, and his was trembling. He was so nervous to meet me, and everything changed at that exact moment,” Thomas says. “I needed to see that vulnerability. He had never done anything like this before, and he had to trust someone to lead him through it. I felt like I could do that.”

While directing non-professional actors like Stern and his crew proved less trouble than expected, the production was not without difficulties. “It was not an easy shoot,” Thomas says. “The ending wasn’t exactly solid. It just didn’t feel right. But I tried a few things, and Ivan had some ideas, and we always had Howard’s voiceover to nuance it in different ways.”

Like Kalesniko, Thomas attributes the film’s wide crossover appeal to its sweet-natured portrait of a marriage. “It was a love story, and I think that connected to everyone,” she says. “It was also an underdog story, and an anti-authority story. Those things appeal to all people.”

Of course, that doesn’t mean “Private Parts” wasn’t wildly funny. Far from it. Variety’s review remarked on its “unparalleled outrageousness” and “hilarious shenanigans,” while also praising its warmth and heart.

But how accurate was the film’s depiction of Stern’s on-air antics?

“It was exact,” says comedian Jackie Martling, who portrayed himself in the movie.

Martling, whose own memoir “The Joke Man: Bow to Stern” will be published in October, first appeared on the radio show in 1983. He became a full time cast member three years later, and eventually served as head writer of Stern’s syndicated TV show in the early ‘90s.

According to Martling, the film faithfully captured many of the bizarre characters that made up “The Howard Stern Show,” including the hilariously annoying WNBC program director played by Paul Giamatti. “He’s not too exaggerated in the film,” Martling says.

“I walked in one day and was introduced to Kevin, the new program director. Everything seemed peachy at first,” Martling explains. “But after a short while, he and Howard started banging heads. Then each week their relationship deteriorated a bit more until the whole thing imploded.”

That implosion is responsible for some of the film’s funniest moments. “Kevin was truly a cartoon character and Howard wasn’t just pushing the envelope, he was bulldozing it,” Martling says.

Like many who worked with Stern over the years, Martling had full confidence that “Private Parts” would cross over on the big screen. “I knew there was no way the movie wouldn’t work,” he says. “The story and the characters were just too interesting for it not to.”

Yet despite the success of his feature debut, Stern hasn’t appeared in another film since then. Could his acting career already be finished?

“When it premiered and he saw that he could do it, Howard had a couple of ideas about other movies,” Thomas says. “The thing is, he can’t do anything lesser than what he’s already done, and it was pretty hard to top his first one. But who knows what he’s going to do next? Howard is still full of surprises!”