Closed djun closed 1 year ago
Hi. I need a little bit more context. Did you modify your Docker image? Maybe you deleted second poetry install
at the end of the Dockerfile.
Add this before CMD
command in your Dockerfile:
RUN poetry install
Also it's not that critical to delete this line from the main module.
version=metadata.version("{{cookiecutter.project_name}}"), # Just delete it. It will solve the issue.
The point here to run poetry install
twice.
During the first run it installs all the dependencies, during the second run it installs your project.
Thanks for your reply! I will try your advices in the next day.
New project base on FastAPI-template got errors when running on Linux.
I've tested on VPS or local virtual machines, and on Ubuntu 18.04 or ParrotOS Home 5.1 (based on Debian), and on local Python 3.9, Miniconda3 Python 3.9
, even on building Python 3.9 slim project imagebut not in built Python 3.9 slim project image.All have got this similar error when running
poetry run python -m <My Project Name>
(or:/usr/local/bin/python -m <My Project Name>
in docker image)importlib.metadata.PackageNotFoundError: <My Project Name>
.By the way, all is well when testing on Windows (Official Python 3.9 installer).
Detail log (on ParrotOS Home 5.1 (based on Debian)):
I haven't got this error in September in this year, all was normal. But got this headache error in this month.
Please help me for this for my production environment, thanks very much!