Installation Problem?
Opened this issue · 3 comments
Hello!
I'm trying to install your package and I'm a little confused by the error I'm getting. I installed using
python3 -m pip install openPMD-viewer
When trying to import this package I get an error saying I need a backend. The error suggests I install h5py
or openpmd-api
both of which I have installed.
[cdegrend@linux207]~% python3
Python 3.9.12+ (heads/3.9:b8b473e, Mar 27 2022, 17:04:32)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import openpmd_api
>>> import h5py
>>> import openpmd_viewer
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/u/wk/cdegrend/.local/lib/python3.9/site-packages/openpmd_viewer/__init__.py", line 9, in <module>
from .openpmd_timeseries import OpenPMDTimeSeries, FieldMetaInformation, \
File "/u/wk/cdegrend/.local/lib/python3.9/site-packages/openpmd_viewer/openpmd_timeseries/__init__.py", line 2, in <module>
from .main import OpenPMDTimeSeries, ParticleTracker
File "/u/wk/cdegrend/.local/lib/python3.9/site-packages/openpmd_viewer/openpmd_timeseries/main.py", line 17, in <module>
from .data_reader import DataReader, available_backends
File "/u/wk/cdegrend/.local/lib/python3.9/site-packages/openpmd_viewer/openpmd_timeseries/data_reader/__init__.py", line 1, in <module>
from .data_reader import DataReader, available_backends
File "/u/wk/cdegrend/.local/lib/python3.9/site-packages/openpmd_viewer/openpmd_timeseries/data_reader/data_reader.py", line 31, in <module>
raise ImportError('No openPMD backend found.\n'
ImportError: No openPMD backend found.
Please install either `h5py` or `openpmd-api`:
e.g. with `pip install h5py` or `pip install openpmd-api`
Thanks for any help / insight. Hopefully I'm just doing something silly here, I searched through the old issues and didn't see this yet.
Thanks for reporting this issue.
Could you specify how you installed h5py
and openpmd-api
? If you did pip install h5py
, then it could maybe be that your pip
and python3
do not point to the same Python version. An alternative would be python3 -m pip install h5py
.
As another alternative: do you have conda
installed? You could try conda install -c conda-forge openpmd_viewer
Both h5py
and openpmd-api
were installed with python3 -m pip install ...
This is because I built python from source (https://github.com/python/cpython). I'm thinking this is probably where the problem lies. However, both required packages successfully import as shown above so I'm not sure what the problem could be.
I don't have Conda.
OK, thanks for the info.
I think that you could try diagnose the problem by removing these lines:
https://github.com/openPMD/openPMD-viewer/blob/dev/openpmd_viewer/openpmd_timeseries/data_reader/data_reader.py#L21
https://github.com/openPMD/openPMD-viewer/blob/dev/openpmd_viewer/openpmd_timeseries/data_reader/data_reader.py#L27
This would allow you to see the error message that occurs when trying to import h5py
or openpmd_api
.