Questions and Answers :
Unix/Linux :
ATLAS (native_mt) Python incompatibility on Linux
Message board moderation
Author | Message |
---|---|
Send message Joined: 15 Jan 18 Posts: 1 Credit: 223,425 RAC: 0 |
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. |
Send message Joined: 23 Jun 14 Posts: 12 Credit: 6,352,777,877 RAC: 855,359 |
This is fixed.. It should use python2 instead of python3 now. |
Send message Joined: 30 Aug 14 Posts: 145 Credit: 10,847,070 RAC: 0 |
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 |
Send message Joined: 8 May 17 Posts: 13 Credit: 40,619,782 RAC: 2,329 |
Latest version of native ATALS is still using Python2; it is starting to become a pressing matter seeing the EOL of that version. |
Send message Joined: 13 May 14 Posts: 387 Credit: 15,314,184 RAC: 0 |
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 python2to #!/usr/bin/env pythonThis means the preferred python will be used if both are installed and assumes that python 3-only machines have "python" pointing to python3. |
Send message Joined: 13 May 14 Posts: 387 Credit: 15,314,184 RAC: 0 |
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 :) |
©2024 CERN