Bug 1754144 - Review Request: python-cma - Co-variance Matrix Adaptation Evolution Strategy
Summary: Review Request: python-cma - Co-variance Matrix Adaptation Evolution Strategy
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Nobody's working on this, feel free to take it
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-09-21 05:02 UTC by Christoph Junghans
Modified: 2019-09-23 21:05 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2019-09-23 21:05:48 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Christoph Junghans 2019-09-21 05:02:58 UTC
Spec URL: https://junghans.fedorapeople.org/python-cma.spec
SRPM URL: https://junghans.fedorapeople.org/python-cma-2.7.0-1.fc30.src.rpm
Description: A stochastic numerical optimization algorithm for difficult (non-convex, ill-conditioned, multi-modal, rugged, noisy) optimization problems in continuous search spaces, implemented in Python.
Fedora Account System Username: junghans

Comment 1 Miro Hrončok 2019-09-22 13:54:20 UTC
> %global sum Co-variance Matrix Adaptation Evolution Strategy

You can just set:

Summary: Co-variance Matrix Adaptation Evolution Strategy

and later use:

Summary: %{summary}

---


> BuildRequires: python3-devel

The package uses setuptools (see setup.py), please also BR python3-setuptools.

---


> Requires: python3-numpy

Does the automatic dependency generator not work?

---


> chmod +x %{buildroot}%{python3_sitelib}/cma/{bbobbenchmarks.py,purecma.py,test.py}

Why do those files need to be executables? Why do they have shebangs?

---


> %{python3_sitelib}/%{srcname}
> %{python3_sitelib}/%{srcname}-%{version}-*.egg-info

It's more explicit if you put a leading slash, such as:

%{python3_sitelib}/%{srcname}/
%{python3_sitelib}/%{srcname}-%{version}-*.egg-info/

Comment 2 Christoph Junghans 2019-09-22 14:10:32 UTC
(In reply to Miro Hrončok from comment #1)
> > %global sum Co-variance Matrix Adaptation Evolution Strategy
> 
> You can just set:
> 
> Summary: Co-variance Matrix Adaptation Evolution Strategy
> 
> and later use:
> 
> Summary: %{summary}
Cool, didn't know that would work, changed.

> > BuildRequires: python3-devel
> 
> The package uses setuptools (see setup.py), please also BR
> python3-setuptools.
Added.

> > Requires: python3-numpy
> 
> Does the automatic dependency generator not work?
Didn't know there was an automatic dep generator, so dropped

> > chmod +x %{buildroot}%{python3_sitelib}/cma/{bbobbenchmarks.py,purecma.py,test.py}
> 
> Why do those files need to be executables? Why do they have shebangs?
Good point, I looked that there scripts again and all of them can be used with e.g. "python -m cma.test", so dropping the shebang should be fine.

> > %{python3_sitelib}/%{srcname}
> > %{python3_sitelib}/%{srcname}-%{version}-*.egg-info
> 
> It's more explicit if you put a leading slash, such as:
> 
> %{python3_sitelib}/%{srcname}/
> %{python3_sitelib}/%{srcname}-%{version}-*.egg-info/
Changed.

Spec URL: https://junghans.fedorapeople.org/python-cma.spec
SRPM URL: https://junghans.fedorapeople.org/python-cma-2.7.0-2.fc30.src.rpm

Comment 3 Miro Hrončok 2019-09-23 09:20:59 UTC
numpy still needs to be BuildRequired. The automatic dependency generator generate runtime requires.

+ /usr/bin/python3 setup.py test
Only `cma.purecma` has been imported. Install `numpy` ("pip install numpy") if you want to import the entire `cma` package.
running test
running egg_info
writing cma.egg-info/PKG-INFO
writing dependency_links to cma.egg-info/dependency_links.txt
writing top-level names to cma.egg-info/top_level.txt
reading manifest file 'cma.egg-info/SOURCES.txt'
writing manifest file 'cma.egg-info/SOURCES.txt'
running build_ext
/builddir/build/BUILD/cma-2.7.0/cma/evolution_strategy.py:1543: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.opts['CMA_diagonal'] is 1:
/builddir/build/BUILD/cma-2.7.0/cma/transformations.py:822: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  elif self.scales.shape is not () and len(self.scales) != self.N:
/builddir/build/BUILD/cma-2.7.0/cma/transformations.py:829: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  elif self.typical_x.shape is not () and len(self.typical_x) != self.N:
/builddir/build/BUILD/cma-2.7.0/cma/transformations.py:833: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if (self.scales is 1 and
/builddir/build/BUILD/cma-2.7.0/cma/transformations.py:834: SyntaxWarning: "is" with a literal. Did you mean "=="?
  self.typical_x is 0 and
/builddir/build/BUILD/cma-2.7.0/cma/transformations.py:872: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if self.scales is not 1:  # just for efficiency
/builddir/build/BUILD/cma-2.7.0/cma/transformations.py:875: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if self.typical_x is not 0:
/builddir/build/BUILD/cma-2.7.0/cma/transformations.py:951: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if self.typical_x is not 0:
/builddir/build/BUILD/cma-2.7.0/cma/transformations.py:953: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if self.scales is not 1:  # just for efficiency
evolution_strategy (unittest.loader._FailedTest) ... ERROR
fitness_functions (unittest.loader._FailedTest) ... ERROR
utils (unittest.loader._FailedTest) ... ERROR
math (unittest.loader._FailedTest) ... ERROR
fitness_transformations (unittest.loader._FailedTest) ... ERROR
fitness_models (unittest.loader._FailedTest) ... ERROR
constraints_handler (unittest.loader._FailedTest) ... ERROR
s (unittest.loader._FailedTest) ... ERROR
fitness_functions2 (unittest.loader._FailedTest) ... ERROR
optimization_tools (unittest.loader._FailedTest) ... ERROR
sigma_adaptation (unittest.loader._FailedTest) ... ERROR
restricted_gaussian_sampler (unittest.loader._FailedTest) ... ERROR
bbobbenchmarks (unittest.loader._FailedTest) ... ERROR
logger (unittest.loader._FailedTest) ... ERROR
transformations (unittest.loader._FailedTest) ... ERROR
experimentation (unittest.loader._FailedTest) ... ERROR
sampler (unittest.loader._FailedTest) ... ERROR
======================================================================
ERROR: evolution_strategy (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: evolution_strategy
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/evolution_strategy.py", line 184, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
======================================================================
ERROR: fitness_functions (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: fitness_functions
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/fitness_functions.py", line 18, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
======================================================================
ERROR: utils (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: utils
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/utilities/utils.py", line 10, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
======================================================================
ERROR: math (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: math
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/utilities/math.py", line 7, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
======================================================================
ERROR: fitness_transformations (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: fitness_transformations
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/fitness_transformations.py", line 5, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
======================================================================
ERROR: fitness_models (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: fitness_models
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/fitness_models.py", line 12, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
======================================================================
ERROR: constraints_handler (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: constraints_handler
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/constraints_handler.py", line 5, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
======================================================================
ERROR: s (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: s
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/s.py", line 10, in <module>
    from . import evolution_strategy as es
  File "/builddir/build/BUILD/cma-2.7.0/cma/evolution_strategy.py", line 184, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
======================================================================
ERROR: fitness_functions2 (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: fitness_functions2
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/fitness_functions2.py", line 38, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
======================================================================
ERROR: optimization_tools (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: optimization_tools
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/optimization_tools.py", line 4, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
======================================================================
ERROR: sigma_adaptation (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: sigma_adaptation
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/sigma_adaptation.py", line 5, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
======================================================================
ERROR: restricted_gaussian_sampler (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: restricted_gaussian_sampler
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/restricted_gaussian_sampler.py", line 60, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
======================================================================
ERROR: bbobbenchmarks (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: bbobbenchmarks
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/bbobbenchmarks.py", line 112, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
======================================================================
ERROR: logger (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: logger
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/logger.py", line 14, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
======================================================================
ERROR: transformations (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: transformations
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/transformations.py", line 4, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
======================================================================
ERROR: experimentation (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: experimentation
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/experimentation.py", line 8, in <module>
    import numpy as np  # to replace 'inf' with np.inf and vice versa
ModuleNotFoundError: No module named 'numpy'
======================================================================
ERROR: sampler (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: sampler
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/cma-2.7.0/cma/sampler.py", line 10, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
----------------------------------------------------------------------
Ran 17 tests in 0.001s
FAILED (errors=17)
Test failed: <unittest.runner.TextTestResult run=17 errors=17 failures=0>

Comment 4 Christoph Junghans 2019-09-23 15:06:50 UTC
(In reply to Miro Hrončok from comment #3)
> numpy still needs to be BuildRequired. The automatic dependency generator
> generate runtime requires.
Thanks, done.

Spec URL: https://junghans.fedorapeople.org/python-cma.spec
SRPM URL: https://junghans.fedorapeople.org/python-cma-2.7.0-3.fc30.src.rpm
TaskID: https://koji.fedoraproject.org/koji/taskinfo?taskID=37825324

Comment 5 Robert-André Mauchin 🐧 2019-09-23 19:46:24 UTC
Seems already packaged, although very outdated: https://src.fedoraproject.org/rpms/python-cma Owner is Zbigniew Jędrzejewski-Szmek. Propose a PR? Or a comaintainership?

Comment 6 Christoph Junghans 2019-09-23 21:05:48 UTC
(In reply to Robert-André Mauchin from comment #5)
> Seems already packaged, although very outdated:
> https://src.fedoraproject.org/rpms/python-cma Owner is Zbigniew
> Jędrzejewski-Szmek. Propose a PR? Or a comaintainership?

Not sure, how I overlooked this, turned it into a PR: https://src.fedoraproject.org/rpms/python-cma/pull-request/2


Note You need to log in before you can comment on or make changes to this bug.