.. _installing:
Installation
============
Required dependencies
---------------------
* Required
   - Python (3.7 or later)
   - `xarray `__
   - `dask `__
   - `mypy_extensions `__ (only for python-3.7)
   - `python-blosc `__
   - `wurlitzer `__
   - `libwgrib2 `__
* Build
   - `Cython `__
   - gfortran_linux-64 from conda. Recommended when building in conda environment.
* Optional, used only by :ref:`pywgrib2 ` and the test suite.
   - `netcdf4 `__
   - `zarr `__
* Testing
   - `pytest `__
   - `dill `__
* Documentation
   - `sphinx `__
   - `sphinx_rtd_theme `__
   - `sphinxcontrib-programoutput `__
   - `matplotlib `__
   - `cfgrib `__
   - `cf_xarray `__
   - `metpy `__
..   - `ipython `__
Instructions
------------
With conda
^^^^^^^^^^
From within conda environment:
.. parsed-literal::
    conda install -c yt87 pywgrib2_xr
From the source
^^^^^^^^^^^^^^^
The best way to proceed is to install all required dependencies with conda:
.. parsed-literal::
    conda create -n test python=3.8 cython gcc_linux-64 numpy
    conda activate test
    conda install dask python-blosc wurlitzer xarray
    conda install pytest dill netcdf4 zarr      # to run tests
    conda install -c yt87 libwgrib2
Then, from the base of the source directory:
.. parsed-literal::
    python setup.py develop
The conda compiler will find *libwgrib2* and its header files. Native gcc works
as well, but one has to set ``library_dir`` and ``include_dir`` in *setup.cfg*.
**pywgrib2_xr** comes with the test suite. To run the tests, execute:
.. parsed-literal::
    pytest tests