Alien.py fails

well, seemingly you have a mix of openssl libs that is mixing up the ALICE software installation … maybe some other knowledgeable user of macos can help you clean up your installation …
but the rust error in the middle of python related modules is really weird!!

Hello Adrian, thanks for your reply. Sorry for the delay in response.

I am still having the issue. One of the warnings say that having openssl@3 is the problem. I did brew install openssl@1.1.1 and added it in the path. But whenI reinstall python using brew, it automatically gets openssl@3.

init.py|attachment (4.6 KB)

I also uploaded the .py file where the warning is coming from. I appreciate any help regarding this.

Maybe @twilken know the exact recipe (what python version exactly and so on …)
Timo, I have the feeling that this kind of problems on mac is common, maybe a section of frequent errors in Prerequisites for macOS · ALICE Analysis Tutorial would be useful?

Hi @asasikum, unfortunately I have not been able to reproduce this on our CI machines.

What is your local setup like?

Do you have Python installed through Brew only, or do you also have a virtualenv, conda/miniconda installation or similar?

What does the echo $PYTHONPATH; echo $VIRTUAL_ENV command output inside and outside the alienv shell?

Do you remember which instructions you followed to get set up initially? Was it the page @asevcenc linked just above? Did you perform any additional steps?

Just to add: since the end of last year, we’ve switched to openssl@3 by default, so most things should build against that version. Having openssl@1.1 installed should not hurt, though.

I’m guessing “LibreSSL 2.8.3” mentioned in your error message is the libssl bundled with MacOS, not the one from brew or alidist.

Thanks @asevcenc and @twilken for getting back to me on this. Alice-talk does not give me notification and I missed your response. Apologies in the delay.

Hi Timo, I did pip3 install cffi and now the error is different. It is as following:

[AliPhysics/latest-master-o2] ~/alice %> alien.py                              
/Users/anjaly/alice/sw/osx_x86-64/xjalienfs/1.5.7-local1/lib/python/site-packages/urllib3/__init__.py:34: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
  warnings.warn(
XRootD module could not be imported! Not fatal, but XRootD transfers will not work (or any kind of file access)
 Make sure you can do:
python3 -c 'from XRootD import client as xrd_client'
Traceback (most recent call last):
  File "/Users/anjaly/alice/sw/osx_x86-64/xjalienfs/1.5.7-local1/bin/alien.py", line 5, in <module>
    from alienpy.alien import main
  File "/Users/anjaly/alice/sw/osx_x86-64/xjalienfs/1.5.7-local1/lib/python/site-packages/alienpy/alien.py", line 71, in <module>
    from .xrd_core import (DO_XrootdCp, HAS_XROOTD, download_tmp, upload_tmp, xrd_client, xrd_config_init,
  File "/Users/anjaly/alice/sw/osx_x86-64/xjalienfs/1.5.7-local1/lib/python/site-packages/alienpy/xrd_core.py", line 920, in <module>
    def xrd_response2dict(response_status: xrd_client.responses.XRootDStatus) -> dict:
NameError: name 'xrd_client' is not defined
[AliPhysics/latest-master-o2] ~/alice %>

I am on Mac OS Monterey version 12.7.2 with xcode 14.2.
I have python from homebrew and the one that mac has with xcode. I did face quite some python version mismatch issues while trying to get jupyter notebook working with the newly installed AliPhysics. But was able to fix those.

To install AliPhysics, I used the instructions from the link Adrian posted above. I dont have any virtualenv, conda etc. And the commands echo $PYTHONPATH; echo $VIRTUAL_ENV output is empty outside the alice envt. Inside alice envt, it gives following:

echo $PYTHONPATH;                  
/Users/anjaly/alice/sw/osx_x86-64/xjalienfs/1.5.7-local1/lib/python/site-packages:/Users/anjaly/alice/sw/osx_x86-64/ROOT/v6-30-01-alice2-local1/lib:/Users/anjaly/alice/sw/osx_x86-64/XRootD/v5.6.0-local1/lib/python/site-packages:/Users/anjaly/alice/sw/osx_x86-64/Python-modules/1.0-local1/share/python-modules/lib/python3.8/site-packages
[AliPhysics/latest-master-o2] ~ %> echo $VIRTUAL_ENV 
[AliPhysics/latest-master-o2] ~ %>

ps: I have been trying to link python3.9 instead of python3.8 as default which helped me fix the issues I was having before. Any help on this would be appreciated.

Hi @asasikum, thank you for posting the detailed output!

I suspect that because your Python-modules package was built with the older Python (version 3.8), it is not compatible with Python 3.9, so Python 3.9 fails to load the various modules from /Users/anjaly/alice/sw/osx_x86-64/Python-modules/1.0-local1/share/python-modules/lib/python3.8/site-packages.

Could you try running aliBuild clean --aggressive-cleanup, then rm -rf /Users/anjaly/alice/sw/osx_x86-64/Python-modules, and then rebuild using aliBuild build AliPhysics? After that, it should hopefully work better!

Hello, I actually had both python3.8 and python 3.9 folder under the directory you mentioned (/Users/anjaly/alice/sw/osx_x86-64/Python-modules/1.0-local1/share/python-modules/lib). And I realized that build was looking for packages under python3.8 and were not compatible. I copied many folders from python3.9 and it was progressing that way. Now, i only have a folder named python3.9 under that folder. Probably i removed or renamed another one. I will try what you said and will let u know how it goes.

I did what you said and the build was successful. But when I do alien.py, i get the same error I got initially.(screenshot is attached)
May be I need to rebuild xROOTD or xjaliens likeyou suggested for python-modules?

Hi @asasikum, that’s a good point, some Python modules are in the XRootD and xjalienfs packages instead. Could you try deleting just those and rebuilding?

You may have to change something trivial in AliPhysics (e.g. adding a blank line somewhere) to get aliBuild to realise that it needs to rebuild AliPhysics as well!

Hi @asasikum, to respond to what you sent me by email:

I’d recommend you stop running make -j install for now – that command WILL NOT WORK and will make things much more confusing if you are changing anything outside of AliPhysics itself (e.g. changing the Python version, or changing anything about other packages).

Please use aliBuild build AliPhysics to rebuild for now.

aliBuild should be clever enough to only rebuild what has changed – so internally, it does the same thing as make -j install, but it takes more things about your system into account.

Hi Timo, thanks for the response. My AliPhysics build was failing at ROOT in the previous build. But with python version 3.11, finally build went through. The other versions of python was incompatible with my system. But even now when I do alien.py, I get error as following:

[AliPhysics/latest-master-o2] ~/alice %> alien.py
XRootD module could not be imported! Not fatal, but XRootD transfers will not work (or any kind of file access)
 Make sure you can do:
python3 -c 'from XRootD import client as xrd_client'
Traceback (most recent call last):
  File "/Users/anjaly/alice/sw/osx_x86-64/xjalienfs/1.5.7-local1/bin/alien.py", line 5, in <module>
    from alienpy.alien import main
  File "/Users/anjaly/alice/sw/osx_x86-64/xjalienfs/1.5.7-local1/lib/python/site-packages/alienpy/alien.py", line 71, in <module>
    from .xrd_core import (DO_XrootdCp, HAS_XROOTD, download_tmp, upload_tmp, xrd_client, xrd_config_init,
  File "/Users/anjaly/alice/sw/osx_x86-64/xjalienfs/1.5.7-local1/lib/python/site-packages/alienpy/xrd_core.py", line 920, in <module>
    def xrd_response2dict(response_status: xrd_client.responses.XRootDStatus) -> dict:
                                           ^^^^^^^^^^
NameError: name 'xrd_client' is not defined
[AliPhysics/latest-master-o2] ~/alice %>

So, i removed both XRootD and xjalienfs in this way rm -rf /Users/anjaly/alice/sw/osx_x86-64/XRootD/xjalienfs and did aliBuild build AliPhysics. But problem still persists unfortunately.

Hi @asasikum, the rm command you ran is not correct. The correct command is:

rm -rf ~/alice/sw/osx_x86-64/{XRootD,xjalienfs}

Hello Timo,
I removed XRootD and xjalienfs the way you said and built AliPhysics. Now, alien.py works fine.
Thanks a lot :slight_smile: