{"id":1134,"hash":"bdb71ec3020fd0f5879710c87c07c605027d68deb8dd387627205d9283ca72f0","pattern":"Why does poetry build raise ModuleOrPackageNotFound exception?","full_message":"I want to use poetry to build and distribute Python source packages, but after poetry init I get an error running poetry build.\n\n  ModuleOrPackageNotFound\n  No file/folder found for package mdspliter.tree","ecosystem":"pypi","package_name":"python-poetry","package_version":null,"solution":"Reason\nThe reason it can't be found is most likely because the directory hierarchy is incorrect.\n\nThe released package is not directly the source code folder, there are many things in it that are not needed in the final package such as version control, testing and dependency management.\n\nYou should put this folder with the same name as the package as a package in that folder.\n\nSolution\n\nChange the directory hierarchy so that there are packages with the corresponding names in the folder.for example:\n\nD:\\GitRepository\\python_distribution\\temp\\tree\n├──_init__.py\n├──tree.py\n├──pyproject.toml\n└──README.rst\n\n↓\n\nD:\\GitRepository\\python_distribution\\temp\\tree\n├──tree\n│  ├──__init__.py\n│  └──tree.py\n├──pyproject.toml\n└──README.rst\n\nSpecify the folder in pyproject.toml\n\npackages = [\n    { include = \"your_folder_as_pack\" }\n]\n\nVariants\nIf the name of the project is mdspliter.tree, then it is not useful at all to include the folder mdspliter.tree, because this naming scheme does not conform to the specification, if you use poetry new mdspliter.tree, you will find that the name of the folder actually should be mdspliter_tree.\n\n(in version 1.2, this behavior has been changed to generate multi-layer folders, mdsplitter/tree)","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/69230525/why-does-poetry-build-raise-moduleorpackagenotfound-exception","votes":28,"created_at":"2026-04-19T04:52:24.099030+00:00","updated_at":"2026-04-19T04:52:24.099030+00:00"}