Open ChifengWoo opened 2 years ago
I get this error when executing the server code on my local PyCharm, and I haven't solved it yet.
This is a general error of conda environments, not related to torchdrug.
According to my experience, sometimes conda fail to setup the PATH variable correctly when you activate an environment from an existing environment. My suggestion is to first deactivate your existing environment to base, and then activate the new environment.
I can run the tutorial code perfectly in jupyter notebook, however when I changed it to plain .py and run in Pycharm. It also got this error:
Traceback (most recent call last):
File "/homeb/tangwuguo/projects/CBC2023_ProteinSuperfamilies/code/test_tutorial.py", line 32, in <module>
print("Shape of function labels for a protein: ", dataset[0]["targets"].shape)
File "/homeb/tangwuguo/miniconda3/envs/cbc23/lib/python3.8/site-packages/torchdrug/data/dataset.py", line 189, in __getitem__
return self.get_item(index)
File "/homeb/tangwuguo/miniconda3/envs/cbc23/lib/python3.8/site-packages/torchdrug/datasets/enzyme_commission.py", line 134, in get_item
item["targets"] = utils.sparse_coo_tensor(indices, values, (len(self.tasks),)).to_dense()
File "/homeb/tangwuguo/miniconda3/envs/cbc23/lib/python3.8/site-packages/torchdrug/utils/torch.py", line 182, in sparse_coo_tensor
return torch_ext.sparse_coo_tensor_unsafe(indices, values, size)
File "/homeb/tangwuguo/miniconda3/envs/cbc23/lib/python3.8/site-packages/torchdrug/utils/torch.py", line 27, in __getattr__
return getattr(self.module, key)
File "/homeb/tangwuguo/miniconda3/envs/cbc23/lib/python3.8/site-packages/torchdrug/utils/decorator.py", line 102, in __get__
result = self.func(obj)
File "/homeb/tangwuguo/miniconda3/envs/cbc23/lib/python3.8/site-packages/torchdrug/utils/torch.py", line 31, in module
return cpp_extension.load(self.name, self.sources, self.extra_cflags, self.extra_cuda_cflags,
File "/homeb/tangwuguo/miniconda3/envs/cbc23/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1079, in load
return _jit_compile(
File "/homeb/tangwuguo/miniconda3/envs/cbc23/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1292, in _jit_compile
_write_ninja_file_and_build_library(
File "/homeb/tangwuguo/miniconda3/envs/cbc23/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1373, in _write_ninja_file_and_build_library
verify_ninja_availability()
File "/homeb/tangwuguo/miniconda3/envs/cbc/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1429, in verify_ninja_availability
raise RuntimeError("Ninja is required to load C++ extensions")
RuntimeError: Ninja is required to load C++ extensions
I tried to use the shell to run the .py file, It runs well. Too weird.
When I try to switch other people's conda environments, I have got the following error trace:
I must execute
export PATH=/gxr/user/anaconda3/envs/py38/bin:$PATH
to run successfully.