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?
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.
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.
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.
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?
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.
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.
Cheers
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.
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.”