Python Forum

Full Version: ModuleNotFoundError after publishing project
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I'm pretty sure I followed the PyPI tutorial to a T. I have the entry point set for the __main__.py script's main method. The build process (setup.py sdist bdist_wheel) finished without errors. It even shows the 'missing modules' during the build. Yet when I install the module, it tells me

PS C:\Users\shu\Projects\bayscrape> bayscrape
Traceback (most recent call last):
  File "C:\Users\shu\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\shu\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\shu\AppData\Local\Programs\Python\Python39\Scripts\bayscrape.exe\__main__.py", line 4, in <module>
  File "C:\Users\shu\AppData\Local\Programs\Python\Python39\lib\site-packages\bayscr\__main__.py", line 5, in <module>
    from bsutils import get_input, output
ModuleNotFoundError: No module named 'bsutils'
The first line of code in __main__.py is from bsutils import get_input, output. Why isn't the bsutils module found when it's included during the setup process? I'm missing something small aren't I?
SO I learned I had to reference the project name for each import in each file Dance so from bayscrape.bsutils import ... did the trick

topic can be closed thank you anyway!
Thank you for sharing once you got the solution. Not everyone does so...