Skip to content
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

Successful install of pyxrootd but not importing anything #1939

Closed
jackleland opened this issue Mar 2, 2023 · 4 comments
Closed

Successful install of pyxrootd but not importing anything #1939

jackleland opened this issue Mar 2, 2023 · 4 comments

Comments

@jackleland
Copy link

jackleland commented Mar 2, 2023

I've been trying to get the python bindings for xrootd installed but am having issues, specifically with the module that comes with the latest homebrew package, but also more generally.

As per #1480, I tried to use the pre-compiled module that comes packaged with the latest brew formula (5.5.3). Following the two steps here:

  1. Add export PYTHONPATH=/opt/homebrew/Cellar/xrootd/5.5.3/lib/python3.11/site-packages:$PYTHONPATH to .zshrc/.bashrc/...
  2. Confirm that it is working by running python3 -c "import pyxrootd"

Allows me to import the pyxrootd module in a python 3.11 venv, but nothing is actually in the module when I inspect it, i.e.

>>> import pyxrootd as xrd
>>> dir(xrd)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']

So, nothing I can use? help(xrd) indicates that there's a client object available in the module but this just results in an attribute error.

I've also tried instead installing the pip package directly on a non-M1 mac environment and get the exact same thing. I feel I might be missing something crucial here but the python bindings documentation is outdated and not very useful so I don't know how else to proceed.

@amadio
Copy link
Member

amadio commented Mar 2, 2023

Note that the current Python bindings in Homebrew are installed for Python3.10, not 3.11. Have you tried with that version of Python? Also, maybe what you want to use is in XRootD instead of pyxrootd?

>>> from XRootD import client
>>> dir(client)
['CopyProcess', 'EnvGetDefault', 'EnvGetInt', 'EnvGetString', 'EnvPutInt', 'EnvPutString', 'File', 'FileSystem', 'URL', 'XRootD', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', '_version', 'absolute_import', 'copyprocess', 'division', 'env', 'file', 'filesystem', 'finalize', 'flags', 'glob', 'glob_funcs', 'iglob', 'print_function', 'responses', 'url', 'utils']

@jackleland
Copy link
Author

ahh yep, using

>>> from XRootD import client

did the trick. Is this stuff documented anywhere or is there someone I can speak to to get assistance?

@amadio
Copy link
Member

amadio commented Mar 2, 2023

Documentation can be found here: https://xrootd.slac.stanford.edu/doc/python/xrootd-python

@jackleland
Copy link
Author

Okay looks like this was just me failing to read the documentation properly, I thought it was outdated but the examples are actually a lot more extensive than I first realised. Thanks for the help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants