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?

1 Like

Hey,

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

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 = [
    '/opt/python-installer/Python-3.10.3/lib/python310.zip',
    '/opt/python-installer/Python-3.10.3/lib/python3.10',
    '/opt/python-installer/Python-3.10.3/lib/lib-dynload',
  ]
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>

Traceback:

  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

3.7.10