Python Forum
Upgrade to python 3 opinion
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Upgrade to python 3 opinion
#1
Question on getting started for upgrade from python 2 to python 3:

We here at my company run python 2.7.5 on IDS-type and automation-controlled CentOS 7 servers.

A while back, we installed an app on one of our servers that required python 3. We added, at the advice of the vendor, these packages:

python35u-3.5.6-1.ius.centos7.x86_64
python35u-libs-3.5.6-1.ius.centos7.x86_64


Is it correct to say that, if we want to keep python 2 functionality, but we need python 3 functionality on all our servers for a new app, and we don't want python 3 to interfere -- that is, we want both python 2 and python 3 to function without issues -- that we are safe to install the above two packages on all (about 300) of our servers?

I'm looking for an opinion here. Thanks! Smile
Reply
#2
I don't know much about CentOS and I don't run 300 servers, but normally several Python interpreters on the same machine don't interfere. The main thing to worry about is the use of Python-related environment variables such as PYTHONPATH and the like. Avoid them, or fine tune the environment of processes using the Python interpreters.

If you could have Python 3.6 instead of 3.5, it would be much better from a pythonic perspective. 3.6 introduces some key new features such as f-strings. You may experience problems running new Python 3 code if you stick to 3.5.
metulburr likes this post
Reply
#3
Maybe?
If you're not relying on whatever "python" resolves to, and are using direct references (ie: calling python2.7 my_app.py instead of python my_app.py), then it doesn't matter. You could install 20 different versions of python and they wouldn't interfere with each other.

If it's a big concern, why not run it on it's own server(s) and access it over a rest interface?
Reply
#4
(May-07-2021, 02:47 PM)hokie1999 Wrote: Is it correct to say that, if we want to keep python 2 functionality, but we need python 3 functionality on all our servers for a new app, and we don't want python 3 to interfere -- that is, we want both python 2 and python 3 to function without issues -- that we are safe to install the above two packages on all (about 300) of our servers?
Look into using pyenv is a safe option and can switch seamlessly between Python versions.
My Tutorial pyenv Simple Python Version Management
For Centos Pyenv Install Centos 8 .
Wiki for all OS.
metulburr likes this post
Reply
#5
i have both Python 2.7.17 and Python 3.6.9 on my Xubuntu 18.04 LTS based laptop without using pyenv. i just don't code for Python 2. But i did need to run some old scripts on Python 2 to have a reference. i believe Python 3 was intended to coexist with Python 2, at least until the EOL date, 1 Jan 2020. i see no reason for it to have been changed since then.

if you have any Python 2 scripts that other tools run or other people use, don't use pyenv for Python 2. likewise, if you will be rewriting them to Python 3 (as you should have long ago) don't use pyenv for Python 3, either.

it sounds like you have a lot to upgrade, there.

edit1: changed "p;d" typo to "old"
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#6
Smile 
Ok, thanks for the input. :)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  opinion: configparser should have been better Skaperen 8 4,417 Oct-03-2020, 07:23 PM
Last Post: Skaperen
  Need help to upgrade Python 3.X Ritesh 3 3,740 Feb-18-2020, 04:06 AM
Last Post: Ritesh
  Any command to upgrade Python version 2.X to latest KarthiK 7 4,116 Feb-15-2020, 07:25 PM
Last Post: DeaD_EyE
  How should I upgrade python to 3.8.0? newbieAuggie2019 4 83,726 Oct-20-2019, 08:23 PM
Last Post: newbieAuggie2019
  what is your opinion of this syntactic sugar idea? Skaperen 8 4,424 Nov-28-2018, 03:15 AM
Last Post: Skaperen
  Guido van Rossum does not care about the opinion of the community. Kirill_Dubovitskiy 12 8,071 Sep-14-2018, 06:33 PM
Last Post: micseydel
  [split] My opinion about OS choice for programming wavic 12 11,949 Oct-07-2016, 10:08 PM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020