python-3.xsetuptoolsbuild-errorpython-babel

Error in building project - babel module not found


I have been attempting to build and upload my project to PyPI with GitHub workflows, when an error occurs in this build section:

enter image description here

Here is the error itself:

File "/home/runner/work/crossword_puzzle/crossword_puzzle/crossword_puzzle/main.py", line 15, in <module>
from babel import Locale, UnknownLocaleError
ModuleNotFoundError: No module named 'babel'

The same issue happens with tox whenever I commit and GitHub workflows runs it to check the code. The same also happens when using tox directly on my computer.

This error wasn't happening before, and since I haven't changed anything major that would affect this in particular, I have no clue what to do.

Any suggestions or fixes?


Solution

  • By chance, I found out the issue.

    In my main __init__.py, I defined the version like so:

    __version__ = "1.2.81"
    

    In the setup.py I imported it for use in the setup function

    from crossword_puzzle import __version__
    

    When this line was removed, the error no longer was raised by tox.