Skip to content

having problems when running the demo - about 'torch-sparse' #8

@CarbonBlaack

Description

@CarbonBlaack
  • Try my best to search on the internet.
  • Browse all the issues in this project

I try to run the demo and follow the instruction here(based on Installation 1-4 steps).

conda create -n stellar python=3.8
source activate stellar
conda install pytorch cudatoolkit=11.3 -c pytorch
conda install pyg -c pyg
pip install -r requirements.txt

I also add matplotlib==3.6 to the requirements.txt according to another issue. in this project.

Setup specs:(Ubuntu 20.04)

python                    3.8.17               h955ad1f_0
pytorch                   1.12.1          cpu_py38h9dbd814_1
pyg                       2.3.1           py38_torch_1.12.0_cu113    pyg

But when I run the demo, there is an error: "ImportError: 'SparseTensor' requires 'torch-sparse'"
The specific messages are here:

ImportError                               Traceback (most recent call last)
Cell In[7], line 2
      1 stellar = STELLAR(args, dataset)
----> 2 stellar.train()
      3 _, results = stellar.pred()

File [~/Projects/2023_08/stellar/STELLAR.py:176](https://vscode-remote+ssh-002dremote-002b166-002e111-002e130-002e162.vscode-resource.vscode-cdn.net/home/wangzian/Projects/2023_08/stellar/~/Projects/2023_08/stellar/STELLAR.py:176), in STELLAR.train(self)
    174 seed_optimizer = optim.Adam(seed_model.parameters(), lr=1e-3, weight_decay=5e-2)
    175 for epoch in range(20):
--> 176     self.train_supervised(self.args, seed_model, self.args.device, self.dataset, seed_optimizer, epoch)
    177 novel_label_seeds = self.est_seeds(self.args, seed_model, self.args.device, self.dataset, clusters, self.args.num_seed_class)
    178 self.dataset.unlabeled_data.novel_label_seeds = torch.tensor(novel_label_seeds)

File [~/Projects/2023_08/stellar/STELLAR.py:29](https://vscode-remote+ssh-002dremote-002b166-002e111-002e130-002e162.vscode-resource.vscode-cdn.net/home/wangzian/Projects/2023_08/stellar/~/Projects/2023_08/stellar/STELLAR.py:29), in STELLAR.train_supervised(self, args, model, device, dataset, optimizer, epoch)
     26 sum_loss = 0
     28 labeled_graph = dataset.labeled_data
---> 29 labeled_data = ClusterData(labeled_graph, num_parts=100, recursive=False)
     30 labeled_loader = ClusterLoader(labeled_data, batch_size=1, shuffle=True,
     31                             num_workers=1)
     33 for batch_idx, labeled_x in enumerate(labeled_loader):

File [~/anaconda3/envs/stellar/lib/python3.8/site-packages/torch_geometric/deprecation.py:23](https://vscode-remote+ssh-002dremote-002b166-002e111-002e130-002e162.vscode-resource.vscode-cdn.net/home/wangzian/Projects/2023_08/stellar/~/anaconda3/envs/stellar/lib/python3.8/site-packages/torch_geometric/deprecation.py:23), in deprecated..decorator..wrapper(*args, **kwargs)
     21     out += f", {details}"
     22 warnings.warn(out)
...
File [~/anaconda3/envs/stellar/lib/python3.8/site-packages/torch_geometric/typing.py:49](https://vscode-remote+ssh-002dremote-002b166-002e111-002e130-002e162.vscode-resource.vscode-cdn.net/home/wangzian/Projects/2023_08/stellar/~/anaconda3/envs/stellar/lib/python3.8/site-packages/torch_geometric/typing.py:49), in SparseTensor.__init__(self, *args, **kwargs)
     48 def __init__(self, *args, **kwargs):
---> 49     raise ImportError("'SparseTensor' requires 'torch-sparse'")

ImportError: 'SparseTensor' requires 'torch-sparse'

After that, I have already tried the following:

pip install torch_geometric

and

pip install torch_sparse

but it still doesn't work.

torch-sparse              0.6.17                   pypi_0    pypi

Would anyone be able to help me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions