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

I'm not sure how to fix the following error: Unsupported backend: numpy. Any explanation is highly appreciated! #1944

Open
CharukaWick opened this issue Feb 5, 2025 · 2 comments

Comments

@CharukaWick
Copy link


NotImplementedError Traceback (most recent call last)
Cell In[2], line 1
----> 1 import deepxde as dde

File ~/Applications/anaconda3/lib/python3.12/site-packages/deepxde/init.py:21
18 version = "unknown version"
20 # Should import backend before importing anything else
---> 21 from . import backend
23 from . import callbacks
24 from . import data

File ~/Applications/anaconda3/lib/python3.12/site-packages/deepxde/backend/init.py:130
126 set_default_backend("paddle")
127 return "paddle"
--> 130 load_backend(get_preferred_backend())

File ~/Applications/anaconda3/lib/python3.12/site-packages/deepxde/backend/init.py:110, in get_preferred_backend()
108 backend_name = config_dict.get("backend", "").lower()
109 if backend_name is not None:
--> 110 verify_backend(backend_name)
111 return backend_name
112 # No backend selected

File ~/Applications/anaconda3/lib/python3.12/site-packages/deepxde/backend/utils.py:73, in verify_backend(backend_name)
65 import_funcs = {
66 "tensorflow.compat.v1": import_tensorflow_compat_v1,
67 "tensorflow": import_tensorflow,
(...)
70 "paddle": import_paddle,
71 }
72 if backend_name not in import_funcs:
---> 73 raise NotImplementedError(
74 f"Unsupported backend: {backend_name}.\n"
75 "Please select backend from tensorflow.compat.v1, tensorflow, pytorch, jax or paddle."
76 )
77 if not import_funcsbackend_name:
78 raise RuntimeError(
79 f"Backend is set as {backend_name}, but '{backend_name}' failed to import."
80 )

NotImplementedError: Unsupported backend: numpy.
Please select backend from tensorflow.compat.v1, tensorflow, pytorch, jax or paddle.

@CharukaWick CharukaWick changed the title I'm not sure how to fix the following error: Unsupported backend: numpy. I'm not sure how to fix the following error: Unsupported backend: numpy. Any explanation is highly appreciated! Feb 5, 2025
@vl-dud
Copy link
Contributor

vl-dud commented Feb 6, 2025

Did you set the backend explicitly? Like:

import os
os.environ["DDEBACKEND"] = "tensorflow.compat.v1"

@CharukaWick
Copy link
Author

CharukaWick commented Feb 6, 2025 via email

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