Problem with ModuleNotFoundError: No module named 'src' through jupyter notebook

Hello,

I am trying to run a notebook .ipynb from:

through jupyter notebook but I’m getting an error that says ModuleNotFoundError: No module named 'src' and I do not know how to fix this.
I am just trying to test the example notebook to run the software tool and test it with the example dataset they give. Since the error it’s not related to the tool, I asked here for any help.
The code is:

from src.network.customics import CustOMICS
from src.tools.prepare_dataset import prepare_dataset
from src.tools.utils import get_sub_omics_df
from sklearn.model_selection import train_test_split
import numpy as np
import pandas as pd
import torch

and the error message is:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[6], line 1
----> 1 from src.network.customics import CustOMICS
      2 from src.tools.prepare_dataset import prepare_dataset
      3 from src.tools.utils import get_sub_omics_df

ModuleNotFoundError: No module named 'src'

Could you help me please?

Thank you in advance!

The notebook needs to be run from the root directory of a local clone of that git repo.

Please have a look at How Python finds modules to understand how Python looks for dependencies.

Git is a source control management system. See: Installing git. It would be used to make a copy of the GitHub code to your local machine.

I’m sorry to say that if you don’t have a minimal familiarity with Python and Jupyter, then it doesn’t make much sense to try to run that notebook. To get more familiar with Python, you can first work thru a tutorial. To get some familiarity with Jupyter, you should also work thry some tutorials for that, which are easy to find by Googling “Jupyter notebook tutorial”.

1 Like

No need to delete it - it may still provide a hint to someone with the same/similar problems.
(Otherwise - click on the ... next to the little pencil icon - If you see a little garbage bin - that’s the deletion icon.)

1 Like

Please don’t delete questions with an answer.

4 Likes