Error with "poetry install"

I’m trying to deploy a FastAPI app, and the simplest form of the build command fails:

buildCommand: poetry install

with this error.

RuntimeError

The Poetry configuration is invalid:
  - Additional properties are not allowed ('group' was unexpected)

and indeed, I have this in pyproject.toml:

[tool.poetry.group.dev.dependencies]

Since poetry 1.2, “group” is the recommended way to add dev-dependencies (link), and the old method without “group” specifier is deprecated. So it’s better to upgrade the default poetry version to 1.2 or newer (currently at 1.4.2) for python instances?

Well, it seems even worse. I tried to run poetry self update and it fails with this error:

==> Using Python version: 3.10.10
==> Running build command 'poetry --version; poetry self update; poetry --version; poetry install'...
Poetry version 1.1.14
Updating to 1.4.2

  RuntimeError

  Could not find poetry-1.4.2-linux.sha256sum file

  at /home/render/.python-poetry/venv/lib/python3.7/site-packages/poetry/console/commands/self/update.py:260 in _update
      256│         try:
      257│             r = urlopen(base_url + "/{}/{}".format(version, checksum))
      258│         except HTTPError as e:
      259│             if e.code == 404:
    → 260│                 raise RuntimeError("Could not find {} file".format(checksum))
      261│
      262│             raise
      263│
      264│         checksum = r.read().decode().strip()

According to this link, the default poetry was installed in the way which was deprecated more than a year ago, get-poetry.py installer?

Python env needs a facelift, it seems.

Another attempt: uninstall the old get-poetry.py first then install the new poetry, as recommended in the official doc.

But failed due to OSError: [Errno 30] Read-only file system in both cases. Now I have no idea what to try next…

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/901bdf0491005f1b3db41947d0d938da6838ecb9/get-poetry.py | python3 - --uninstall
poetry --version; curl -sSL https://install.python-poetry.org | python3 -
poetry install

Logs:

==> Using Python version: 3.10.10
==> Running build command 'curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/901bdf0491005f1b3db41947d0d938da6838ecb9/get-poetry.py | python3 - --uninstall; poetry --version; curl -sSL https://install.python-poetry.org | python3 -; poetry install'...
Traceback (most recent call last):
  File "<stdin>", line 1161, in <module>
  File "<stdin>", line 1155, in main
# We are sorry to see you go!

This will uninstall Poetry.

It will remove the `poetry` command from Poetry's bin directory, located at:

/home/render/.python-poetry/bin

This will also remove Poetry from your system's PATH.

  File "<stdin>", line 381, in uninstall
  File "<stdin>", line 587, in remove_home
  File "/opt/render/project/python/Python-3.10.10/lib/python3.10/shutil.py", line 725, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/opt/render/project/python/Python-3.10.10/lib/python3.10/shutil.py", line 658, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/opt/render/project/python/Python-3.10.10/lib/python3.10/shutil.py", line 658, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/opt/render/project/python/Python-3.10.10/lib/python3.10/shutil.py", line 658, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  [Previous line repeated 4 more times]
  File "/opt/render/project/python/Python-3.10.10/lib/python3.10/shutil.py", line 681, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
  File "/opt/render/project/python/Python-3.10.10/lib/python3.10/shutil.py", line 679, in _rmtree_safe_fd
    os.unlink(entry.name, dir_fd=topfd)
OSError: [Errno 30] Read-only file system: 'thread.cpython-37.pyc'
Poetry version 1.1.14
Retrieving Poetry metadata

# Welcome to Poetry!
Traceback (most recent call last):
  File "/opt/render/project/python/Python-3.10.10/lib/python3.10/shutil.py", line 816, in move

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located at:

/home/render/.python-poetry/bin

You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.

Installing Poetry (1.4.2)
Installing Poetry (1.4.2): Saving existing environment
    os.rename(src, real_dst)
OSError: [Errno 30] Read-only file system: '/home/render/.python-poetry/venv' -> '/home/render/.python-poetry/venv.save'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 940, in <module>
  File "<stdin>", line 919, in main
  File "<stdin>", line 550, in run
  File "<stdin>", line 571, in install
  File "/opt/render/project/python/Python-3.10.10/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "<stdin>", line 625, in make_env
  File "/opt/render/project/python/Python-3.10.10/lib/python3.10/shutil.py", line 832, in move
    copytree(src, real_dst, copy_function=copy_function,
  File "/opt/render/project/python/Python-3.10.10/lib/python3.10/shutil.py", line 559, in copytree
    return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
  File "/opt/render/project/python/Python-3.10.10/lib/python3.10/shutil.py", line 457, in _copytree
    os.makedirs(dst, exist_ok=dirs_exist_ok)
  File "/opt/render/project/python/Python-3.10.10/lib/python3.10/os.py", line 225, in makedirs
    mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '/home/render/.python-poetry/venv.save'

  RuntimeError

  The lock file is not compatible with the current version of Poetry.
  Upgrade Poetry to be able to read the lock file or, alternatively, regenerate the lock file with the `poetry lock` command.

  at /home/render/.python-poetry/venv/lib/python3.7/site-packages/poetry/packages/locker.py:482 in _get_lock_data
      478│                 "regenerate the lock file with the `poetry lock` command."
      479│             )
      480│         elif not lock_version_allowed:
      481│             raise RuntimeError(
    → 482│                 "The lock file is not compatible with the current version of Poetry.\n"
      483│                 "Upgrade Poetry to be able to read the lock file or, alternatively, "
      484│                 "regenerate the lock file with the `poetry lock` command."
      485│             )
      486│
==> Build failed 😞

(and now I had to change “http” in curl commands to “ttp” because of this error…)

OK, for anyone who want to set up a FastAPI app, here’s how I fixed it:

buildCommand: pip install --upgrade pip; pip install poetry; /opt/render/project/src/.venv/bin/poetry install
startCommand: uvicorn main:app --host 0.0.0.0 --port 10000

It will update the pip, then install poetry, then use the installed binary of poetry to install dependencies.

Hope it helps!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.