Try as it might, Europe just can't dump Russia.

President Vladimir Putin was given a warm welcome in Vienna on Tuesday, the 50th anniversary of Austria becoming the first western country to import Soviet gas during the Cold War.

It's a rare visit: The European Union imposed sanctions on Russia over Moscow's actions in Ukraine in 2014, and has condemned its connection to the poisoning of former Russian spy Sergei Skripal in the United Kingdom.

"It is unusual for any European leader to receive President Putin for a state visit in the capital given the current tensions between Russia and Europe," said Kristine Berzina, senior fellow at The German Marshall Fund of the United States.

But the hostility ends when it comes to energy, as European leaders are well aware that millions of homes would be without heating if Russia turns off the gas taps.

Imports from Russia are rising

The European Union imports 69% of its natural gas, according to the European Commission. The latest available data shows 37% of the imported gas comes from Russia, about 33% from Norway, and 11% from Algeria.

And while the European Union vowed to cut its dependency on Russian gas after the crisis in Ukraine, Russian exports to Europe have risen to record levels in the last two years.

Austrian imports of Russian gas nearly doubled in the first quarter of 2018, compared to last year.

"There are many reasons for this, namely the decline of production in the Netherlands, the fact that some [liquified natural gas] developments have been delayed, and also the fact that Russian gas is very competitive in terms of price," said James Henderson, director of the Natural Gas Research Programme at the Oxford Institute for Energy Studies.

"In reality, Russian gas is the best option," he added.

Related: OPEC and Russia to pump more oil 'in the near future'

A number of EU countries, particularly those closest to Russia, are still almost completely dependent on Moscow for their gas.

What's more, much of Russia's natural gas is pumped through Ukraine, a risky route given the conflict between the two countries.

Russia needs Europe, too

Russia has in the past used Ukraine's dependency on its energy as a way of exerting pressure on the country. Some European leaders are worried that Russia could adopt the same strategy towards the European Union in retaliation for sanctions.

"But this has not really happened," said Marco Siddi, senior research fellow at the Finnish Institute of International Affairs.

"Sixty-seven percent of Russia's tax revenues comes from energy exports, Russia needs this trade even more that the European Union," he added

Plans for a new gas pipeline that would bypass Ukraine have been in the works for years, but Europe is deeply divided over the project.

Opponents say the Nord Stream 2 pipeline would only increase the European Union's dependence on Russian energy. But Germany and some other countries argue that it would give Europe more energy security.

"The political weight that is given to the gas relationship differs from country to country," said Berzina. "I would argue in Austria, and in Germany ... the economic ties around energy are given outsized political weight."

Europe to U.S.: Your new Russia sanctions would hurt us too

Dependent for decades

Still, the European Union has taken some steps to wean itself off Russian gas. It has invested in liquefied natural gas import terminals in Poland and Lithuania, making it possible to use other suppliers.

American producers have been trying to export more natural gas to Europe, but they mostly haven't been able to offer prices that can compete with Russia.

Europe has also built better pipeline links between nations, so it can send gas back and forth where needed, while keeping prices competitive.

However, Europe is likely to remain dependent on Russian gas for decades to come.

"Europe is a major energy importing region. There aren't many options apart from reducing gas usage overall," said Henderson.