0

I am new to the kaggle python module and do not understand the structure. I am trying to execute the following command from a sample script here, but when I try to run the import it fails:

ModuleNotFoundError: No module named 'kaggle.competitions'

I used pip3 to install the module originally and did not have any errors in my install. Additionally, I can run import kaggle without errors, and I can use the command line interface for kaggle to download datasets. I looked at the github repository and also do not see a directory named competitions or a competitions.py. Can someone explain to me what step I missed here to have a competitions submodule? Is there an install script I should have run but didn't?

Also I tried iterating through the submodules of kaggle like this:

>>> l = [l for l in pkgutil.walk_packages(path = kaggle.__path__, 
>>> [r[1] for r in l]
['api', 'api.kaggle_api', 'api.kaggle_api_extended', 'api_client', 'cli', 'configuration', 'models', 'models.dataset_column', 'models.dataset_new_request', 'models.dataset_new_version_request', 'models.dataset_upload_file', 'models.error', 'models.kaggle_models_extended', 'models.kernel_push_request', 'models.result', 'rest', 'tests', 'tests.test_authenticate']

But I don't see any competitions so not sure where to go from here. I'd welcome suggestions. Thanks!

TFdoe
  • 571
  • 5
  • 16

1 Answers1

1

The module you're trying to use is only available in the Kernels environment and it's specific to that particular competition. It's a custom module used to interact with this competition's dataset within the Kernels environment.

By contrast, the module you're pip installing is Kaggle's public API.

I hope that helps clarify the behavior you're seeing.

Meg Risdal
  • 1,017
  • 1
  • 11
  • 17
  • 1
    Thanks for the clarification. I eventually figured it was something like this, but it would be helpful if the modules did not share the same name.... – TFdoe Dec 18 '18 at 20:25