While running the code after installing the requirements the following error is encountered:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[5], line 7
5 import numpy as np
6 import pytorch_lightning as pl
----> 7 import lightly
8 from loss import BarlowTwinsLoss
10 from utils import knn_predict, BenchmarkModule
File /opt/conda/envs/cl-ssl-env/lib/python3.9/site-packages/lightly/__init__.py:101
98 return _prefetch_generator_available
100 # import core functionalities
--> 101 from lightly.core import train_model_and_embed_images
102 from lightly.core import train_embedding_model
103 from lightly.core import embed_images
File /opt/conda/envs/cl-ssl-env/lib/python3.9/site-packages/lightly/core.py:6
1 """ Contains the core functionality of the lightly Python package. """
3 # Copyright (c) 2020. Lightly AG and its affiliates.
4 # All Rights Reserved
----> 6 from lightly.cli.train_cli import _train_cli
7 from lightly.cli.embed_cli import _embed_cli
8 from lightly.cli.lightly_cli import _lightly_cli
File /opt/conda/envs/cl-ssl-env/lib/python3.9/site-packages/lightly/cli/__init__.py:9
1 """ The lightly.cli module provides a console interface
2 for training self-supervised models, embedding,
3 and filtering datasets
4 """
6 # Copyright (c) 2020. Lightly AG and its affiliates.
7 # All Rights Reserved
----> 9 from lightly.cli.lightly_cli import lightly_cli
10 from lightly.cli.train_cli import train_cli
11 from lightly.cli.embed_cli import embed_cli
File /opt/conda/envs/cl-ssl-env/lib/python3.9/site-packages/lightly/cli/lightly_cli.py:13
8 # Copyright (c) 2020. Lightly AG and its affiliates.
9 # All Rights Reserved
11 import hydra
---> 13 from lightly.cli.train_cli import _train_cli
14 from lightly.cli.embed_cli import _embed_cli
15 from lightly.cli.upload_cli import _upload_cli
File /opt/conda/envs/cl-ssl-env/lib/python3.9/site-packages/lightly/cli/train_cli.py:18
16 from lightly.data import ImageCollateFunction
17 from lightly.data import LightlyDataset
---> 18 from lightly.embedding import SelfSupervisedEmbedding
19 from lightly.loss import NTXentLoss
20 from lightly.models import SimCLR
File /opt/conda/envs/cl-ssl-env/lib/python3.9/site-packages/lightly/embedding/__init__.py:11
1 """The lightly.embedding module provides trainable embedding strategies.
2
3 The embedding models use a pre-trained ResNet but should be finetuned on each
4 dataset instance.
5
6 """
8 # Copyright (c) 2020. Lightly AG and its affiliates.
9 # All Rights Reserved
---> 11 from lightly.embedding._base import BaseEmbedding
12 from lightly.embedding.embedding import SelfSupervisedEmbedding
File /opt/conda/envs/cl-ssl-env/lib/python3.9/site-packages/lightly/embedding/_base.py:9
6 import copy
8 import pytorch_lightning as pl
----> 9 import pytorch_lightning.core.lightning as lightning
10 import torch.nn as nn
12 from lightly.embedding._callback import CustomModelCheckpoint
ModuleNotFoundError: No module named 'pytorch_lightning.core.lightning'
However after changing lightly to 1.4.3 the importing of packages work well, but then the class BarlowTwins requires a good amount of changes related to deprecated methods.
While running the code after installing the requirements the following error is encountered:
For more information here is the output from
and