On 13/05/2021 20:06, Mark Sapiro wrote:
On 5/13/21 11:28 AM, Ruth Ivimey-Cook wrote: Yes, I overlooked some aspects of virtualenv. Actually, the Python in the virtualenv is mostly symlinks to the Python it was built with, so whether it continues to work after a Python upgrade depends on what the symlinks are and how the Python upgrade installs.
Correct.
I would therefore appreciate some guidance on performing the upgrade from 3.6 to 3.8 with the minimum of fuss.
[I am not sure, but it could be possible to install python3.8 while using Ubuntu 18, so that the dist upgrade never breaks anything. Worth exploring.] I haven't tested any of this, but I suspect if Python is for example, /usr/bin/python3.6 and /usr/lib/python3.6 the upgrade removes those and installs /usr/bin/python3.8 and /usr/lib/python3.8, that you could just create symlinks from /usr/bin/python3.6 and /usr/lib/python3.6 to /usr/bin/python3.8 and /usr/lib/python3.8 respectively and it would work.
It would be nice if that worked, and I tried it, but it doesn't work because the python system and site directories under ./lib are also versioned (egĀ ./lib/python3.6/site-packages), so you would have to additionally create symlinks for those and/or rebuild those.
On the other hand, if the symlinks in the venv are to things like /usr/bin/python3 and /usr/lib/python3 which used to point to 3.6 versions and after upgrade point to 3.8 versions, it should just work.
Sadly they aren't - they link to python3.6 or whatever... and even if not, the /lib/ naming gets you as well.
And even if that can be worked around (eg by renaming the mailman /lib/python3.6 folder to /lib/python3.8), the python .pyc files are /also/ versioned, so you then have to find & delete them all to force the new interpreter to rebuild them or python falls down in a heap.
As far as installing Python3.8 on Ubuntu 18.04 goes, the machine I'm typing this on is Ubuntu 18.04 and has 6 different Python3 versions
mark@msapiro:~$ /usr/bin/python3.5 --version Python 3.5.2 mark@msapiro:~$ /usr/bin/python3.6 --version Python 3.6.9 mark@msapiro:~$ /usr/local/bin/python3.6 --version Python 3.6.12 mark@msapiro:~$ /usr/local/bin/python3.7 --version Python 3.7.9 mark@msapiro:~$ /usr/local/bin/python3.8 --version Python 3.8.7 mark@msapiro:~$ /usr/local/bin/python3.9 --version Python 3.9.1
and /usr/bin/python3 is a symlink to /usr/bin/python3.6 and /usr/local/bin/python3 is a symlink to /usr/local/bin/python3.9, so take your pick...
Indeed... and it would be lovely if it was that simple, but my experience was that even if you got a good python executable running, the other versioned elements of a python install caused it to mess up.
What worked for me in the end was a combination of forcing a complete rebuild/reinstall with the mailman3 python3.8 install, followed by a bit of rejigging of file permissions and settings (probably because I'd messed something up, but maybe not).
Regards
Ruth
-- Software Manager & Engineer Tel: 01223 414180 Blog: http://www.ivimey.org/blog LinkedIn: http://uk.linkedin.com/in/ruthivimeycook/