Questions and Answers : Unix/Linux : ATLAS (native_mt) Python incompatibility on Linux
Message board moderation

To post messages, you must log in.

AuthorMessage
0xc0ffee

Send message
Joined: 15 Jan 18
Posts: 1
Credit: 223,425
RAC: 0
Message 34709 - Posted: 21 Mar 2018, 12:00:34 UTC
Last modified: 21 Mar 2018, 12:10:41 UTC

Having noticed that all assigned ATLAS native_mt tasks had failed within 2-3 seconds, I looked at the log and this was consistent across all of them:
Traceback (most recent call last):
  File "run_atlas", line 2, in <module>
    import os,time,sys,shutil,commands,time,getopt,socket,re
ImportError: No module named 'commands'


The reason for this is that the default Python interpreter for my system is set to Python 3.5. Switching the default to Python 2 caused newly assigned ATLAS native tasks to run and complete successfully. This shouldn't come as a surprise since Python 2 has been deprecated for years and it is not uncommon to see more and more newer versions of distros move to Python 3 as the default system interpreter.

"ATLAS_run_atlas_2.53_x86_64-pc-linux-gnu" is basically a Python script so it may be worth migrating it to Python 3 or having two versions available.

In the meantime, there is a quick fix that can be deployed. The first line of the above file reads:
#!/usr/bin/env python


The above is generally ill-advised (even by Python docs). Instead, it should read:
#!/usr/bin/env python2

as this will ensure that the correct interpreter is selected, even if the system default is Python 3. Most current Linux distributions will have Python 3 and Python 2 available side by side.

Hope this helps if anyone is facing a similar issue. I might migrate the ATLAS script later on to Python 3 and post it here if people are interested.

P.S. That said, any other supporting python scripts which may be run (I haven't yet delved deeper) may need to have the first line amended too.
ID: 34709 · Report as offensive     Reply Quote
AGLT2
Volunteer moderator
Project administrator
Project developer
Project tester
Volunteer developer
Project scientist

Send message
Joined: 23 Jun 14
Posts: 12
Credit: 5,716,848,537
RAC: 4,772,831
Message 34982 - Posted: 13 Apr 2018, 10:15:57 UTC - in response to Message 34709.  

This is fixed.. It should use python2 instead of python3 now.
ID: 34982 · Report as offensive     Reply Quote
djoser
Avatar

Send message
Joined: 30 Aug 14
Posts: 145
Credit: 10,847,070
RAC: 0
Message 40072 - Posted: 2 Oct 2019, 20:29:44 UTC

Hello,

i read that python2 will not be maintained anymore as of 1st of January 2020.

See here: https://www.python.org/doc/sunset-python-2/

How will this affect native Atlas tasks, if at all?

I learned that python being installed is a requirement on linux systems.
What version of python is needed to run Atlas native?

Will Atlas run if only python3 is installed on a system?
Are python versions downward compatible?

Thanks and regards,
djoser.
Why mine when you can research? - GRIDCOIN - Real cryptocurrency without wasting hashes! https://gridcoin.us
ID: 40072 · Report as offensive     Reply Quote
[AF] Hydrosaure
Avatar

Send message
Joined: 8 May 17
Posts: 13
Credit: 36,461,132
RAC: 33,292
Message 40607 - Posted: 23 Nov 2019, 10:36:36 UTC

Latest version of native ATALS is still using Python2; it is starting to become a pressing matter seeing the EOL of that version.
ID: 40607 · Report as offensive     Reply Quote
David Cameron
Project administrator
Project developer
Project scientist

Send message
Joined: 13 May 14
Posts: 387
Credit: 15,314,184
RAC: 0
Message 40721 - Posted: 29 Nov 2019, 11:36:10 UTC - in response to Message 40607.  

It's on the TODO list to make those scripts compatible with python 3. Unfortunately I don't think we can rely on every machine having python 3 installed so we'll need to keep the compatibility with 2. Practically it means changing the first line from
#!/usr/bin/env python2
to
#!/usr/bin/env python
This means the preferred python will be used if both are installed and assumes that python 3-only machines have "python" pointing to python3.
ID: 40721 · Report as offensive     Reply Quote
David Cameron
Project administrator
Project developer
Project scientist

Send message
Joined: 13 May 14
Posts: 387
Credit: 15,314,184
RAC: 0
Message 41473 - Posted: 4 Feb 2020, 16:28:31 UTC - in response to Message 40721.  

ATLAS native from version 2.80 doesn't depend on python at all, it was easier to rewrite the bootstrap script in bash than make it python2 and 3 compatible :)
ID: 41473 · Report as offensive     Reply Quote

Questions and Answers : Unix/Linux : ATLAS (native_mt) Python incompatibility on Linux


©2024 CERN