This really does seem like something caused by weird python install stuff (I know I have accidentally had two versions of python installed and have no idea when each was actually being used for things). Some things you might try and share here:
What do you get from `python --version` and `which python`?
What about `pip --version`?
What's the output of `pip list`?
Inside the sage -sh, what is the output of `pretext support`?
Oh, I assume you have set up `python` to be `python3` right? I don't remember what ubuntu does with that now.
You might also try manually deleting the /usr/local/bin/pretext directory and then reinstalling via pip.
The virtual environment will likely also help.