b45ch1 / algopy

AlgoPy is a Research Prototype for Algorithmic Differentation in Python
79 stars 14 forks source link

run_tests.py fails if scipy is not installed #35

Closed cdeil closed 3 months ago

cdeil commented 11 years ago

Can you change run_tests.py so that it works even if scipy is not available?

$ python run_tests.py 
Traceback (most recent call last):
  File "run_tests.py", line 1, in <module>
    from algopy.tracer.tests.test_tracer import *
  File "/home/deil/software/algopy/algopy/__init__.py", line 66, in <module>
    import utpm
  File "/home/deil/software/algopy/algopy/utpm/__init__.py", line 29, in <module>
    from utpm import *
  File "/home/deil/software/algopy/algopy/utpm/utpm.py", line 18, in <module>
    from algorithms import RawAlgorithmsMixIn, broadcast_arrays_shape
  File "/home/deil/software/algopy/algopy/utpm/algorithms.py", line 34, in <module>
    from algopy import nthderiv
  File "/home/deil/software/algopy/algopy/nthderiv/__init__.py", line 5, in <module>
    from nthderiv import *
  File "/home/deil/software/algopy/algopy/nthderiv/nthderiv.py", line 339, in <module>
    @basecase(scipy.special.hyperu, domain=DOM_POS, extras=2)
AttributeError: 'NoneType' object has no attribute 'special'
[deil@localhost algopy]$ python -c 'import numpy'
[deil@localhost algopy]$ python -c 'import scipy'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named scipy
cdeil commented 11 years ago

Another question: is numpy a required or optional dependency for algopy?

At the moment algopy import fails if numpy is not installed:

$ python3 -c 'import algopy'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "./algopy/__init__.py", line 59, in <module>
    from numpy.testing import Tester
ImportError: No module named 'numpy'

There's various setup.py keywords to declare required and optional dependencies, but I'm not familiar enough with them and algopy to make a suggestion how algopy could declare it's required and optional dependencies properly: http://pythonhosted.org/distribute/setuptools.html

b45ch1 commented 11 years ago

NumPy is a hard requirement of AlgoPy. SciPy used to be optional, but since numerous the contributions of @agriffing, a rather large part of AlgoPy now depends on SciPy.

One could separate the two parts, but unless there is specific demand, I'll just make SciPy a hard requirement.

argriffing commented 10 years ago

SciPy was added as a dependency here https://github.com/b45ch1/algopy/commit/b70efcc9cf290a28ab50b2428585c1a858803e51 but it could be possible to make some changes so it is not required, if this is important.

b45ch1 commented 3 months ago

Closing due to inactivity.