pygrib icon indicating copy to clipboard operation
pygrib copied to clipboard

How can installation be fixed?

Open weatherfrog opened this issue 6 years ago • 8 comments

No offense, but the installation of pygrib is a challenge, to say the least. Especially when deploying a production system.

The first problem is that setup.py fails if pyproj is not installed in advance. It does not seem to me that setup.py relies upon pyproj, so this check can probably be dropped.?

Further, setup.py naturally relies on NumPy, a well known problem for many other libraries as well. Thanks to PEP 518, this can now be overcome by including a file pyproject.toml that specifies what tools are required in the build process. Recent versions of pip will then install these tools before running setup.py:

[build-system]
requires = ["setuptools", "wheel", "numpy>=1.10"]

What are your thoughts about this? Would you accept a pull request dealing with these issues?

weatherfrog avatar Oct 18 '18 16:10 weatherfrog

This PR might fix the above problem: https://github.com/jswhit/pygrib/pull/90

weatherfrog avatar Nov 06 '18 13:11 weatherfrog

Install ought to work now, but use might still require you to manually install pyproj depending on your specifics.

local-minimum avatar Nov 10 '18 11:11 local-minimum

Are you sure? setup.pyin the master branch still fails on my machine (Python 3.6.7, latest pip):

$ pip --version
pip 18.1 from /xxx/pygrib/venv/lib/python3.6/site-packages/pip (python 3.6)
(venv) xxx/pygrib (master) 

$ pip install -e .
Looking in indexes: https://pypi.org/simple/
Obtaining file://xxxx/pygrib
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/rg/Desktop/pygrib/setup.py", line 2, in <module>
        import os, glob, numpy, sys
    ModuleNotFoundError: No module named 'numpy'

weatherfrog avatar Dec 14 '18 16:12 weatherfrog

I'll see if I can squeeze in some time to fix it once and for all.

local-minimum avatar Dec 15 '18 11:12 local-minimum

In addition to #112, I created a wheel that you can use which should make the install process as simple as putting the wheel in your requirements.txt instead of just pygrib:

wheel: https://github.com/kallsyms/pygrib/releases/download/v2.0.4-wheel/pygrib-2.0.4-cp36-cp36m-manylinux1_x86_64.whl corresponding github release with build steps: https://github.com/kallsyms/pygrib/releases/tag/v2.0.4-wheel

kallsyms avatar May 31 '19 22:05 kallsyms

I cloned the repo, installed numpy and pyproj, and I still get:

    /usr/bin/ld: cannot find -leccodes
    collect2: error: ld returned 1 exit status
    /home/pygrib/setup.py:41: DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.
      config = _ConfigParser()
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command "/usr/local/bin/python -c 'import setuptools, tokenize;__file__='"'"'/home/pygrib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps" failed with error code 1 in /home/pygrib/

preeth1 avatar Nov 29 '19 00:11 preeth1

@preeth1 have you installed libeccodes-dev (assuming you're on ubuntu)?

kallsyms avatar Nov 29 '19 19:11 kallsyms

@kallsyms - that was the issue, this helped me: https://gist.github.com/emmanuelnk/406eee50c388f4f73dcdff521f2aa7b2 thanks!

preeth1 avatar Dec 03 '19 02:12 preeth1