Hydra: [Bug] Paths not properly configured when packaged

Created on 28 Apr 2020  路  2Comments  路  Source: facebookresearch/hydra

馃悰 Bug

I'm releasing my app as a pip package. I want users to be able to type "my_app" at the command line. I want this main script to take a Hydra configuration as input.

What works:
python -m my_app.gui.main
What doesn't work:
my_app

In my_app\gui\main:

@hydra.main(config_path='../conf/gui.yaml')
def run(cfg: DictConfig) -> None:
    log.info('CWD: {}'.format(os.getcwd()))

In my setup.py:

entry_points={
        'console_scripts':[
            'my_app= my_app.gui.main:run']
    },

* Stack trace/error message *

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\deg\Scripts\my_app-script.py", line 11, in <module>
    load_entry_point('my_app==0.0.1', 'console_scripts', 'my_app')()
  File "C:\ProgramData\Anaconda3\envs\deg\lib\site-packages\hydra\main.py", line 24, in decorated_main
    strict=strict,
  File "C:\ProgramData\Anaconda3\envs\deg\lib\site-packages\hydra\_internal\utils.py", line 147, in run_hydra
    calling_file, calling_module, config_dir
  File "C:\ProgramData\Anaconda3\envs\deg\lib\site-packages\hydra\_internal\utils.py", line 120, in create_automatic_config_search_path
    message="Primary config dir not found: {}".format(search_path_dir),
hydra.errors.MissingConfigException: Primary config dir not found: C:\ProgramData\Anaconda3\envs\deg\Scripts\conf

System information

  • Hydra Version : hydra-core 0.11.3
  • Python version : 3.7.6
  • Virtual environment type and version : conda 4.8.2
  • Operating system : Windows

Additional context

I tried to follow the formula outlined in this issue here

bug

All 2 comments

Edit: I think it was just a versioning issue. Switching to the "old" version of issue #92 works fine.

@jbohnslav, this is the doc for the app packaging.
There is a link there to a working example you should base your thing on.

When 1.0.0 is out, the example in master will be the correct one to follow.

Was this page helpful?
0 / 5 - 0 ratings