conda-forge / astropy-feedstock

A conda-smithy repository for astropy.
BSD 3-Clause "New" or "Revised" License
5 stars 17 forks source link

Missing scipy dependency? #99

Open traversaro opened 3 years ago

traversaro commented 3 years ago

Issue:

If I install astropy via conda-forge with:

conda create -n astropyenv astropy

And then I try to execute some astropy code, I get an error that scipy is not installed:

(astroenv) C:\Users\STraversaro>python
Python 3.9.7 | packaged by conda-forge | (default, Sep  2 2021, 17:55:20) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from astropy.modeling.functional_models import AiryDisk2D
>>> psf = AiryDisk2D(radius=20)
>>> val = psf(2,3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\STraversaro\AppData\Local\mambaforge\envs\astroenv\lib\site-packages\astropy\modeling\core.py", line 398, in __call__
    new_call = make_function_with_signature(
  File "C:\Users\STraversaro\AppData\Local\mambaforge\envs\astroenv\lib\site-packages\astropy\modeling\core.py", line 377, in __call__
    return super(cls, self).__call__(*inputs, **kwargs)
  File "C:\Users\STraversaro\AppData\Local\mambaforge\envs\astroenv\lib\site-packages\astropy\modeling\core.py", line 918, in __call__
    return generic_call(self, *new_args, **kwargs)
  File "C:\Users\STraversaro\AppData\Local\mambaforge\envs\astroenv\lib\site-packages\astropy\modeling\core.py", line 4152, in generic_call
    outputs = self.evaluate(*chain(inputs, parameters))
  File "C:\Users\STraversaro\AppData\Local\mambaforge\envs\astroenv\lib\site-packages\astropy\modeling\functional_models.py", line 2252, in evaluate
    from scipy.special import j1, jn_zeros
ModuleNotFoundError: No module named 'scipy'

I may be missing something and this may be even an upstream issue, but I wonder if scipy is actually a required dependency of astropy?


Environment (conda list):

``` $ conda list (astroenv) C:\Users\STraversaro>conda list # packages in environment at C:\Users\STraversaro\AppData\Local\mambaforge\envs\astroenv: # # Name Version Build Channel astropy 4.3.1 py39h5d4886f_1 conda-forge ca-certificates 2021.5.30 h5b45459_0 conda-forge importlib-metadata 4.8.1 py39hcbf5309_0 conda-forge intel-openmp 2021.3.0 h57928b3_3372 conda-forge libblas 3.9.0 11_win64_mkl conda-forge libcblas 3.9.0 11_win64_mkl conda-forge liblapack 3.9.0 11_win64_mkl conda-forge mkl 2021.3.0 hb70f87d_564 conda-forge numpy 1.21.2 py39h6635163_0 conda-forge openssl 1.1.1l h8ffe710_0 conda-forge pip 21.2.4 pyhd8ed1ab_0 conda-forge pyerfa 2.0.0 py39h5d4886f_0 conda-forge python 3.9.7 h7840368_0_cpython conda-forge python_abi 3.9 2_cp39 conda-forge setuptools 58.0.4 py39hcbf5309_0 conda-forge sqlite 3.36.0 h8ffe710_1 conda-forge tbb 2021.3.0 h2d74725_0 conda-forge tzdata 2021a he74cb21_1 conda-forge ucrt 10.0.20348.0 h57928b3_0 conda-forge vc 14.2 hb210afc_5 conda-forge vs2015_runtime 14.29.30037 h902a5da_5 conda-forge wheel 0.37.0 pyhd8ed1ab_1 conda-forge zipp 3.5.0 pyhd8ed1ab_0 conda-forge ```


Details about conda and system ( conda info ):

``` $ conda info (astroenv) C:\Users\STraversaro>conda info active environment : astroenv active env location : C:\Users\STraversaro\AppData\Local\mambaforge\envs\astroenv shell level : 1 user config file : C:\Users\STraversaro\.condarc populated config files : C:\Users\STraversaro\AppData\Local\mambaforge\.condarc C:\Users\STraversaro\.condarc conda version : 4.10.3 conda-build version : not installed python version : 3.9.6.final.0 virtual packages : __cuda=11.2=0 __win=0=0 __archspec=1=x86_64 base environment : C:\Users\STraversaro\AppData\Local\mambaforge (writable) conda av data dir : C:\Users\STraversaro\AppData\Local\mambaforge\etc\conda conda av metadata url : None channel URLs : https://conda.anaconda.org/conda-forge/win-64 https://conda.anaconda.org/conda-forge/noarch package cache : C:\Users\STraversaro\AppData\Local\mambaforge\pkgs C:\Users\STraversaro\.conda\pkgs C:\Users\STraversaro\AppData\Local\conda\conda\pkgs envs directories : C:\Users\STraversaro\AppData\Local\mambaforge\envs C:\Users\STraversaro\.conda\envs C:\Users\STraversaro\AppData\Local\conda\conda\envs platform : win-64 user-agent : conda/4.10.3 requests/2.26.0 CPython/3.9.6 Windows/10 Windows/10.0.19042 administrator : False netrc file : None offline mode : False ```
traversaro commented 3 years ago

A similar problem (even if for pip) was originally reported by @mileslucas on Twitter, see https://twitter.com/mileslucas_/status/1436452596982554624 .

astrofrog commented 3 years ago

I do wonder if for the conda package there is any reason not to include all optional dependencies - since conda doesn't support extras like pip does?

astrofrog commented 3 years ago

To be clear, the issue here is that astropy is designed to be installable with minimal dependencies - but this then means having to install extra dependencies for various subpackages. For pip the solution is to do:

pip install astropy[all]

But there is no equivalent for conda.

bsipocz commented 3 years ago

This is on the agenda of the infra team to make the conda install pull in all the optional dependencies, too.

And, imo, I see no good reason why not make scipy a required dependency, even though only relatively small parts of the package requires it. After all pyyaml was made a dependency while only a tiny part required it, so it's already way over the "we ship with the absolute minimum" point.