-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to work with AnalysisBase #6
Comments
Hi Matthew, This looks great! I really like it and it seems to work very well with python3 and R22. As you mention, setting up python2 with Analysisbase is a real pain. We (myself and a postdoc in Manchester) tried to do this with
with
and I had to comment out the check for CENTOS8 since it tries to use I'm not sure how one would nicely integrate an bootsrap installation of pip2 in your code though, or if there is a way around that. Thank you very much, |
@MoAly98 yeah for Python 2 |
Notes to clean up later: $ setupATLAS
$ asetup "21.2.203,AnalysisBase"
$ curl -sL --location --output /tmp/virtualenv.pyz https://bootstrap.pypa.io/virtualenv/2.7/virtualenv.pyz
$ command -v python2
/cvmfs/atlas.cern.ch/repo/sw/software/21.2/AnalysisBaseExternals/21.2.203/InstallArea/x86_64-centos7-gcc8-opt/bin/python2
$ python2 --version
Python 2.7.16
$ python2 /tmp/virtualenv.pyz ~/py2_debug/venv
Traceback (most recent call last):
File "/cvmfs/atlas.cern.ch/repo/sw/software/21.2/AnalysisBaseExternals/21.2.203/InstallArea/x86_64-centos7-gcc8-opt/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/cvmfs/atlas.cern.ch/repo/sw/software/21.2/AnalysisBaseExternals/21.2.203/InstallArea/x86_64-centos7-gcc8-opt/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/tmp/virtualenv.pyz/__main__.py", line 167, in <module>
File "/tmp/virtualenv.pyz/__main__.py", line 161, in run
File "/tmp/virtualenv.pyz/virtualenv/__init__.py", line 3, in <module>
File "/tmp/virtualenv.pyz/virtualenv/run/__init__.py", line 7, in <module>
File "/tmp/virtualenv.pyz/virtualenv/app_data/__init__.py", line 12, in <module>
File "/tmp/virtualenv.pyz/virtualenv/app_data/read_only.py", line 3, in <module>
File "/tmp/virtualenv.pyz/virtualenv/util/lock.py", line 13, in <module>
File "/tmp/virtualenv.pyz/virtualenv/util/path/__init__.py", line 3, in <module>
File "/tmp/virtualenv.pyz/virtualenv/util/path/_pathlib/__init__.py", line 14, in <module>
File "/tmp/virtualenv.pyz/__main__.py", line 153, in load_module
File "<string>", line 60, in <module>
File "/tmp/virtualenv.pyz/__main__.py", line 153, in load_module
File "<string>", line 584, in <module>
AttributeError: 'module' object has no attribute 'DirEntry' Though $ docker run --rm -ti python:2.7 /bin/bash
root@d71d9f265349:/# rm -rf /usr/local/bin/virtualenv
root@d71d9f265349:/# rm -rf /usr/local/lib/python2.7/site-packages/virtualenv
root@d71d9f265349:/# command -v virtualenv
root@d71d9f265349:/# find / -type d -iname virtualenv
root@d71d9f265349:/# curl -sL --location --output /tmp/virtualenv.pyz https://bootstrap.pypa.io/virtualenv/2.7/virtualenv.pyz
root@d71d9f265349:/# python2 /tmp/virtualenv.pyz debug/venv
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/tmp/virtualenv.pyz/__main__.py", line 167, in <module>
File "/tmp/virtualenv.pyz/__main__.py", line 163, in run
File "/tmp/virtualenv.pyz/virtualenv/__main__.py", line 18, in run
File "/tmp/virtualenv.pyz/virtualenv/run/__init__.py", line 30, in cli_run
File "/tmp/virtualenv.pyz/virtualenv/run/__init__.py", line 48, in session_via_cli
File "/tmp/virtualenv.pyz/virtualenv/run/__init__.py", line 75, in build_parser
File "/tmp/virtualenv.pyz/virtualenv/run/plugin/seeders.py", line 8, in __init__
File "/tmp/virtualenv.pyz/virtualenv/run/plugin/base.py", line 46, in options
File "/tmp/virtualenv.pyz/virtualenv/run/plugin/base.py", line 25, in entry_points_for
File "/usr/local/lib/python2.7/collections.py", line 69, in __init__
self.__update(*args, **kwds)
File "/usr/local/lib/python2.7/_abcoll.py", line 571, in update
for key, value in other:
File "/tmp/virtualenv.pyz/virtualenv/run/plugin/base.py", line 25, in <genexpr>
File "<string>", line 105, in load
File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named via_app_data.via_app_data
root@d71d9f265349:/# |
@MoAly98 can you comment on what you actually did to do a bootstrap install of |
The way I did it was:
and then got
|
@MoAly98 So I had attempted that before but the method you describe in a Release 21 AnalysisBase environment causes the $ setupATLAS
$ asetup "21.2.203,AnalysisBase"
$ command -v python2
/cvmfs/atlas.cern.ch/repo/sw/software/21.2/AnalysisBaseExternals/21.2.203/InstallArea/x86_64-centos7-gcc8-opt/bin/python2
$ mkdir py2_debug
$ cd py2_debug
$ curl -sLO https://bootstrap.pypa.io/pip/2.7/get-pip.py
$ python2 get-pip.py --target=./pip
$ ./pip/bin/pip2 --help
Traceback (most recent call last):
File "./pip/bin/pip2", line 5, in <module>
from pip._internal.cli.main import main
ImportError: No module named main Similarly, running $ python2 get-pip.py virtualenv
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
...
$ command -v virtualenv
/home/feickert/.local/bin/virtualenv
$ virtualenv venv
created virtual environment CPython2.7.16.final.0-64 in 1130ms
creator CPython2Posix(dest=/home/feickert/py2_debug/venv, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, wheel=bundle, setuptools=bundle, via=copy, app_data_dir=/home/feickert/.local/share/virtualenv)
added seed packages: pip==20.3.4, setuptools==44.1.1, wheel==0.37.1
activators NushellActivator,PythonActivator,FishActivator,CShellActivator,PowerShellActivator,BashActivator
$ . venv/bin/activate
(venv) $ command -v python
/home/feickert/py2_debug/venv/bin/python
(venv) $ python -m pip --version
Traceback (most recent call last):
File "/cvmfs/atlas.cern.ch/repo/sw/software/21.2/AnalysisBaseExternals/21.2.203/InstallArea/x86_64-centos7-gcc8-opt/lib/python2.7/site-packages/site.py", line 73, in <module>
__boot()
File "/cvmfs/atlas.cern.ch/repo/sw/software/21.2/AnalysisBaseExternals/21.2.203/InstallArea/x86_64-centos7-gcc8-opt/lib/python2.7/site-packages/site.py", line 3, in __boot
import os
File "/home/feickert/py2_debug/venv/lib/python2.7/os.py", line 49, in <module>
import posixpath as path
ImportError: No module named posixpath |
Resolved by PR #18 for AnalysisBase releases that use Python 3 (Release 22 onwards). |
To be more useful this should also work with ATLAS
AnlaysisBase
(both release 21 and release 22).Just the following diff gets things working for
AnalysisBase
22.2.61
Example with AnalysisBase 22.2.61:
though for
AnalysisBase
21
there are problems as things are still Python 2 there. This is a big problem as thevenv
module wasn't added to Python until Python 3:The text was updated successfully, but these errors were encountered: