EasonXiao-888 / GrootVL

The official implementation of GrootVL: Tree Topology is All You Need in State Space Model
58 stars 2 forks source link

无法导入 from tree_scan import _C #2

Closed catLyg closed 3 months ago

catLyg commented 3 months ago

感谢你们出色的工作,我想在此基础上进行下一步的工作。我按照提供的安装步骤安装后,无法导入_C,"from tree_scan import _C " 。能否为我提供一些帮助。

EasonXiao-888 commented 3 months ago

@catLyg 感谢您的关注!在使用tree_scan之前需要您在当前环境下先安装这个package,运行代码如下cd GrootV/third-party/TreeScan pip install -v -e . 若仍有报错,您可以提供bug截图

catLyg commented 3 months ago

@catLyg 记得关注!通过使用tree_scan,您需要在当前环境下安装这个包,运行代码时cd GrootV/third-party/TreeScan pip install -v -e .如果发现错误,您可以发现bug

感谢您的回复,下面是pip install -v -e .的安装日志,根据日志,应该是安装成功了吧,我感到很困惑。 —————————————————————————————————————— Running command python setup.py egg_info running egg_info creating /tmp/pip-pip-egg-info-ms906d7m/tree_scan.egg-info writing manifest file '/tmp/pip-pip-egg-info-ms906d7m/tree_scan.egg-info/SOURCES.txt' writing manifest file '/tmp/pip-pip-egg-info-ms906d7m/tree_scan.egg-info/SOURCES.txt' Preparing metadata (setup.py) ... done Installing collected packages: tree-scan Attempting uninstall: tree-scan Found existing installation: tree-scan 1.0 Uninstalling tree-scan-1.0: Removing file or directory /home/lyg/anaconda3/envs/grootv/lib/python3.9/site-packages/tree_scan-1.0.dist-info/ Removing file or directory /home/lyg/anaconda3/envs/grootv/lib/python3.9/site-packages/tree_scan/ Successfully uninstalled tree-scan-1.0 Running setup.py develop for tree-scan Running command python setup.py develop running develop /home/lyg/anaconda3/envs/grootv/lib/python3.9/site-packages/setuptools/command/easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( /home/lyg/anaconda3/envs/grootv/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running egg_info writing manifest file 'tree_scan.egg-info/SOURCES.txt' running build_ext Emitting ninja build file /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/build.ninja... Compiling objects... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) ninja: no work to do. g++ -pthread -B /home/lyg/anaconda3/envs/grootv/compiler_compat -shared -Wl,--allow-shlib-undefined -Wl,-rpath,/home/lyg/anaconda3/envs/grootv/lib -Wl,-rpath-link,/home/lyg/anaconda3/envs/grootv/lib -L/home/lyg/anaconda3/envs/grootv/lib -Wl,--allow-shlib-undefined -Wl,-rpath,/home/lyg/anaconda3/envs/grootv/lib -Wl,-rpath-link,/home/lyg/anaconda3/envs/grootv/lib -L/home/lyg/anaconda3/envs/grootv/lib /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/bfs.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/boruvka.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/boruvka_rst.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/mst.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/refine.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/rst.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/vision.o -L/home/lyg/anaconda3/envs/grootv/lib/python3.9/site-packages/torch/lib -L/usr/local/cuda-11.7/lib64 -lc10 -ltorch -ltorch_cpu -ltorch_python -lcudart -lc10_cuda -ltorch_cuda_cu -ltorch_cuda_cpp -o build/lib.linux-x86_64-3.9/tree_scan/_C.cpython-39-x86_64-linux-gnu.so Successfully installed tree-scan-1.0

EasonXiao-888 commented 3 months ago

@catLyg 记得关注!通过使用tree_scan,您需要在当前环境下安装这个包,运行代码时cd GrootV/third-party/TreeScan pip install -v -e .如果发现错误,您可以发现bug

感谢您的回复,下面是pip install -v -e .的安装日志,根据日志,应该是安装成功了吧,我感到很困惑。 —————————————————————————————————————— Running command python setup.py egg_info running egg_info creating /tmp/pip-pip-egg-info-ms906d7m/tree_scan.egg-info writing manifest file '/tmp/pip-pip-egg-info-ms906d7m/tree_scan.egg-info/SOURCES.txt' writing manifest file '/tmp/pip-pip-egg-info-ms906d7m/tree_scan.egg-info/SOURCES.txt' Preparing metadata (setup.py) ... done Installing collected packages: tree-scan Attempting uninstall: tree-scan Found existing installation: tree-scan 1.0 Uninstalling tree-scan-1.0: Removing file or directory /home/lyg/anaconda3/envs/grootv/lib/python3.9/site-packages/tree_scan-1.0.dist-info/ Removing file or directory /home/lyg/anaconda3/envs/grootv/lib/python3.9/site-packages/tree_scan/ Successfully uninstalled tree-scan-1.0 Running setup.py develop for tree-scan Running command python setup.py develop running develop /home/lyg/anaconda3/envs/grootv/lib/python3.9/site-packages/setuptools/command/easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( /home/lyg/anaconda3/envs/grootv/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running egg_info writing manifest file 'tree_scan.egg-info/SOURCES.txt' running build_ext Emitting ninja build file /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/build.ninja... Compiling objects... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) ninja: no work to do. g++ -pthread -B /home/lyg/anaconda3/envs/grootv/compiler_compat -shared -Wl,--allow-shlib-undefined -Wl,-rpath,/home/lyg/anaconda3/envs/grootv/lib -Wl,-rpath-link,/home/lyg/anaconda3/envs/grootv/lib -L/home/lyg/anaconda3/envs/grootv/lib -Wl,--allow-shlib-undefined -Wl,-rpath,/home/lyg/anaconda3/envs/grootv/lib -Wl,-rpath-link,/home/lyg/anaconda3/envs/grootv/lib -L/home/lyg/anaconda3/envs/grootv/lib /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/bfs.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/boruvka.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/boruvka_rst.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/mst.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/refine.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/rst.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/vision.o -L/home/lyg/anaconda3/envs/grootv/lib/python3.9/site-packages/torch/lib -L/usr/local/cuda-11.7/lib64 -lc10 -ltorch -ltorch_cpu -ltorch_python -lcudart -lc10_cuda -ltorch_cuda_cu -ltorch_cuda_cpp -o build/lib.linux-x86_64-3.9/tree_scan/_C.cpython-39-x86_64-linux-gnu.so Successfully installed tree-scan-1.0

是的日志看起来是安装成功了 安转完后您可以重启一下ide或者重新连一下服务器,有可能package没有更新

zllxot commented 3 months ago

@EasonXiao-888 您好,我也遇到了同样的问题,并且我也已经运行了cd GrootV/third-party/TreeScan pip install -v -e .,但运行时仍然会报错: image

错误出现在tree_scanning.py的第13行:from tree_scan import _C image

而且我还发现当我手动输入‘from’后面的't'时能够自动出现候选项tree_scan,但就是无法在运行时找到 image

请问您还有什么解决方法吗?

catLyg commented 3 months ago

@catLyg 记得关注!通过使用tree_scan,您需要在当前环境下安装这个包,运行代码时cd GrootV/third-party/TreeScan pip install -v -e .如果发现错误,您可以发现bug

感谢您的回复,下面是pip install -v -e .的安装日志,根据日志,应该是安装成功了吧,我感到很困惑。 —————————————————————————————————————— Running command python setup.py egg_info running egg_info creating /tmp/pip-pip-egg-info-ms906d7m/tree_scan.egg-info writing manifest file '/tmp/pip-pip-egg-info-ms906d7m/tree_scan.egg-info/SOURCES.txt' writing manifest file '/tmp/pip-pip-egg-info-ms906d7m/tree_scan.egg-info/SOURCES.txt' Preparing metadata (setup.py) ... done Installing collected packages: tree-scan Attempting uninstall: tree-scan Found existing installation: tree-scan 1.0 Uninstalling tree-scan-1.0: Removing file or directory /home/lyg/anaconda3/envs/grootv/lib/python3.9/site-packages/tree_scan-1.0.dist-info/ Removing file or directory /home/lyg/anaconda3/envs/grootv/lib/python3.9/site-packages/tree_scan/ Successfully uninstalled tree-scan-1.0 Running setup.py develop for tree-scan Running command python setup.py develop running develop /home/lyg/anaconda3/envs/grootv/lib/python3.9/site-packages/setuptools/command/easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( /home/lyg/anaconda3/envs/grootv/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running egg_info writing manifest file 'tree_scan.egg-info/SOURCES.txt' running build_ext Emitting ninja build file /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/build.ninja... Compiling objects... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) ninja: no work to do. g++ -pthread -B /home/lyg/anaconda3/envs/grootv/compiler_compat -shared -Wl,--allow-shlib-undefined -Wl,-rpath,/home/lyg/anaconda3/envs/grootv/lib -Wl,-rpath-link,/home/lyg/anaconda3/envs/grootv/lib -L/home/lyg/anaconda3/envs/grootv/lib -Wl,--allow-shlib-undefined -Wl,-rpath,/home/lyg/anaconda3/envs/grootv/lib -Wl,-rpath-link,/home/lyg/anaconda3/envs/grootv/lib -L/home/lyg/anaconda3/envs/grootv/lib /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/bfs.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/boruvka.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/boruvka_rst.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/mst.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/refine.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/rst.o /home/lyg/GrootVL-main/GrootV/third-party/TreeScan/build/temp.linux-x86_64-3.9/home/lyg/GrootVL-main/GrootV/third-party/TreeScan/tree_scan/csrc/vision.o -L/home/lyg/anaconda3/envs/grootv/lib/python3.9/site-packages/torch/lib -L/usr/local/cuda-11.7/lib64 -lc10 -ltorch -ltorch_cpu -ltorch_python -lcudart -lc10_cuda -ltorch_cuda_cu -ltorch_cuda_cpp -o build/lib.linux-x86_64-3.9/tree_scan/_C.cpython-39-x86_64-linux-gnu.so Successfully installed tree-scan-1.0

是的日志看起来是安装成功了 安转完后您可以重启一下ide或者重新连一下服务器,有可能package没有更新

感谢您的回复,我刚才还在尝试解决这个问题,但是依然显示的是无法导入,但是我创建模型,运行模型,显示一切正常。在_C调用函数的地方DEBUG,tensor 经过 _C.bfs_forward(edge_index, max_adj_per_vertex)后,值也改变了,应该是运行成功了。

EasonXiao-888 commented 3 months ago

@zllxot 可以reactivate编译环境再试试,我本地试了下需要update ide才能生效pip install

zllxot commented 3 months ago

@zllxot 可以reactivate编译环境再试试,我本地试了下需要update ide才能生效pip install

感谢回复。但我没太明白您的意思,reactivate编译环境是指再重新运行cd GrootV/third-party/TreeScan pip install -v -e .命令吗?如何update ide呢?

EasonXiao-888 commented 3 months ago

@zllxot 可以reactivate编译环境再试试,我本地试了下需要update ide才能生效pip install

感谢回复。但我没太明白您的意思,reactivate编译环境是指再重新运行cd GrootV/third-party/TreeScan pip install -v -e .命令吗?如何update ide呢?

比如假如你用的是conda虚拟环境的话可以尝试先deactivate在进入,或者假如您用的是远程服务器的话,可以重新ssh remote,我自己尝试的时候就出现过第二种情况,当然前提是成功地pip install -e -v .,可以通过pip list检查是否安装好了这个package