key4hep / key4hep-spack

A Spack recipe repository of Key4hep software.
10 stars 23 forks source link

Unable to import the awkward module in python #664

Open zwu0922 opened 4 days ago

zwu0922 commented 4 days ago

Hi,

I'm having problem with importing the awkward module in python with the nightly version 2024-10-16. Here is the error message I received when I attempted to import awkward in python:

Python 3.11.9 (main, Sep 20 2024, 11:17:20) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import awkward
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/cvmfs/sw-nightlies.hsf.org/key4hep/releases/2024-09-21/x86_64-almalinux9-gcc14.2.0-opt/py-awkward/2.6.6-z5legc/lib/python3.11/site-packages/awkward/__init__.py", line 33, in <module>
    import awkward.jax
  File "/cvmfs/sw-nightlies.hsf.org/key4hep/releases/2024-09-21/x86_64-almalinux9-gcc14.2.0-opt/py-awkward/2.6.6-z5legc/lib/python3.11/site-packages/awkward/jax.py", line 10, in <module>
    from awkward import highlevel
  File "/cvmfs/sw-nightlies.hsf.org/key4hep/releases/2024-09-21/x86_64-almalinux9-gcc14.2.0-opt/py-awkward/2.6.6-z5legc/lib/python3.11/site-packages/awkward/highlevel.py", line 29, in <module>
    from awkward._pickle import (
  File "/cvmfs/sw-nightlies.hsf.org/key4hep/releases/2024-09-21/x86_64-almalinux9-gcc14.2.0-opt/py-awkward/2.6.6-z5legc/lib/python3.11/site-packages/awkward/_pickle.py", line 16, in <module>
    import importlib_metadata
ModuleNotFoundError: No module named 'importlib_metadata'
>>> 

Could you please help me fix this issue? Some useful information, including the steps to reproduce the error, can be found below.

Thanks in advance, Zhibo

  1. Source the nightly version and run python
source /cvmfs/sw-nightlies.hsf.org/key4hep/setup.sh -r 2024-10-16
python
  1. Import awkward module in python import awkward

    • Goal: I would like to be able to import awkward with the latest nightly version.
jmcarcell commented 4 days ago

The workaround is to install importlib-metadata, for example with pip install importlib-metadata --prefix=some/prefix and make sure where the module is installed is in PYTHONPATH. The installation of the module will be in something like some/prefix/lib/python3.11/site-packages.