RobertTLange / evosax

Evolution Strategies in JAX 🦎

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Evosax Import Error

twoletters opened this issue · comments

Hi Rob,

Thank you for developing this excellent library. I was desperate to find a working implementation of several of these optimizers. Riding on JAX is the icing on the cake.

I used pip to install matplotlib 3.1.0, evosax 0.1.0 and jax[cpu] 0.4.2. Now in Python 3.8.10, if I try to import evosax, I get the following error:

>>> import evosax
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/dist-packages/evosax/__init__.py", line 36, in <module>
    from .problems import ProblemMapper
  File "/usr/local/lib/python3.8/dist-packages/evosax/problems/__init__.py", line 3, in <module>
    from .bbob import BBOBFitness
  File "/usr/local/lib/python3.8/dist-packages/evosax/problems/bbob.py", line 7, in <module>
    from evosax.utils.visualizer_2d import BBOBVisualizer
  File "/usr/local/lib/python3.8/dist-packages/evosax/utils/visualizer_2d.py", line 10, in <module>
    cmap = cm.colors.LinearSegmentedColormap.from_list(
  File "/usr/local/lib/python3.8/dist-packages/matplotlib/colors.py", line 704, in from_list
    r, g, b, a = to_rgba(color)
  File "/usr/local/lib/python3.8/dist-packages/matplotlib/colors.py", line 177, in to_rgba
    rgba = _to_rgba_no_colorcycle(c, alpha)
  File "/usr/local/lib/python3.8/dist-packages/matplotlib/colors.py", line 231, in _to_rgba_no_colorcycle
    raise ValueError("Invalid RGBA argument: {!r}".format(orig_c))
ValueError: Invalid RGBA argument: '#eee'

The incriminating code is:

cmap = cm.colors.LinearSegmentedColormap.from_list(
"Custom", [(0, "#2f9599"), (0.45, "#eee"), (1, "#8800ff")], N=256
)

Is that a matplotlib issue or a problem in the code?

Replacing "#eee" with "#0e0e0e" works.

Thank you -- this is probably a problem with the matplotlib version! Will be fixed in the next release!

Fixed in release v.0.1.4! Thank you for raising this.