UC-Davis-molecular-computing / ppsim

Python package for simulating population protocols
MIT License
10 stars 5 forks source link

add pandas and numpy lower bound to requirements.txt #34

Open dave-doty opened 3 years ago

dave-doty commented 3 years ago

I ran into this confusing error due to having pandas 0.24.2 installed: https://github.com/numpy/numpy/issues/18355

Upgrading to 1.3.3 fixed in. Not sure which version is required.

I got another error with an old version of numpy, something about numpy.random.bit_generator not defined. Might be best to define lower bounds for all the dependencies just in case people have old installations.

dave-doty commented 3 years ago

More specifically, this code failed:

s,i,r = 'S','I','R'
p = 0.1
delta = {
    (i,i): {(i,r): p},
    (s,i): {(s,r): p, (i,i): 1-p},
    (r,i): {(r,r): p},
}
n = 10**6
init = {i:1, s: n-1}
sim = pp.Simulation(init, delta)
sim.run(100, 0.1)
sim.history.plot()

on the last line with

TypeError                                 Traceback (most recent call last)
<ipython-input-1-2a771cca455d> in <module>
     18 sim.run(100, 0.1)
     19 # print(sim.history)
---> 20 sim.history.plot()

~\Anaconda3\lib\site-packages\pandas\plotting\_core.py in __call__(self, x, y, kind, ax, subplots, sharex, sharey, layout, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, secondary_y, sort_columns, **kwds)
   2940                           fontsize=fontsize, colormap=colormap, table=table,
   2941                           yerr=yerr, xerr=xerr, secondary_y=secondary_y,
-> 2942                           sort_columns=sort_columns, **kwds)
   2943     __call__.__doc__ = plot_frame.__doc__
   2944 

~\Anaconda3\lib\site-packages\pandas\plotting\_core.py in plot_frame(data, x, y, kind, ax, subplots, sharex, sharey, layout, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, secondary_y, sort_columns, **kwds)
   1971                  yerr=yerr, xerr=xerr,
   1972                  secondary_y=secondary_y, sort_columns=sort_columns,
-> 1973                  **kwds)
   1974 
   1975 

~\Anaconda3\lib\site-packages\pandas\plotting\_core.py in _plot(data, x, y, subplots, ax, kind, **kwds)
   1799         plot_obj = klass(data, subplots=subplots, ax=ax, kind=kind, **kwds)
   1800 
-> 1801     plot_obj.generate()
   1802     plot_obj.draw()
   1803     return plot_obj.result

~\Anaconda3\lib\site-packages\pandas\plotting\_core.py in generate(self)
    247     def generate(self):
    248         self._args_adjust()
--> 249         self._compute_plot_data()
    250         self._setup_subplots()
    251         self._make_plot()

~\Anaconda3\lib\site-packages\pandas\plotting\_core.py in _compute_plot_data(self)
    355                                                    "datetime",
    356                                                    "datetimetz",
--> 357                                                    "timedelta"])
    358 
    359         try:

~\Anaconda3\lib\site-packages\pandas\core\frame.py in select_dtypes(self, include, exclude)
   3324         # the "union" of the logic of case 1 and case 2:
   3325         # we get the included and excluded, and return their logical and
-> 3326         include_these = Series(not bool(include), index=self.columns)
   3327         exclude_these = Series(not bool(exclude), index=self.columns)
   3328 

~\Anaconda3\lib\site-packages\pandas\core\series.py in __init__(self, data, index, dtype, name, copy, fastpath)
    260             else:
    261                 data = sanitize_array(data, index, dtype, copy,
--> 262                                       raise_cast_failure=True)
    263 
    264                 data = SingleBlockManager(data, index, fastpath=True)

~\Anaconda3\lib\site-packages\pandas\core\internals\construction.py in sanitize_array(data, index, dtype, copy, raise_cast_failure)
    640 
    641             subarr = construct_1d_arraylike_from_scalar(
--> 642                 value, len(index), dtype)
    643 
    644         else:

~\Anaconda3\lib\site-packages\pandas\core\dtypes\cast.py in construct_1d_arraylike_from_scalar(value, length, dtype)
   1185                 value = to_str(value)
   1186 
-> 1187         subarr = np.empty(length, dtype=dtype)
   1188         subarr.fill(value)
   1189 

TypeError: Cannot interpret '<attribute 'dtype' of 'numpy.generic' objects>' as a data type