Search code examples
pythonpytorch-lightning

Why do I not get an error when I import pycharm_lightning


I am using PyCharm and encountered an error at the line

import pytorch_lightning as pl

because the package pytorch_lightning had not been added to my Python interpreter. I used PyCharm to search for the package but it was unable to find it. However, searching the internet, I did come across references to a package called Pytorch Lightning. As a result, I decided to see if PyCharm could locate a package called lightning, and indeed it was able to. After adding this package to the interpreter, the error disappeared.

I have also seen others use the line import pytorch-lightning as pl, with a hyphen instead of an underscore.

Are there multiple packages with very similar names in existence or is pytorch_lightning the same as pytorch-lighning and the same as lightning?

Why did my error go away?


Solution

  • there is only one package. it however maintains aliases that can be used interchangeably. the underscore name is preferred.