Debugging NAB, Path to Module


#1

Before going big with Stackoverflow, I hope you can help me.

I am debugging the HTM algorithm in NAB using Virtual Studio Code (VSC)
Supposing this is the (simplified) structure of the program:

run.py
nab
   |- base.py
   |- detectors
       |- numenta_detector.py
       |- whatever.py
  1. If run.py calls from nab.detectors.numenta_detector import XXX down the path, I don’t have any problem.
  2. but when numenta_detector.py imports a module from whatever.py, it goes from nab.detectors.whatever import YYY. It starts from the RootFolder and does not find it.
  3. In numenta_detector.py changing to from whatever import YYY works

Since the hole program is written like in (2), and the issue pops up just by debugging, how can I overcome it?

Merci!


#2

How exactly are you running NAB? What command are you using? I’ve run NAB locally (and others have also) without having problems so it is probably something to do with your environment. Perhaps your PYTHONPATH should be append to include one of these folders?


#3

As I said, NAB run smoothly, only by debugging the problem pops up.

The problem was for sure PYTHONPATH, here a way to solve the issue.
Anyway what really worked for me was an easy pip install -e ., which taking advantage of setup.py cleared the issue in Visual Studio Code and PyCharm.