I am trying to build a Singularity Container to run on HPC environment. I am using poetry to manage python packages.
The contents of my pyproject.toml file are as follows:
[tool.poetry]
name = "haqc"
version = "0.1.0"
description = ""
authors = ["Vivek Katial <[email protected]>"]
[tool.poetry.dependencies]
python = "^3.8"
...
haqc = {path = ".", develop = true}
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
Then in my Singularity definition file I have the following to get setup with poetry:
%post
pip install --upgrade pip
git clone https://<REPO>.git
cd HAQC
pip install "poetry==$POETRY_VERSION"
poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi
Every time I try and build the container I receive the following error, despite the pyproject.toml file being present in the directory at build (I echo'd an ls -lhar to check):
PyProjectException
[tool.poetry] section not found in /HAQC/pyproject.toml
at /usr/local/lib/python3.9/site-packages/poetry/core/pyproject/toml.py:56 in poetry_config
52│ def poetry_config(self): # type: () -> Optional[TOMLDocument]
53│ if self._poetry_config is None:
54│ self._poetry_config = self.data.get("tool", {}).get("poetry")
55│ if self._poetry_config is None:
→ 56│ raise PyProjectException(
57│ "[tool.poetry] section not found in {}".format(self._file)
58│ )
59│ return self._poetry_config
60│
It happened to me when I provided a .toml without any package to install in it (due to a wrong COPY in my Dockerfile).
Make sure your pyproject.toml contains a [tool.poetry.dependencies] section.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With