AttributeError: module 'awkward' has no attribute 'layout' #660
Replies: 4 comments 3 replies
-
The problem is mixing Uproot 4 with Awkward 0. Update pip packages with pip uninstall awkward awkward0 awkward1 uproot uproot3 uproot4 enough times that you get rid of all existing versions, then pip install awkward uproot and if you need old interfaces, you can also install pip install awkward0 uproot3 # the old ones You can use old and new in the same Python process, but be sure your versions are all to the right of the name-change transition line: |
Beta Was this translation helpful? Give feedback.
-
Oh sorry, no idea why I had awkward0. Or, awkward but in version 0? But thank you that worked, and thanks for the swift repsonse! |
Beta Was this translation helpful? Give feedback.
-
For more context, this is part of a major Awkward+Uproot upgrade that completed in December 2020. The error you saw was because names were switched, and the names were switched because some analyses might be depending on the old interfaces. We want to allow gradual adoption by the ability to import both old and new in the same Python process, which wouldn't be possible if the version number was switched. Unfortunately for pip, you have to upgrade packages manually. If something brings in an old version of some package as a dependency, it won't get upgraded unless some package explicitly requires a new version or you manually upgrade it. Technically (i.e. from pip's perspective), Uproot 4 does not require Awkward Array, so that it is more portable, so that's why you didn't get it automatically. |
Beta Was this translation helpful? Give feedback.
-
"If something brings in an old version of some package as a dependency" yes this turned out to be the issue, installing uproot-methods caused awkward to downgrade. I've seen that vector (https://vector.readthedocs.io/en/latest/index.html) is the recommended way to handle Lorentz vectors, but I'm a little bit lost. I have a TTree with TLorentzVectors and I just need to get things like .Pt() and .Phi(). Do I need to recreate those functions from fX fY fZ and fE? Do you have a good guide for this sort of thing? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi, sorry if this is a very basic question but.. I'm trying to get things to work and I'm following the https://hsf-training.github.io/hsf-training-uproot-webpage/ guide. The only context is that I have a file with a TTree containing several TBranches. I want to make a dict holding the branches and their arrays, but I get this:
To get here I just did pip install uproot. I have uproot 4.0.1 and awkward 0.14.0. Would you please lend a hand?
Beta Was this translation helpful? Give feedback.
All reactions