Unable to find hydra config

Hi there, i'm a current Jupyter user and am trying out Marimo for the first time. I have used the converter command to convert my Jupyter notebook to Marimo. Currently, i'm facing an issue where i cannot load my hydra config in the Marimo notebook. I have ran marimo edit --headless --host 0.0.0.0 --port 8883 in my root dir (/~/project), which is where marimo_notebook.py resides. project |- config |- hydra |- config.yaml |- marimo_notebook.py However, when i run the following to initialize my hydra config:
with hydra.initialize(config_path='./config/hydra'):
config_1 = hydra.compose(config_name='config')
with hydra.initialize(config_path='./config/hydra'):
config_1 = hydra.compose(config_name='config')
I get the error below:
Traceback:
...
self._missing_config_error(
File "/opt/conda/lib/python3.10/site-packages/hydra/_internal/config_loader_impl.py", line 102, in _missing_config_error
raise MissingConfigException(
hydra.errors.MissingConfigException: Primary config directory not found.
Check that the config directory '/tmp/marimo_5081/config/hydra' exists and readable
Traceback:
...
self._missing_config_error(
File "/opt/conda/lib/python3.10/site-packages/hydra/_internal/config_loader_impl.py", line 102, in _missing_config_error
raise MissingConfigException(
hydra.errors.MissingConfigException: Primary config directory not found.
Check that the config directory '/tmp/marimo_5081/config/hydra' exists and readable
Why is the root dir: /tmp/marimo_5081/ instead of project?
6 Replies
Hall
Hall3w ago
Someone will reply to you shortly. In the meantime, this might help: -# This post was marked as solved by Akshay. View answer.
Akshay
Akshay3w ago
Pass an absolute path to the config param? mo.notebook_dir() + “config/hydra” for example
ultraeggroll._.
ultraeggroll._.OP3w ago
Thanks! Passing the absolute path did work for me. However im just curious, how does marimo treats relative paths? I was also trying to import local modules via the following way below and it did not register: 1. Started Marimo in directory (i.e. /~/project) 2. Created my notebook in a subfolder of directory (i.e. /~/project/notebook) 3. Has local modules in other subfolders of directory (i.e. /~/project/source_codes/data_generator) 4. Tries to import the local modules into Marimo via this way in the cell (currently this is how i do it in jupyter):
import sys
sys.path.append("../")
import source_codes.data_generator import generate_data_func
import sys
sys.path.append("../")
import source_codes.data_generator import generate_data_func
Got error: ModuleNotFoundError
Akshay
Akshay3w ago
The working directory is the directory where marimo is started — this is what python does. We recommend using mo.notebook_dir() to construct paths relative to where the notebook file is
ultraeggroll._.
ultraeggroll._.OP3w ago
Thanks! Will try it out!

Did you find this page helpful?