LSSTDESC / snmachine

Machine learning code for photometric supernova classification
BSD 3-Clause "New" or "Revised" License
9 stars 5 forks source link

Fix install #254

Closed Catarina-Alves closed 3 years ago

Catarina-Alves commented 3 years ago

Fix issue preventing the installation of snmachine in NERSC: see here.

heather999 commented 3 years ago

I need to do some more testing in the morning, but I think we want to add a requirements.txt with the contents:

astropy>=1.1.2
matplotlib>=1.5.1
numpy>=1.18.4
scikit-learn==0.20.0
scipy>=0.17.0
george>=0.3.0
iminuit
pandas>=0.23.0
pywavelets>=0.4.0
sncosmo
nose>=1.3.7
future>=0.16
pyyaml>=3.13
seaborn
lightgbm
setuptools_scm

and then update setup.py's install_requires line:

install_requires=['astropy>=1.1.2',
                      'matplotlib>=1.5.1',
                      'numpy>=1.18.4',
                      'scikit-learn==0.20.0',
                      'scipy>=0.17.0',
                      'george>=0.3.0',
                      'iminuit',
                      'pandas>=0.23.0',
                      'pywavelets>=0.4.0',
                      'sncosmo',
                      'nose>=1.3.7',
                      'future>=0.16',
                      'pyyaml>=3.13',
                      'seaborn',
                      'lightgbm',
                      "setuptools_scm"],

I think that will limit the installed dependencies to just what is needed. In my test install, I needed to remove the constraints on the iminuit and sncosmo packages. Were those restrictions really needed?

Catarina-Alves commented 3 years ago

Thank you @heather999. What was happening when the iminuit and sncosmo packages had the restrictions? We can remove the iminuit restriction but the sncosmo is important to keep, otherwise the tests start failing as sncosmo is updated because the function outputs change.

heather999 commented 3 years ago

It should be fine to keep the restriction on sncosmo set to 2.1.0. I had some trouble with iminuit with the restrictions due to trouble building from source and being unable to find a suitable wheel binary for install at NERSC - removing the version restriction fixed that. So here's my amended suggestion for requirements.txt:

astropy>=1.1.2
matplotlib>=1.5.1
numpy>=1.18.4
scikit-learn==0.20.0
scipy>=0.17.0
george>=0.3.0
iminuit
pandas>=0.23.0
pywavelets>=0.4.0
sncosmo==2.1.0
nose>=1.3.7
future>=0.16
pyyaml>=3.13
seaborn
lightgbm
setuptools_scm

and

install_requires=['astropy>=1.1.2',
                      'matplotlib>=1.5.1',
                      'numpy>=1.18.4',
                      'scikit-learn==0.20.0',
                      'scipy>=0.17.0',
                      'george>=0.3.0',
                      'iminuit',
                      'pandas>=0.23.0',
                      'pywavelets>=0.4.0',
                      'sncosmo==2.1.0',
                      'nose>=1.3.7',
                      'future>=0.16',
                      'pyyaml>=3.13',
                      'seaborn',
                      'lightgbm',
                      "setuptools_scm"],

Once that is set - maybe we can think about setting up automated PyPI uploads in GitHub actions - once we're sure the pip installs are generally working well.

heather999 commented 3 years ago

Learning some things.. I'm working with python 3.8 and joblib < 0.14 is incompatible with that version of python.. scikit-learn 0.20.0 comes with joblib 0.13.x bundled in the distribution. More recent versions of scikit-learn would fix this. Do you need scikit-learn 0.20.0? If so, then snmachine probably will not be compatible with python 3.8 until there is an update.

Catarina-Alves commented 3 years ago

@heather999 I do believe that I can use the most updated scikit-learn version. It might change the result of some tests but I can fix them, if that happens. The issue with a new version of sncosmo was much more delicate. So, what is it better to use? scikit-learn>= some version?

heather999 commented 3 years ago

If you can remove any restriction that might be best, but at least >=0.21.0 because at that point, scikit-learn defines joblib as an external dependency and no longer distributes an older version.

Catarina-Alves commented 3 years ago

@heather999 I have made the required changes and upload the recent version to pypi. Does it work now or do I need to change something else?