Score:1

Is there a safe way to upgrade boto3 system wide?

br flag

(I'm running Ubuntu 20.04.3 LTS)

I make daily use of awscli, which I installed with apt and it works just fine. However the version of boto3 that came with it is very old (1.9.253) by comparison to the most recent version (1.20.3). Normally, this wouldn't be a problem, but there appears to be a bug in this version of boto3 that prevents me from writing any scripts that need to use AWS's SSO interface:

import boto3                                                                                      
boto3.setup_default_session()                                                                     
client = boto3.client('secretsmanager')                                                           
client.list_secrets()  # NoCredentialsError

Running the same code in a virtualenv running a modern version of boto3 renders the expected output, so I figure it's the wide version gap that's at fault here.

I know that I could just run pip install --upgrade boto3 as root, but that'd likely cause all manner of stuff breaking, so I'm looking for a cleaner/safer alternative. Does one exist? At the moment I'm looking at starting little virtualenvs everywhere and writing wrapper aliases to use that python instance to run my scripts but that feels nasty too.

Daniel Quinn avatar
br flag
It's a standard virtualenv created with `python3 -m venv my_virtualenv`. The only thing *different* is the boto3 version that gets installed into it when I run `pip install boto3`.
Daniel Quinn avatar
br flag
I'm already running Python 3.8.10 as that's what comes with Ubuntu.
Daniel Quinn avatar
br flag
It's generally a Bad Idea to run `pip` against the system-installed Python. I can obviously upgrade boto3 in a virtualenv, but I don't want to change the version of the system-installed boto3 directly like that as it would likely have unintented (and hard to fix) repercussions.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.