phoebe-project / phoebe2

PHOEBE - Eclipsing Binary Star Modeling Software
http://phoebe-project.org
GNU General Public License v3.0
80 stars 30 forks source link

Attribute problem collections has no attribute callable #831

Closed hwillems2 closed 6 months ago

hwillems2 commented 6 months ago

When I try to set up PHOEBE, I always get the same error as shown below. The Python script itself seems not to cause the problem:

`import matplotlib.pyplot as plt import phoebe

plt.rc('font', family='serif', size=14, serif='STIXGeneral') plt.rc('mathtext', fontset='stix') import phoebe import numpy as np

logger = phoebe.logger('error')

we'll set the random seed so that the noise model is reproducible

np.random.seed(123456789)

b = phoebe.default_binary() b.set_value('ecc', 0.2) b.set_value('per0', 25) b.set_value('teff@primary', 7000) b.set_value('teff@secondary', 6000) b.set_value('sma@binary', 7) b.set_value('incl@binary', 80) b.set_value('q', 0.3) b.set_value('t0_supconj', 0.1) b.set_value('requiv@primary', 2.0) b.set_value('vgamma', 80)

lctimes = phoebe.linspace(0, 10, 1005) rvtimes = phoebe.linspace(0, 10, 105) b.add_dataset('lc', compute_times=lctimes) b.add_dataset('rv', compute_times=rvtimes)

b.add_compute('ellc', compute='fastcompute') b.set_value_all('ld_mode', 'lookup') b.run_compute(compute='fastcompute')

fluxes = b.get_value('fluxes@model') + np.random.normal(size=lctimes.shape) 0.01 fsigmas = np.ones_like(lctimes) 0.02

rvsA = b.get_value('rvs@primary@model') + np.random.normal(size=rvtimes.shape) 10 rvsB = b.get_value('rvs@secondary@model') + np.random.normal(size=rvtimes.shape) 10 rvsigmas = np.ones_like(rvtimes) * 20 b.set_value('latex_repr', component='binary', value='orb') b.set_value('latex_repr', component='primary', value='1') b.set_value('latex_repr', component='secondary', value='2')

b.add_dataset('lc', compute_phases=phoebe.linspace(0,1,201), times=lctimes, fluxes=fluxes, sigmas=fsigmas, dataset='lc01')

b.add_dataset('rv', compute_phases=phoebe.linspace(0,1,201), times=rvtimes, rvs={'primary': rvsA, 'secondary': rvsB}, sigmas=rvsigmas, dataset='rv01')

b.set_value_all('ld_mode', 'lookup')

afig, mplfig = b.plot(x='phases', show=True)`

This is the console log I got before I encountered the problem.

PS C:\Users\User\master_project> python .\sun.py Traceback (most recent call last): File "C:\Users\User\master_project\sun.py", line 2, in <module> import phoebe File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\phoebe\__init__.py", line 378, in <module> from .parameters import hierarchy, component, compute, constraint, dataset, feature, figure, solver, server File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\phoebe\parameters\__init__.py", line 2, in <module> from .parameters import * File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\phoebe\parameters\parameters.py", line 33, in <module> import readline File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\readline.py", line 34, in <module> rl = Readline() ^^^^^^^^^^ File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyreadline\rlmain.py", line 422, in __init__ BaseReadline.__init__(self) File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyreadline\rlmain.py", line 62, in __init__ mode.init_editing_mode(None) File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyreadline\modes\emacs.py", line 633, in init_editing_mode self._bind_key('space', self.self_insert) File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyreadline\modes\basemode.py", line 162, in _bind_key if not callable(func): ^^^^^^^^^^^^^^ File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyreadline\py3k_compat.py", line 8, in callable return isinstance(x, collections.Callable) ^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'collections' has no attribute 'Callable'

Do you know how to solve this problem?

kecnry commented 6 months ago

Can you try upgrading readline and then rerunning? pip install -U readline

hwillems2 commented 6 months ago

Hi,

this solved my problem, thank you very much.

Henry

On Mon, 11 Mar 2024, 14:01 Kyle Conroy, @.***> wrote:

Can you try upgrading readline and then rerunning? pip install -U readline

— Reply to this email directly, view it on GitHub https://github.com/phoebe-project/phoebe2/issues/831#issuecomment-1988389489, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYOYUBBGNKAK6XFFLZDNSP3YXW2MFAVCNFSM6AAAAABEQGILMGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBYGM4DSNBYHE . You are receiving this because you authored the thread.Message ID: @.***>