LexPredict / lexpredict-contraxsuite

LexPredict ContraxSuite
GNU Affero General Public License v3.0
165 stars 61 forks source link

jupyter - ModuleNotFoundError: No module named 'config' #48

Open plutext opened 5 years ago

plutext commented 5 years ago

Trying https://github.com/LexPredict/lexpredict-contraxsuite/blob/master/notebook-examples/document_model_tutorial.ipynb in the Docker deployment, at

# Setup django environment
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
django.setup()

I get:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-5-71fc31a6daec> in <module>()
      5 # Setup django environment
      6 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
----> 7 django.setup()

/contraxsuite_services/venv/lib/python3.6/site-packages/django/__init__.py in setup(set_prefix)
     17     from django.utils.log import configure_logging
     18 
---> 19     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
     20     if set_prefix:
     21         set_script_prefix(

/contraxsuite_services/venv/lib/python3.6/site-packages/django/conf/__init__.py in __getattr__(self, name)
     77         """Return the value of a setting and cache it in self.__dict__."""
     78         if self._wrapped is empty:
---> 79             self._setup(name)
     80         val = getattr(self._wrapped, name)
     81         self.__dict__[name] = val

/contraxsuite_services/venv/lib/python3.6/site-packages/django/conf/__init__.py in _setup(self, name)
     64                 % (desc, ENVIRONMENT_VARIABLE))
     65 
---> 66         self._wrapped = Settings(settings_module)
     67 
     68     def __repr__(self):

/contraxsuite_services/venv/lib/python3.6/site-packages/django/conf/__init__.py in __init__(self, settings_module)
    155         self.SETTINGS_MODULE = settings_module
    156 
--> 157         mod = importlib.import_module(self.SETTINGS_MODULE)
    158 
    159         tuple_settings = (

/contraxsuite_services/venv/lib/python3.6/importlib/__init__.py in import_module(name, package)
    124                 break
    125             level += 1
--> 126     return _bootstrap._gcd_import(name[level:], package, level)
    127 
    128 

/contraxsuite_services/venv/lib/python3.6/importlib/_bootstrap.py in _gcd_import(name, package, level)

/contraxsuite_services/venv/lib/python3.6/importlib/_bootstrap.py in _find_and_load(name, import_)

/contraxsuite_services/venv/lib/python3.6/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

/contraxsuite_services/venv/lib/python3.6/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

/contraxsuite_services/venv/lib/python3.6/importlib/_bootstrap.py in _gcd_import(name, package, level)

/contraxsuite_services/venv/lib/python3.6/importlib/_bootstrap.py in _find_and_load(name, import_)

/contraxsuite_services/venv/lib/python3.6/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

/contraxsuite_services/venv/lib/python3.6/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

/contraxsuite_services/venv/lib/python3.6/importlib/_bootstrap.py in _gcd_import(name, package, level)

/contraxsuite_services/venv/lib/python3.6/importlib/_bootstrap.py in _find_and_load(name, import_)

/contraxsuite_services/venv/lib/python3.6/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

ModuleNotFoundError: No module named 'config'
ghost commented 4 years ago

Running into the same thing in Apache Zeppelin. I've run done django.setup() successfully before in both jup and zepl but not sure why it's failing now.