Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

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

@schuderer

Description

@schuderer
  • 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']
>>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    faq(Candidates for) an FAQ in ML LaunchpadwontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions