Skip to content

(Google Colab Installation) ImportError: cannot import name 'data' from 'torchdrug' (unknown location) #5

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

Closed
njustcodingjs opened this issue Aug 13, 2021 · 2 comments
Labels
installation Problems in installation

Comments

@njustcodingjs
Copy link

njustcodingjs commented Aug 13, 2021

Dear sir:
I am trying to use torchdrug on Google Colab. Here is my code.

 !pip install rdkit-pypi
 !git clone https://github.com/DeepGraphLearning/torchdrug
 !pip install -r /content/torchdrug/requirements.txt
 !python /content/torchdrug/setup.py install

All seems to be well.
But when I run

import torchdrug as td
from torchdrug import data

edge_list = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 0]]
graph = data.Graph(edge_list, num_node=6)
graph.visualize()

Then shows:

ImportError                               Traceback (most recent call last)
<ipython-input-10-bbad14b8be21> in <module>()
      1 import torch
      2 import torchdrug as td
----> 3 from torchdrug import data, datasets, core, models, tasks
      4 get_ipython().magic('matplotlib inline')
      5 

ImportError: cannot import name 'data' from 'torchdrug' (unknown location)

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

How can solve this probelm?

@shichence
Copy link
Contributor

shichence commented Aug 13, 2021

!pip install decorator numpy matplotlib tqdm networkx ninja jinja2 rdkit-pypi
!pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.9.0+cu102.html

Note that the default Pytorch version on Colab is torch1.9.0+cu102.

!git clone https://github.com/DeepGraphLearning/torchdrug
%cd torchdrug
!python setup.py install
  • I wrote a colab tutorial here

Feel free to reach out if it doesn't work.

@shichence shichence added the installation Problems in installation label Aug 13, 2021
@shichence shichence changed the title ImportError: cannot import name 'data' from 'torchdrug' (unknown location) (Google Colab Installation) ImportError: cannot import name 'data' from 'torchdrug' (unknown location) Aug 15, 2021
@KiddoZhu KiddoZhu closed this as completed Sep 9, 2021
@alyhalo
Copy link

alyhalo commented Apr 29, 2023

@shichence

  • I wrote a colab tutorial here

Feel free to reach out if it doesn't work.

There is no access to this tutorial :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
installation Problems in installation
Projects
None yet
Development

No branches or pull requests

4 participants