sczesla / PyAstronomy

A collection of astronomy-related routines in Python
152 stars 35 forks source link

error: unknown file type '.pyf' (from 'src/modelSuite/XTran/forTrans/occultnl.pyf') #32

Closed jason-neal closed 6 years ago

jason-neal commented 6 years ago

I cloned the most recent version of master (to try out beta sigma) and have issues installing it into a fresh conda environment. I ran pip install -r requirements.txt and then the commands down below.

Trying to install without --with-ext complained about the extensions not being build and then using --with-ext gives a different error about unknown file type .pyf files.

~/Phd/Codes/Repos/PyAstronomy master
(betasig) ❯ git pull
Already up-to-date.

~/Phd/Codes/Repos/PyAstronomy master
(betasig) ❯ ls
build  MANIFEST.in_template  README.md  Releases.txt  requirements.txt  setup.py  src

~/Phd/Codes/Repos/PyAstronomy master
(betasig) ❯ python setup.py install
/home/jneal/anaconda3/envs/betasig/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
running install
running build
running build_py
running install_lib
running install_egg_info
Removing /home/jneal/anaconda3/envs/betasig/lib/python3.6/site-packages/PyAstronomy-0.13.0beta-py3.6.egg-info
Writing /home/jneal/anaconda3/envs/betasig/lib/python3.6/site-packages/PyAstronomy-0.13.0beta-py3.6.egg-info

  USER INFO: External modules have not been built!
    The following modules have not been compiled:
    "PyAstronomy.modelSuite.XTran.forTrans.occultnl", Sources:  ['src/modelSuite/XTran/forTrans/occultnl.pyf', 'src/modelSuite/XTran/forTrans/occultnl.f']
    "PyAstronomy.modelSuite.XTran.forTrans.occultquad", Sources:  ['src/modelSuite/XTran/forTrans/occultquad.pyf', 'src/modelSuite/XTran/forTrans/occultquad.f']
  USE 'python setup.py --with-ext install' to build external modules

~/Phd/Codes/Repos/PyAstronomy master
(betasig) ❯ python setup.py --with-ext install
/home/jneal/anaconda3/envs/betasig/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
running install
running build
running build_py
running build_ext
building 'PyAstronomy.modelSuite.XTran.forTrans.occultnl' extension
error: unknown file type '.pyf' (from 'src/modelSuite/XTran/forTrans/occultnl.pyf')

Have you seen this before/have a solution for this. Am I missing some sort of compiler?

sczesla commented 6 years ago

Hi,

Thanks for reporting this unpleasant behavior. I can reproduce the error in a fresh virtualenv with both Python 2 and 3.

A simple question first: Does it (betasig) work for you after an install without --with-ext?

Although I have not yet understood the details of the error, it is certainly related to the presence of some FORTRAN code in the package, which is, however, only relevant for some transit light-curve models. The --with-ext option triggers (or tries to trigger as it appears now) the compilation of this code (first via f2py). Without --with-ext, setup.py serves you a message (looking suspiciously like a complaint, I admit). This should, however, not break the install of the remaining package. I did not want to make --with-ext the default pure and simple, because I expected more trouble than good from it.

At any rate, I will try to figure out the origin of the error.

Cheers, Stefan

jason-neal commented 6 years ago

A simple question first: Does it (betasig) work for you after an install without --with-ext?

Yes. Now that I have tried it. I had gotten a little confused by the lack of install information between the different stages.

running build
running build_py
running install_lib
...

So I thought it had not been installed at all, and never tried to run it.

I think it may have also been a problem (in a different repo) with having version 0.11 pip installed and then trying to python setup.py install version 0.13beta. (not yet realizing that version 12 was available from pip)

sczesla commented 6 years ago

Great it did not break because of this.

The reason for the ".pyf" error appears to be that neither setup from distutils nor setuptools supports compilation of fortran code. Only the extended version from numpy does this. I adapted setup.py to reflect this. Hope this is resolved.

Stefan