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

AttributeError: module 'mllaunchpad' has no attribute 'datasource' #139

Open
schuderer opened this issue May 10, 2021 · 0 comments
Open
Labels
faq (Candidates for) an FAQ in ML Launchpad wontfix This will not be worked on

Comments

@schuderer
Copy link
Owner

  • ML Launchpad version: 1.0.0
  • Model Type used: Python
  • Python version: 3.8
  • Operating System: Win 10

Description

When trying to write unit tests for your models under Python 3.8, when importing the pip-installed mllaunchpad packages, it might appear as if its submodules (like mllaunchpad.datasources, mllaunchpad.resource) are not always accessible ("... has no submodule ..."). But sometimes they are! It might even make a difference when I (re)import mllaunchpad.

BUT: This might just be due to the difference between attributes and imports in Python. Submodules don't appear to be available immediately as mllaunchpad.submodule, but through import submodule from mllaunchpad.

So if

import mllaunchpad
ds = mllaunchpad.datasources.FileDataSource(...)

does not work, try

from mllaunchpad import datasources
ds = datasources.FileDataSource(...)

Steps to reproduce

Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mllaunchpad
>>> dir(mllaunchpad)
['ModelInterface', 'ModelMakerInterface', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', 'config', 'get_validated_config', 'get_validated_config_str', 'model_actions', 'model_interface', 'order_columns', 'pkg_resources', 'predict', 'resource', 'retest', 'train_model', 'yaml_loader']
>>> from mllaunchpad import datasources
>>> dir(mllaunchpad)
['ModelInterface', 'ModelMakerInterface', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', 'config', 'datasources', 'get_validated_config', 'get_validated_config_str', 'model_actions', 'model_interface', 'order_columns', 'pkg_resources', 'predict', 'resource', 'retest', 'train_model', 'yaml_loader']
>>>
@schuderer schuderer added wontfix This will not be worked on faq (Candidates for) an FAQ in ML Launchpad labels May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
faq (Candidates for) an FAQ in ML Launchpad wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant