Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree example: examples.bogusdatasource ModuleNotFoundError #81

Open
schuderer opened this issue Mar 1, 2020 · 1 comment
Open

Tree example: examples.bogusdatasource ModuleNotFoundError #81

schuderer opened this issue Mar 1, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@schuderer
Copy link
Owner

When trying out the tree/iris example in a particular way, one is confronted with the error that the examples module cannot be imported (ModuleNotFoundError: No module named 'examples'). This happens on discovery/import of the datasources, when the examples.bogusdatasource module specified in tree_cfg.yml should be imported.

Steps to reproduce (lead to import error):

$ cd examples
$ mllaunchpad -c tree_cfg.yml -t  # works despite also importing the datasources!
$ mllaunchpad -c tree_cfg.yml -p  # ModuleNotFoundError

It should not be possible that modules can/cannot be imported when the same code is called from different functionalities, but all in the same environment and in the same current working directory. Might this have something to do with not having an unimportable src directory preventing unwanted imports (https://hynek.me/articles/testing-packaging/)?

This interestingly always works:

$ cd examples
$ python -m mllaunchpad -c tree_cfg.yml -t
$ python -m mllaunchpad -c tree_cfg.yml -p  # works fine!
@schuderer
Copy link
Owner Author

schuderer commented Mar 1, 2020

Had a little difficulty reproducing just now in a new environment with a clean pip install . (maybe installing in developer mode also changes things?).

There, both mllaunchpad commands failed, no matter whether using the mllaunchpad script or the -m call. This is actually good, as tree_cfg.yml has an error: examples.bogusdatasource should read just bogusdatasource. The first should fail, as it's trying to import from examples, which is the current working directory which doesn't have another examples subdir.

Having changed tree_cfg.yml to contain plugins: [bogusdatasource] (removing examples.), I can reproduce the error consistently: -t and -a work, while -p results in

  File "/.../mllaunchpad/.venv-test/lib/python3.7/site-packages/mllaunchpad/resource.py", line 189, in _get_all_classes
    __import__(module)
ModuleNotFoundError: No module named 'bogusdatasource'

@schuderer schuderer added the bug Something isn't working label Mar 1, 2020
@schuderer schuderer added this to To do in Prioritized User Issues via automation May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

1 participant