CosmicStudioSoftware / OMMBV

Orthogonal Multipole Magnetic Basis Vectors - Complete orthogonal vector basis with accurate field-line mapping of electric fields and ion drifts within multipole magnetic fields
BSD 3-Clause "New" or "Revised" License
10 stars 7 forks source link

BUG: numpy.distutils.core in GA setup environment #50

Closed jklenzing closed 2 years ago

jklenzing commented 3 years ago

Describe the bug OMMBV is a requirement for multiple downstream packages, but is having trouble being installed in github actions.

To Reproduce Full test log: https://github.com/pysat/pysatMissions/runs/2355919399?check_suite_focus=true Relevant lines:

Collecting OMMBV
  Downloading OMMBV-0.5.4.tar.gz (63 kB)
    ERROR: Command errored out with exit status 1:
     command: /opt/hostedtoolcache/Python/3.8.9/x64/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gxwybpdy/ommbv_73b9476528ad4c2eb8bef97b755571c7/setup.py'"'"'; __file__='"'"'/tmp/pip-install-gxwybpdy/ommbv_73b9476528ad4c2eb8bef97b755571c7/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-o_jptcji
         cwd: /tmp/pip-install-gxwybpdy/ommbv_73b9476528ad4c2eb8bef97b755571c7/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-gxwybpdy/ommbv_73b9476528ad4c2eb8bef97b755571c7/setup.py", line 2, in <module>
        import numpy.distutils.core
    ModuleNotFoundError: No module named 'numpy'

Additional context apexpy uses a similar setup file and installs successfully. Not sure if this is syntax issue that needs to be updated.

jklenzing commented 3 years ago

Update: this can be installed by using

pip install --no-binary :OMMBV: OMMBV

but this requires dropping it from the requirements file

rstoneback commented 3 years ago

Thanks for the reminder @jklenzing. I'll put this on my to-do list.

rstoneback commented 3 years ago

Working on this now.

rstoneback commented 3 years ago

An update was posted in #51 and is now on pypi.

rstoneback commented 3 years ago

Update: this can be installed by using

pip install --no-binary :OMMBV: OMMBV

but this requires dropping it from the requirements file

I don't understand why the --no-binary option here matters. According to https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-no-binary that options disables using binary packages, and OMMBV doesn't have one.

rstoneback commented 2 years ago

I've removed the version file over in #53

jklenzing commented 2 years ago

Update: this can be installed by using

pip install --no-binary :OMMBV: OMMBV

but this requires dropping it from the requirements file

I don't understand why the --no-binary option here matters. According to https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-no-binary that options disables using binary packages, and OMMBV doesn't have one.

It's extra confusing as github actions is configured to ignore binary files by default already. It's possible that this flag will grab a different version of numpy, which seems to be the source of the issue.

rstoneback commented 2 years ago

Thats for the update. Speaking of GitHub Actions, I have OMMBV compiling fortran on windows, and python setup.py develop reports ok, but actually importing the fortran modules fails. You wouldn't happen to have the secret sauce to windows fortran?

jklenzing commented 2 years ago

nope

jklenzing commented 2 years ago

Just ran another test at pysatMissions. If I try to automate OMMBV with everything else, it tries to download 0.5.5, tries to load, then says

    File "/tmp/pip-install-y4ex95_0/ommbv_e1c4ef8b4e524631bca2bd7c098bdd6d/setup.py", line 17, in <module>
      from numpy.distutils.core import setup, Extension
  ModuleNotFoundError: No module named 'numpy'

It then tries 0.5.4, gets the same message, and gives up.

Running a separate manual install without the --no-binary option works just fine, so maybe something is not importing right?

rstoneback commented 2 years ago

apexpy has the same line in their setup, from numpy.distutils.core import setup, Extension

jklenzing commented 2 years ago

Looking through the logs, it's failing during the metadata check:

  Downloading OMMBV-0.5.5.tar.gz (63 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:

My working theory is that the requirements are not being passed through. This is handled differently in apexpy. I've put together a branch at my fork using setup.cfg to manage metadata, which may fix the issue. I'll add a PR once I'm sure it passes the tests. https://github.com/jklenzing/OMMBV/tree/sty/meta

jklenzing commented 2 years ago

While I'm playing with this code, are you interested in a github actions version of this to replace travis?

rstoneback commented 2 years ago

I've got one, https://github.com/rstoneback/OMMBV/pull/53

Thanks. I would appreciate any improvements!

I think I have things up to spec, overall. There is the windows build issue. Looks like windows compiles fortran fine but can't actually import fortran modules.

rstoneback commented 2 years ago

Looking through the logs, it's failing during the metadata check:

  Downloading OMMBV-0.5.5.tar.gz (63 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:

My working theory is that the requirements are not being passed through. This is handled differently in apexpy. I've put together a branch at my fork using setup.cfg to manage metadata, which may fix the issue. I'll add a PR once I'm sure it passes the tests. https://github.com/jklenzing/OMMBV/tree/sty/meta

Also have started a setup.cfg over in #53

jklenzing commented 2 years ago

apexpy uses a pyproject.toml file. Looks like https://www.python.org/dev/peps/pep-0518/ documents the rationale for usage, which seems to apply to this problem.

rstoneback commented 2 years ago

Another attempt is up and out!

jklenzing commented 2 years ago

Confirmed that this is working on Github Actions. Now I have to update some syntax for the core code. Thanks!