Luigi: No module named top_artists

Created on 20 Oct 2015  路  8Comments  路  Source: spotify/luigi

Executing the following command:
luigi --module top_artists AggregateArtists --local-scheduler --date-interval 2012-06

produces the following error:

Traceback (most recent call last):
  File "/Users/richard.moorhead/anaconda/bin/luigi", line 11, in <module>
    sys.exit(luigi_run())
  File "/Users/richard.moorhead/anaconda/lib/python2.7/site-packages/luigi/cmdline.py", line 13, in luigi_run
    luigi.interface.run(argv, use_dynamic_argparse=True)
  File "/Users/richard.moorhead/anaconda/lib/python2.7/site-packages/luigi/interface.py", line 421, in run
    tasks = interface.parse(cmdline_args, main_task_cls=main_task_cls)
  File "/Users/richard.moorhead/anaconda/lib/python2.7/site-packages/luigi/interface.py", line 329, in parse
    __import__(module)
ImportError: No module named top_artists

Most helpful comment

Hmm, maybe

PYTHONPATH='' luigi --module top_artists AggregateArtists --local-scheduler --date-interval 2012-06

works?

All 8 comments

What do you expect to happen @autodidacticon? The error message "No moudle named top_artists" is easily google-able, I mean, __import__ is standard python.

Maybe it would be more user friendly if it _only_ said ImportError: No module named top_artists without the stack trace?

Oh, and for this particular case I guess you want to pass --module examples.top_artists, or cd into the examples folder or change your PYTHONPATH.

That command came from your docs:

http://luigi.readthedocs.org/en/latest/example_top_artists.html#running-this-locally

Obviously, it was run from within the examples folder, furthermore, running it from the parent folder (examples.top_artists) as you described does not work either.

Hmm, maybe

PYTHONPATH='' luigi --module top_artists AggregateArtists --local-scheduler --date-interval 2012-06

works?

Yes thats it; crucial bit here:

# my_module.py, available in your sys.path

Sorry for the hassle

I also ran into this issue. Maybe the PYTHONPATH='' bit should be added in the documentation?

Yes. Please send a PR. :)

PYTHONPATH='' luigi --module top_artists AggregateArtists --local-scheduler --date-interval 2012-06

didn't work for me (MacOS) but this did; note the dot:

PYTHONPATH='.' luigi --module top_artists AggregateArtists --local-scheduler --date-interval 2012-06

Wanted to add to this: I installed luigi on Windows 10, and none of this worked for me until I signed out and signed back in.

Then it worked perfectly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kashifjt picture kashifjt  路  5Comments

guyneedhamblis picture guyneedhamblis  路  5Comments

maresb picture maresb  路  5Comments

Alex-picwell picture Alex-picwell  路  5Comments

AndresUrregoAngel picture AndresUrregoAngel  路  4Comments