Pytorch_lightning.lite (ModuleNotFoundError: No module named 'pytorch_lightning.lite')

Hello,
I used two commands to install conda pytorch_lightning:
pip install lightning, conda install pytorch-lightning -c conda-forge
However, lite is not installed within the package and it shows this error:
ModuleNotFoundError: No module named β€˜pytorch_lightning.lite’
(from pytorch_lightning.lite import LightningLite)
Should I install lite separately?
thanks!

1 Like

I have the same exact problem

(gdrnpp) mona@ada:~/gdrnpp_bop2022$ pip install pytorch_lightning
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting pytorch_lightning
  Downloading pytorch_lightning-2.1.3-py3-none-any.whl.metadata (21 kB)
Requirement already satisfied: numpy>=1.17.2 in /home/mona/.local/lib/python3.10/site-packages (from pytorch_lightning) (1.26.2)
Requirement already satisfied: torch>=1.12.0 in /home/mona/.local/lib/python3.10/site-packages (from pytorch_lightning) (2.1.2+cu118)
Requirement already satisfied: tqdm>=4.57.0 in /home/mona/.local/lib/python3.10/site-packages (from pytorch_lightning) (4.65.2)
Requirement already satisfied: PyYAML>=5.4 in /home/mona/.local/lib/python3.10/site-packages (from pytorch_lightning) (6.0.1)
Requirement already satisfied: fsspec>=2022.5.0 in /home/mona/.local/lib/python3.10/site-packages (from fsspec[http]>=2022.5.0->pytorch_lightning) (2023.4.0)
Collecting torchmetrics>=0.7.0 (from pytorch_lightning)
  Downloading torchmetrics-1.2.1-py3-none-any.whl.metadata (20 kB)
Requirement already satisfied: packaging>=20.0 in /usr/lib/python3/dist-packages (from pytorch_lightning) (21.3)
Requirement already satisfied: typing-extensions>=4.0.0 in /home/mona/.local/lib/python3.10/site-packages (from pytorch_lightning) (4.4.0)
Collecting lightning-utilities>=0.8.0 (from pytorch_lightning)
  Downloading lightning_utilities-0.10.0-py3-none-any.whl.metadata (4.8 kB)
Requirement already satisfied: requests in /home/mona/.local/lib/python3.10/site-packages (from fsspec[http]>=2022.5.0->pytorch_lightning) (2.28.2)
Collecting aiohttp!=4.0.0a0,!=4.0.0a1 (from fsspec[http]>=2022.5.0->pytorch_lightning)
  Downloading aiohttp-3.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (7.4 kB)
Requirement already satisfied: setuptools in /home/mona/.local/lib/python3.10/site-packages (from lightning-utilities>=0.8.0->pytorch_lightning) (60.2.0)
Requirement already satisfied: filelock in /home/mona/.local/lib/python3.10/site-packages (from torch>=1.12.0->pytorch_lightning) (3.9.0)
Requirement already satisfied: sympy in /usr/lib/python3/dist-packages (from torch>=1.12.0->pytorch_lightning) (1.9)
Requirement already satisfied: networkx in /home/mona/.local/lib/python3.10/site-packages (from torch>=1.12.0->pytorch_lightning) (3.0)
Requirement already satisfied: jinja2 in /home/mona/.local/lib/python3.10/site-packages (from torch>=1.12.0->pytorch_lightning) (3.1.2)
Requirement already satisfied: triton==2.1.0 in /home/mona/.local/lib/python3.10/site-packages (from torch>=1.12.0->pytorch_lightning) (2.1.0)
Requirement already satisfied: attrs>=17.3.0 in /usr/lib/python3/dist-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>=2022.5.0->pytorch_lightning) (21.2.0)
Collecting multidict<7.0,>=4.5 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>=2022.5.0->pytorch_lightning)
  Downloading multidict-6.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (114 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 114.5/114.5 kB 16.8 MB/s eta 0:00:00
Collecting yarl<2.0,>=1.0 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>=2022.5.0->pytorch_lightning)
  Downloading yarl-1.9.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (31 kB)
Collecting frozenlist>=1.1.1 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>=2022.5.0->pytorch_lightning)
  Downloading frozenlist-1.4.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (12 kB)
Collecting aiosignal>=1.1.2 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>=2022.5.0->pytorch_lightning)
  Downloading aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Collecting async-timeout<5.0,>=4.0 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>=2022.5.0->pytorch_lightning)
  Downloading async_timeout-4.0.3-py3-none-any.whl.metadata (4.2 kB)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/lib/python3/dist-packages (from jinja2->torch>=1.12.0->pytorch_lightning) (2.0.1)
Requirement already satisfied: charset-normalizer<4,>=2 in /home/mona/.local/lib/python3.10/site-packages (from requests->fsspec[http]>=2022.5.0->pytorch_lightning) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests->fsspec[http]>=2022.5.0->pytorch_lightning) (3.3)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python3/dist-packages (from requests->fsspec[http]>=2022.5.0->pytorch_lightning) (1.26.5)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests->fsspec[http]>=2022.5.0->pytorch_lightning) (2020.6.20)
Downloading pytorch_lightning-2.1.3-py3-none-any.whl (777 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 777.7/777.7 kB 29.8 MB/s eta 0:00:00
Downloading lightning_utilities-0.10.0-py3-none-any.whl (24 kB)
Downloading torchmetrics-1.2.1-py3-none-any.whl (806 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 806.1/806.1 kB 37.6 MB/s eta 0:00:00
Downloading aiohttp-3.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 48.7 MB/s eta 0:00:00
Downloading async_timeout-4.0.3-py3-none-any.whl (5.7 kB)
Downloading frozenlist-1.4.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (239 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 239.5/239.5 kB 416.7 MB/s eta 0:00:00
Downloading yarl-1.9.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (301 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 301.6/301.6 kB 102.7 MB/s eta 0:00:00
Installing collected packages: multidict, lightning-utilities, frozenlist, async-timeout, yarl, aiosignal, torchmetrics, aiohttp, pytorch_lightning
Successfully installed aiohttp-3.9.1 aiosignal-1.3.1 async-timeout-4.0.3 frozenlist-1.4.1 lightning-utilities-0.10.0 multidict-6.0.4 pytorch_lightning-2.1.3 torchmetrics-1.2.1 yarl-1.9.4
(gdrnpp) mona@ada:~/gdrnpp_bop2022$ ./core/gdrn_modeling/train_gdrn.sh configs/gdrn/ycbv/convnext_a6_AugCosyAAEGray_BG05_mlL1_DMask_amodalClipBox_classAware_ycbv.py 0
++ dirname ./core/gdrn_modeling/train_gdrn.sh
+ this_dir=./core/gdrn_modeling
+ CFG=configs/gdrn/ycbv/convnext_a6_AugCosyAAEGray_BG05_mlL1_DMask_amodalClipBox_classAware_ycbv.py
+ CUDA_VISIBLE_DEVICES=0
+ IFS=,
+ read -ra GPUS
+ NGPU=1
+ echo 'use gpu ids: 0 num gpus: 1'
use gpu ids: 0 num gpus: 1
+ NCCL_DEBUG=INFO
+ OMP_NUM_THREADS=1
+ MKL_NUM_THREADS=1
+ PYTHONPATH=./core/gdrn_modeling/../..:/home/mona/realsense-ros/install/realsense2_camera_msgs/local/lib/python3.10/dist-packages:/opt/ros/humble/lib/python3.10/site-packages:/opt/ros/humble/local/lib/python3.10/dist-packages
+ CUDA_VISIBLE_DEVICES=0
+ python ./core/gdrn_modeling/main_gdrn.py --config-file configs/gdrn/ycbv/convnext_a6_AugCosyAAEGray_BG05_mlL1_DMask_amodalClipBox_classAware_ycbv.py --num-gpus 1
/home/mona/.local/lib/python3.10/site-packages/requests/__init__.py:109: RequestsDependencyWarning: urllib3 (2.1.0) or chardet (None)/charset_normalizer (3.3.2) doesn't match a supported version!
  warnings.warn(
/home/mona/.local/lib/python3.10/site-packages/mmcv/__init__.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details.
  warnings.warn(
Traceback (most recent call last):
  File "/home/mona/gdrnpp_bop2022/./core/gdrn_modeling/main_gdrn.py", line 19, in <module>
    from pytorch_lightning.lite import LightningLite  # import LightningLite
ModuleNotFoundError: No module named 'pytorch_lightning.lite'

I cannot find lite in the current docs anymore for the latest version and see it’s mentioned for 1.8.x, so it might be deprecated in 2.x.x. In any case you might want to cross-post the question into the lightning forum as the devs should respond there.

1 Like

I ended up installing this version:

(gdrnpp) mona@ada:~/gdrnpp_bop2022$ pip show pytorch_lightning
Name: pytorch-lightning
Version: 1.6.0
Summary: PyTorch Lightning is the lightweight PyTorch wrapper for ML researchers. Scale your models. Write less boilerplate.
Home-page: https://github.com/PyTorchLightning/pytorch-lightning
Author: William Falcon et al.
Author-email: waf2107@columbia.edu
License: Apache-2.0
Location: /home/mona/.local/lib/python3.10/site-packages
Requires: fsspec, numpy, packaging, pyDeprecate, PyYAML, tensorboard, torch, torchmetrics, tqdm, typing-extensions
Required-by: