0

My situation:

I cloned a git repo on my local machine and could instantly run all the scripts.

Then I cloned the same repo on a SLURM cluster and the script fails with modulenotfound error. After looking left and right, printing the pwd and what not, I decided to create an __init__.py in the subdirectory where the load failed. BAM now it fails for another import. So I assume I have to follow the fails and put __init__.py everywhere.

But why is it working on my local machine? When do I need __init__.py and when not? And could it be resolved by some clever python path assignments?

Barmar
  • 741,623
  • 53
  • 500
  • 612
Alex
  • 340
  • 2
  • 13
  • 1
    Is your cluster using a very old version of Python? Because namespace packages (which don't need an `__init__.py` file) were introduced with [PEP 420](https://peps.python.org/pep-0420/) in Python 3.3, a long, long time ago. If you're running Python 3.2 or lower, you may have a variety of other issues too. – Blckknght Mar 30 '23 at 16:03

0 Answers0