Fehler beim Ausführen von zfit unter Ubuntu 22.04 mit Python 3.10.12 und TensorFlow 2.18.0
Posted: 25 Dec 2024, 23:06
Ich versuche, zfit auf meinem Ubuntu 22.04-Laptop auszuführen. Ich habe es so installiert:
Ich habe diesen Code ausgeführt (von https://github.com/zfit/zfit):
und ich habe diesen Fehler:
Ich habe das Gleiche mit Python 3.11 auf demselben System erlebt.
Code: Select all
python -m venv venv
source venv/bin/activate
pip install zfit
Code: Select all
import zfit
import numpy as np
obs = zfit.Space('x', -10, 10)
# create the model
mu = zfit.Parameter("mu" , 2.4, -1, 5)
sigma = zfit.Parameter("sigma", 1.3, 0, 5)
gauss = zfit.pdf.Gauss(obs=obs, mu=mu, sigma=sigma)
# load the data
data_np = np.random.normal(size=10000)
data = zfit.Data(obs=obs, data=data_np)
# or sample from model
data = gauss.sample()
Code: Select all
Traceback (most recent call last):
File "/home/pleskot/ftft/test.py", line 15, in
data = gauss.sample()
File "/home/pleskot/ftft/venv/lib/python3.10/site-packages/zfit/core/basemodel.py", line 1196, in sample
tensor = run_tf(n=n, limits=limits, x=xclean)
File "/home/pleskot/ftft/venv/lib/python3.10/site-packages/zfit/core/basemodel.py", line 1192, in run_tf
return self._single_hook_sample(n=n, limits=limits, x=x) # todo: make data a composite object
File "/home/pleskot/ftft/venv/lib/python3.10/site-packages/zfit/z/zextension.py", line 332, in concrete_func
result = func_to_run(*args, **kwargs)
File "/home/pleskot/ftft/venv/lib/python3.10/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/home/pleskot/ftft/venv/lib/python3.10/site-packages/zfit/core/basemodel.py", line 1202, in _single_hook_sample
return self._hook_sample(n=n, limits=limits)
File "/home/pleskot/ftft/venv/lib/python3.10/site-packages/zfit/core/basepdf.py", line 785, in _hook_sample
raise tf.errors.InvalidArgumentError(msg)
TypeError: InvalidArgumentError.__init__() missing 2 required positional arguments: 'op' and 'message'