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

ModuleNotFoundError: No module named 'jax.numpy'; 'jax' is not a package #35

Open
Pythonpa opened this issue Jul 14, 2024 · 16 comments
Open

Comments

@Pythonpa
Copy link

Pythonpa commented Jul 14, 2024

When started the latest version,it shows this error message,and my jax of ComfyUI venv is 0.4.30. I have reinstall jax & jaxlib,but still have the same error................

Traceback (most recent call last):
File "C:\ComfyUI\nodes.py", line 1931, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 883, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\ComfyUI\custom_nodes\comfyui_LLM_party_init
.py", line 8, in
from .llm import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
File "C:\ComfyUI\custom_nodes\comfyui_LLM_party\llm.py", line 1873, in
load_custom_tools()
File "C:\ComfyUI\custom_nodes\comfyui_LLM_party\llm.py", line 1851, in load_custom_tools
spec.loader.exec_module(module)
File "C:\ComfyUI\custom_nodes\comfyui_LLM_party\custom_tool\chatTTS_node.py", line 4, in
import ChatTTS
File "C:\ComfyUI\python\lib\site-packages\ChatTTS_init_.py", line 1, in
from .core import Chat
File "C:\ComfyUI\python\lib\site-packages\ChatTTS\core.py", line 18, in
from .model import DVAE, GPT, gen_logits
File "C:\ComfyUI\python\lib\site-packages\ChatTTS\model_init_.py", line 1, in
from .dvae import DVAE
File "C:\ComfyUI\python\lib\site-packages\ChatTTS\model\dvae.py", line 9, in
from vector_quantize_pytorch import GroupedResidualFSQ
File "C:\ComfyUI\python\lib\site-packages\vector_quantize_pytorch_init_.py", line 2, in
from vector_quantize_pytorch.residual_vq import ResidualVQ, GroupedResidualVQ
File "C:\ComfyUI\python\lib\site-packages\vector_quantize_pytorch\residual_vq.py", line 18, in
from einx import get_at
File "C:\ComfyUI\python\lib\site-packages\einx_init_.py", line 5, in
from . import backend
File "C:\ComfyUI\python\lib\site-packages\einx\backend_init_.py", line 1, in
from .register import register_for_module, register, get, backends, numpy
File "C:\ComfyUI\python\lib\site-packages\einx\backend\register.py", line 53, in
register_for_module("jax", _jax.create)
File "C:\ComfyUI\python\lib\site-packages\einx\backend\register.py", line 19, in register_for_module
register(backend_factory())
File "C:\ComfyUI\python\lib\site-packages\einx\backend_jax.py", line 11, in create
import jax.numpy as jnp
ModuleNotFoundError: No module named 'jax.numpy'; 'jax' is not a package

@heshengtao
Copy link
Owner

The current vector_quantize_pytorch no longer rely on jax, I think you can try to update the version of vector_quantize_pytorch, or directly update the version of chatTTS

@Pythonpa
Copy link
Author

Pythonpa commented Jul 14, 2024

The current vector_quantize_pytorch no longer rely on jax, I think you can try to update the version of vector_quantize_pytorch, or directly update the version of chatTTS

ok,the version of ChatTTS and vector-quantize-pytorch, both of them are the latest, ChatTTS==0.1.1 vector-quantize-pytorch=1.15.3.
By the way, my OS is Windows 10, torch=2.3.0,CUDA=12.1.
Could it be related to incompatible system versions?

@guobalove
Copy link
Collaborator

I noticed that the file paths in your einx folder are different from mine, so I checked the version of my einx library and found it's 0.3.0.

@Pythonpa
Copy link
Author

Pythonpa commented Jul 14, 2024

I noticed that the file paths in your einx folder are different from mine, so I checked the version of my einx library and found it's 0.3.0.

Weird,my einx also is 0.3.0

[SD-Launcher] C:\ComfyUI>C:\ComfyUI\python\python.exe -m pip show einx
Name: einx
Version: 0.3.0
Summary: Universal Tensor Operations in Einstein-Inspired Notation for Python
Home-page: https://github.com/fferflo/einx
Author: Florian Fervers
Author-email: florian.fervers@gmail.com
License: MIT
Location: c:\comfyui\python\lib\site-packages
Requires: frozendict, numpy, sympy
Required-by: vector-quantize-pytorch

@heshengtao
Copy link
Owner

My system is Win11, and everything else is the same as you. There is no jax library in my environment. But I can run normally.After I tried to install jax & jaxlib, it can also run, that is to say, whether there is jax & jaxlib or not will not affect the operation of chatTTS. If you don't need to use chatTTS, you can directly delete C:\ ComfyUI\ custom_nodes\ comfyui_LLM_party\ custom_tool\ chatTTS_node.py, this error will disappear.

@Pythonpa
Copy link
Author

My system is Win11, and everything else is the same as you. There is no jax library in my environment. But I can run normally.After I tried to install jax & jaxlib, it can also run, that is to say, whether there is jax & jaxlib or not will not affect the operation of chatTTS. If you don't need to use chatTTS, you can directly delete C:\ ComfyUI\ custom_nodes\ comfyui_LLM_party\ custom_tool\ chatTTS_node.py, this error will disappear.

ok, thanks,will have a try.

@Pythonpa
Copy link
Author

Pythonpa commented Jul 14, 2024

My system is Win11, and everything else is the same as you. There is no jax library in my environment. But I can run normally.After I tried to install jax & jaxlib, it can also run, that is to say, whether there is jax & jaxlib or not will not affect the operation of chatTTS. If you don't need to use chatTTS, you can directly delete C:\ ComfyUI\ custom_nodes\ comfyui_LLM_party\ custom_tool\ chatTTS_node.py, this error will disappear.

I found this issues about jax ,maybe is related to einx\tracer

@heshengtao
Copy link
Owner

It is very likely that another person has reported the same error, and his computer has a dependency that contains a file called jax.py, while mine does not.

@fferflo
Copy link

fferflo commented Jul 15, 2024

It looks like the traceback of the error is in a codepath that can only execute if "jax" in sys.modules. So likely there is a module with name "jax" that has already been imported, such as a file jax.py, but it is not the Jax library itself. You could check which file has been imported

>>> sys.modules["jax"]
<module 'jax' from '.../site-packages/jax/__init__.py'>

and whether importing Jax manually gives the same error:

import jax.numpy as jnp

@heshengtao
Copy link
Owner

In the latest version of my node, I import jax before importing chatTTS, which avoids einx importing jax. I hope this fixes your problem. If there is still an error, my node library will block the import of chatTTS without affecting the use of other nodes.

@Pythonpa
Copy link
Author

The PARTY node can now be started and used normally, but after observing the startup logs, it is actually running by blocking the import of chatTTS.
image

@heshengtao
Copy link
Owner

This bug has been unable to be reproduced due to multiple of our computers. If you don't need the chatTTS function for the time being, it may take us a long time to solve this problem. Thank you very much for your feedback. We will notify you immediately when we solve the problem.

@heshengtao
Copy link
Owner

jtydhr88/ComfyUI-Unique3D#8 (comment)
Referring to this answer, jax was disabled by the autumn leaf package. We can reproduce this bug on the autumn leaf package. If you need to use chatTTS, you can use the original comfyui to start, or use the iron pot to start.
参考这个回答,jax被秋叶包给禁用了,我们在秋叶包上可以复现这个BUG,如果你需要使用chatTTS,可以使用原版comfyui启动,或者使用铁锅炖启动。

@Pythonpa
Copy link
Author

jtydhr88/ComfyUI-Unique3D#8 (comment) Referring to this answer, jax was disabled by the autumn leaf package. We can reproduce this bug on the autumn leaf package. If you need to use chatTTS, you can use the original comfyui to start, or use the iron pot to start. 参考这个回答,jax被秋叶包给禁用了,我们在秋叶包上可以复现这个BUG,如果你需要使用chatTTS,可以使用原版comfyui启动,或者使用铁锅炖启动。

Okay, I will try using the Docker version of comfyui later to see if there will be any problems

@fferflo
Copy link

fferflo commented Jul 24, 2024

The problem should also be fixed with the latest source version of einx (see this commit), so you could try updating einx:

pip install --upgrade git+https://github.com/fferflo/einx.git

@BertWang
Copy link

果然.秋叶包的問題。國內大都還是分二大主流.秋叶包/铁锅炖啓動。看來要美好體驗..只能走向.. 铁锅炖启动。在掛回秋叶包

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

5 participants