Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when importing the bayesflow #104

Closed
Shuwan-Wang opened this issue Sep 28, 2023 · 6 comments
Closed

error when importing the bayesflow #104

Shuwan-Wang opened this issue Sep 28, 2023 · 6 comments

Comments

@Shuwan-Wang
Copy link

Hi Stefan et al.,

I am so impressed by the bayesflow work. However, when I try to implement it myself, I got an error when importing the bayesflow.

I have tried with Pycharm/Anaconda, they gave me the same error message:

ValueError: Arg specs do not match: original=FullArgSpec(args=['input', 'dtype', 'name', 'layout'], varargs=None, varkw=None, defaults=(None, None, None), kwonlyargs=[], kwonlydefaults=None, annotations={}), new=FullArgSpec(args=['input', 'dtype', 'name'], varargs=None, varkw=None, defaults=(None, None), kwonlyargs=[], kwonlydefaults=None, annotations={}), fn=<function ones_like_v2 at 0x000002D9E1F41A80>

Do you know what happened and how to solve this?

Thank you so much!
Best regards,
Shuwan

@stefanradev93
Copy link
Contributor

Hi Shuwan, I have never seen such an error before. What system are you using (e.g., Python version, TensorFlow version, etc) and did you install bayesflow via pip?
--Stefan

@Shuwan-Wang
Copy link
Author

Hi,

I am using the latest Python (3.11.5) and I never installed TensorFlow before installing Bayesflow. Yes, I installed the bayesflow via pip in the terminal.

Thanks!
Shuwan

@stefanradev93
Copy link
Contributor

It should have automatically been installed as part of the dependencies. Can you try with Python 3.10 following these instructions:

https://github.com/stefanradev93/BayesFlow/blob/master/INSTALL.rst

?

Also, do you have Windows or Linux/Mac?

@Shuwan-Wang
Copy link
Author

Yes, I can reinstall Python 3.10, and I have Windows.

@stefanradev93
Copy link
Contributor

Let me know how this goes.

@Shuwan-Wang
Copy link
Author

Hi,

I installed bayesflow via pip in Python 3.10.1, and it really seems downloaded all the packages and dependencies.

However, when I import bayesflow at the editor, it generates the following error:

C:\Users\swtyb\PycharmProjects\pythonProject4\venv\Scripts\python.exe C:\Users\swtyb\PycharmProjects\pythonProject\draft\example.py
Traceback (most recent call last):
File "C:\Users\swtyb\PycharmProjects\pythonProject\draft\example.py", line 2, in
import bayesflow as bf
File "C:\Users\swtyb\PycharmProjects\pythonProject4\venv\lib\site-packages\bayesflow_init_.py", line 25, in
from bayesflow import amortizers, default_settings, diagnostics, losses, networks, trainers, sensitivity
File "C:\Users\swtyb\PycharmProjects\pythonProject4\venv\lib\site-packages\bayesflow\amortizers.py", line 30, in
import tensorflow_probability as tfp
File "C:\Users\swtyb\PycharmProjects\pythonProject4\venv\lib\site-packages\tensorflow_probability_init_.py", line 20, in
from tensorflow_probability import substrates
File "C:\Users\swtyb\PycharmProjects\pythonProject4\venv\lib\site-packages\tensorflow_probability\substrates_init_.py", line 17, in
from tensorflow_probability.python.internal import all_util
File "C:\Users\swtyb\PycharmProjects\pythonProject4\venv\lib\site-packages\tensorflow_probability\python_init_.py", line 138, in
dir(globals()[pkg_name]) # Forces loading the package from its lazy loader.
File "C:\Users\swtyb\PycharmProjects\pythonProject4\venv\lib\site-packages\tensorflow_probability\python\internal\lazy_loader.py", line 57, in dir
module = self.load()
File "C:\Users\swtyb\PycharmProjects\pythonProject4\venv\lib\site-packages\tensorflow_probability\python\internal\lazy_loader.py", line 40, in load
module = importlib.import_module(self.name)
File "C:\Users\swtyb\AppData\Local\Programs\Python\Python310\lib\importlib_init
.py", line 126, in import_module
return bootstrap.gcd_import(name[level:], package, level)
File "C:\Users\swtyb\PycharmProjects\pythonProject4\venv\lib\site-packages\tensorflow_probability\python\experimental_init
.py", line 31, in
from tensorflow_probability.python.experimental import bayesopt
File "C:\Users\swtyb\PycharmProjects\pythonProject4\venv\lib\site-packages\tensorflow_probability\python\experimental\bayesopt_init
.py", line 17, in
from tensorflow_probability.python.experimental.bayesopt import acquisition
File "C:\Users\swtyb\PycharmProjects\pythonProject4\venv\lib\site-packages\tensorflow_probability\python\experimental\bayesopt\acquisition_init.py", line 17, in
from tensorflow_probability.python.experimental.bayesopt.acquisition.acquisition_function import AcquisitionFunction
File "C:\Users\swtyb\PycharmProjects\pythonProject4\venv\lib\site-packages\tensorflow_probability\python\experimental\bayesopt\acquisition\acquisition_function.py", line 22, in
from tensorflow_probability.python.internal import prefer_static as ps
File "C:\Users\swtyb\PycharmProjects\pythonProject4\venv\lib\site-packages\tensorflow_probability\python\internal\prefer_static.py", line 361, in
ones_like = _copy_docstring(tf.ones_like, _ones_like)
File "C:\Users\swtyb\PycharmProjects\pythonProject4\venv\lib\site-packages\tensorflow_probability\python\internal\prefer_static.py", line 84, in _copy_docstring
raise ValueError(
ValueError: Arg specs do not match: original=FullArgSpec(args=['input', 'dtype', 'name', 'layout'], varargs=None, varkw=None, defaults=(None, None, None), kwonlyargs=[], kwonlydefaults=None, annotations={}), new=FullArgSpec(args=['input', 'dtype', 'name'], varargs=None, varkw=None, defaults=(None, None), kwonlyargs=[], kwonlydefaults=None, annotations={}), fn=<function ones_like_v2 at 0x000002571FA51CF0>

Process finished with exit code 1

I really don't know what happened here, could you take a look?

Thank you so much!
Best,
Shuwan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants