-
Notifications
You must be signed in to change notification settings - Fork 265
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
making my own netcdf4 wheel results in a broken package #1241
Comments
Modern pip follow pep517/518 and will create a build environment specified in the pyproject.toml. One should not me calling setup.py directly like that anymore. However, if you want to build your own wheel I recommend to use the
Then install that wheel. |
Thank you for answering! This indeed works to some extent. It builds a wheel that does not cause the above problem. However, there still seem to be missing some things that are included in the pypi package, notably libnetcdf.so.18, as evidenced when trying to use the package:
If I use the package on a system that has the packages libnetcdf-dev and libhdf5-dev installed, it works fine. But the pypi package does not require a system with those packages installed. Note that the system that builds the custom netcdf wheel does have those packages installed as they are required for building - but they should not be required for running. Both systems run the same debian version (docker images). |
The PyPI ones have those built and bundled for you. That is why we recommend using the built wheels! If you want to build your own wheel you will need the c-libs installed to compiled netcdf4. See https://github.com/Unidata/netcdf4-python#development-installation |
Can you be more specific about the problem you mentioned ("spams megabytes worth of warnings")? We can hopefully fix that in the pre-built wheels. |
I would like to use the PyPI packages, but they spam so many warnings that they're technically unusable. I dug out a sample for @jswhit (see below). By chance I found out that installing the source (from an unzipped release) did not exhibit this behaviour. In order to bring this improved experience to our team (but without having them install packages and compile code), I'd like to build the wheel and include the libs as well. I see now that the PyPI wheels have the libraries included. Would you be able to point me in the right direction as to how to do this for my own wheels? Sample HDF5 errors when using the PyPI 1.6.2/3 packages (basically, this is repeated thousands of times) even for a very simple read action on an HDF file. This does not impact functionality, it just bloats the logs.
|
@bluppfisk what modules were imported by the script that produced these warnings? I suspect a binary incompatibility between HDF5 versions included in netCDF4 and some other package (perhaps xarray or h5py?). |
@jswhit there's definitely xarray which uses netcdf4 as a backend. I also believe this problem occurs mostly in a multi-processing environment but I am not 100% sure. |
Only to ask whether you discovered https://github.com/pypa/auditwheel for your wheels. This copies the linked libraries into the wheel, so you can install it on other compatible systems, along with the libraries. |
the multiprocessing bit may be the culprit - the netCDF4 and HDF5 libs are not thread-safe. |
Thanks, this is indeed something I've found while searching for how to include libraries. But I'm not sure whether/how it will automatically decide which libraries it needs to include or whether/how to compile them. I'm digging a bit through the travis files in this repository, but fail to understand. Too inexperienced, so appreciate any pointers. @jswhit : it may very well be, but the beauty is that the versions installed from the source (i.e. not from pypi) do not exhibit this behaviour, so I was trying to recreate this experience (but distributed). |
agreed - it's not likely a threading issue then. How was the xarray package installed? via conda, pip, or a locally built wheel? I'm guessing it's using a different version of the HDF5 library. Simply changing the order of the imports may make it go away if this is the issue. If you can post a simple script that reproduces the warnings on your system, along with information about what versions of xarray and netcdf4-python were used and how they were installed, that would be a big help. (also what platform - windows, macosx or linux?) |
I'll do so in the coming days (takes some time to extract something useful). Answers to your questions:
In the meantime, could you provide any further pointers on how to compile + include those libraries in a wheel? I tried running the ./configure script but it complains about having nothing to compile. I don't know how that github workspace is set up. |
@bluppfisk are
and then, inside the Python interpreter:
As you can see I don't get a huge log output. This is also on Linux with an env that is isolated from any system libraries and using only the wheels provided on PyPI. If you can provide means for us to reproduce your env maybe we can try to debug this further but at this point I suspect you mat have more packages installed and/or some conflicts in there. PS: |
See #1242 for a way to reproduce this issue. I suggest the discuss is move to that issue to avoid mixing the problem of building your own wheel with the apparently new verbosity of HDF5. |
There is a problem with the pypi package (mentioned elsewhere, basically it spams megabytes worth of warnings). This error is circumvented by downloading the source and using
pip install
from inside the source folder.However, to make things easier in my organisation, I want to build a for our target system(s) that can be installed from our internal repository without going through the hoops described above. However, the resulting package seems broken, as the netCDF4 module does not have the Dataset attribute. This is evidenced by the error:
System:
What is it that pip install does differently from python3 -m setup.py (followed by a pip install of the wheel)?
Edit: came here after SO didn't yield any immediate answers (https://stackoverflow.com/questions/75874745/compiling-and-installing-with-pip-install-vs-python3-m-build)
The text was updated successfully, but these errors were encountered: