Update Poetry to 1.2.0+?

Is there a way to update Poetry to 1.2.0 or later?

The web service shell uses Poetry version 1.1.14. Version 1.1.14 has a bug when reading poetry.lock files created by 1.2.0 and later where it incorrectly uninstalls a certain dependency.

I tried to solve this by using 1.1.14 locally, but version 1.1.14 hangs when resolving Wagtail dependencies for Wagtail 4.1.1, which is the package I’m trying to use. Later versions seem to work fine.

So I’m stuck. It appear that the only way to proceed would be to update Poetry on the server to 1.2.0 or later. Is there any way to do that?



Thanks for reaching out!

We don’t have plans at the moment to upgrade the default Poetry version.

I would suggest you add your voice to https://feedback.render.com/features/p/allow-users-to-specify-a-poetry-version with an upvote and any additional context that might be useful as we do look to customer’s feedback to help inform our Roadmap.

A good workaround would be to use Docker [https://render.com/docs/docker] to deploy your service, which will give you much greater granularity over the versions of the packages you’re using.

Jérémy, Render Support

1 Like

This is really a major roadblock. I voted on the topic, but I really think you guys should update Poetry or at least give an option to specify the version. It’s tough (or impossible) to wrangle multiple versions of poetry on my development system just to deal with the fact that Render is on an old version.

Also, my site has been running perfectly for two years as a regular web instance, I’d really rather not convert the whole thing to a docker just to get away from an old incompatible poetry version.

Here’s a workaround I put in my build script:

echo "Installing the latest version of poetry..."
export POETRY_HOME="$(pwd)/.poetry"
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$POETRY_HOME/bin:$PATH"
poetry --version

Thanks! Does this work for you? I tried something similar before, and it didn’t work. I tried your exact code just now, and got this error:

 Installing Poetry (1.3.2)
Jan 13 01:59:48 PM  Installing Poetry (1.3.2): Creating environment
Jan 13 01:59:48 PM  Installing Poetry (1.3.2): An error occurred. Removing partial environment.
Jan 13 01:59:48 PM  Poetry installation failed.

It did work for me.

Have you tried running those commands in the remote shell? Is there more information about the failed installation?

Thanks so much for the help. I upgraded to a paid instance for my test platform so that I can get to the logs. Looks like it fails on something to do with encodings:

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/opt/render/project/src/.poetry/venv/bin/python3'
  isolated = 1
  environment = 0
  user site = 0
  import site = 1
  sys._base_executable = '/opt/render/project/src/.poetry/venv/bin/python3'
  sys.base_prefix = '/opt/python-installer/Python-3.10.3'
  sys.base_exec_prefix = '/opt/python-installer/Python-3.10.3'
  sys.platlibdir = 'lib'
  sys.executable = '/opt/render/project/src/.poetry/venv/bin/python3'
  sys.prefix = '/opt/python-installer/Python-3.10.3'
  sys.exec_prefix = '/opt/python-installer/Python-3.10.3'
  sys.path = [
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f79c9885740 (most recent call first):
  <no Python frame>


  File "<stdin>", line 919, in main
  File "<stdin>", line 552, in run

I’ll keep trying to figure this out and update this post if I can find a solution.

Hi there,

This error looks like it occurs when the python version is not installed properly, can you try specifying a python version per the docs here and see if the installation succeeds?

What version of Python are you using on Render? I get the same error as CVYY39 on version 3.10.5


Alternative to this method, you can use this configuration in your build.sh:

#!/usr/bin/env bash
# exit on error
set -o errexit

echo "Installing the latest version of poetry..."

pip install --upgrade pip

pip install poetry==1.2.0

rm poetry.lock

poetry lock

python -m poetry install

For some reason I need to remove the poetry.lock file because it recognize the version of poetry in render system and not in local environment installation.


Thanks a lot. The solution that famoseagle mentioned above worked for me last week when I downgraded the project back to 3.7.10. I’ll spin up a new test soon and see if the new solution lets me keep a newer Python version.

1 Like

Your welcome.

If you are deploying a non root source code, you need to remove this line from your pyproject.toml:

    packages = [{include = "a_project"}]

Reference: Poetry install on an existing project Error “does not contain any element”

If it is useful you can check my django-journey repo.

Hello Jérémy.
Still no plan for upgrading Poetry? A lot has change in 9 month since the 1.1.14 version Render is using (FTR, 1.4.0 has been released yesterday). I think just upgrading Render’s default Poetry is much less work than adding a feature allowing to pick any Poetry version one might want.
Even a simple upgrade to any Poetry 1.2.+ would be good enough to me.

Yeah I’m not sure they realize how big of a problem using the old version of poetry is. It was a huge hassle until the fix above, because some of my projects were on 1.2+ and the one on Render was stuck on 1.1.14, which is incompatible.

Even now, my Render project stuck on the old Python because of it. They should just upgrade already.

Thanks for this, worked for me :fist_right:t5:

This did it, thanks!

Building on famoseagle’s work above and a hint from Render’s support team, here’s what I have working that addresses usage of up-to-date Python’s and Poetry versions.

  • While render is still on py 3.7 something, setting PYTHON_VERSION to your desired version does seem to work (negating the need to install another Python). Thus, the naked python invocation to create the venv will be using PYTHON_VERSION instead of 3.7…(mine is set to 3.10.9)

  • What’s different is installing Poetry directly into the virtual-env, thus, guaranteeing that packages subsequently installed will go into the right python version’s lib environment.

While not great, this has addressed my issue…(without learning Docker!)

Suggestions/improvements welcomed…

#!/usr/bin/env bash
set -o errexit

echo "Creating a virtual env for both poetry and our packages..."
python -m venv venv

echo "Updating pip ;-)..."
./venv/bin/python -m pip install --upgrade pip

echo "Installing new/better version of poetry into our virtual env..."
./venv/bin/pip install poetry==1.4.2

echo "Installing our (non-dev) packages..."
cd /opt/render/project/src
./venv/bin/poetry install --without dev

echo "Done"

Boy. This is not something I’d like to see as my first experience testing out Render. I’m simply going through the “Getting Started with Django on Render” article, and when I get to deploy I’m running to this.

If this article tells me to “Install Poetry” then I’m going to follow that instruction to install Poetry. When I do that, it installs the latest 1.4.2 version.

Pretty sloppy stuff here, getting dependency management problems from the dependency manager itself being the wrong version. This is a major red flag to me and I went from “I’m about 95% sure I’m going to switch my production site to Render” to “Ehhh … maybe I’ll just forget this whole thing and forget that Render exists.”

Yeah. Render is actually great but it is pretty lame that they won’t fix Poetry for whatever reason.

1 Like