timefold-solver icon indicating copy to clipboard operation
timefold-solver copied to clipboard

Python solver: ModuleNotFoundError: No module named 'java.lang' (or 'java.io')

Open ge0ffrey opened this issue 1 year ago • 2 comments

If the python solver is executed from a working directory that contains a directory called java (or maybe javax too), we get this error message:

ModuleNotFoundError: No module named 'java.lang'

Give a nice error message.

(this is an issue for the backlog)

ge0ffrey avatar Dec 04 '24 09:12 ge0ffrey

Welcome to the world of Python packaging, where what you see is the expected behaviour of Python. In particular, by having a directory with a given name in your working directory, Python will automatically consider it a namespace package (and it will take precedence over import hooks).

See https://peps.python.org/pep-0420/#specification for details.

Christopher-Chianelli avatar Dec 04 '24 13:12 Christopher-Chianelli

(Something similar will happen if you used the name timefold for your directory)

Christopher-Chianelli avatar Dec 04 '24 13:12 Christopher-Chianelli

As of today, Timefold halted any further development of the Python solver. Find out more here: https://github.com/TimefoldAI/timefold-solver/discussions/1698

Closing this issue.

triceo avatar Jul 11 '25 11:07 triceo