-
Notifications
You must be signed in to change notification settings - Fork 150
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
cannot import name 'collate_center' from 'utils' (/usr/local/lib/python3.7/dist-packages/utils/__init__.py) #183
Comments
This should import from this file rather than a package called |
Hello, thank you for replying, I run it on colab for the moment with the ipynb file, so my directory is the default (/content/) but even if I run it on visual studio it gives me the same error. Could you help please? |
What's your working directory? Have you tried changing working directory to |
Hello again,
I have changed the directory into this,
/content/gdriveexamples/reaction_prediction/rexgen_direct
With this command
if IN_COLAB:
# Mount the Google Drive at mount
mount='/content/gdrive'
print("Colab: mounting Google drive on ", mount)
drive.mount(mount)
# Switch to the directory on the Google Drive that you want to use
import os
drive_root = mount + "examples/reaction_prediction/rexgen_direct"
# Create drive_root if it doesn't exist
create_drive_root = True
if create_drive_root:
print("\nColab: making sure ", drive_root, " exists.")
os.makedirs(drive_root, exist_ok=True)
# Change to the directory
print("\nColab: Changing directory to ", drive_root)
%cd $drive_root
But still I get this error
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-12-79dc60fc4e75><https://zaplf02vclh-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20220624-060043-RC00_456943075> in <module>()
----> 1 from utils import collate_center, reaction_center_prediction, output_candidate_bonds_for_a_reaction
2
3 max_k = 80 # Maximum number of candidate bond changes to select
4
5 full_data = [center_dataset[i] for i in range(len(center_dataset))]
ImportError: cannot import name 'collate_center' from 'utils' (/usr/local/lib/python3.7/dist-packages/utils/__init__.py)
Can you help me please?
From: Mufei Li ***@***.***>
Date: Wednesday, 29 June 2022 at 10:47
To: awslabs/dgl-lifesci ***@***.***>
Cc: Marinapres ***@***.***>, Author ***@***.***>
Subject: Re: [awslabs/dgl-lifesci] cannot import name 'collate_center' from 'utils' (/usr/local/lib/python3.7/dist-packages/utils/__init__.py) (Issue #183)
What's your working directory? Have you tried changing working directory to examples/reaction_prediction/rexgen_direct?
—
Reply to this email directly, view it on GitHub<#183 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AZLT7ILK5EM6U3J7BONSHWTVRQEQRANCNFSM52B5M4SQ>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
I'm not familiar with Colab. What's the result of running the code snippet below?
If the directory is correct, then you will want to research about forcing relative import over absolute import in python. |
Hello, thank you for replying,
I run it on colab for the moment with the ipynb file, so my directory is the default (/content/) but even if I run it on visual studio it gives me the same error. Could you help please?
From: Mufei Li ***@***.***>
Date: Wednesday, 29 June 2022 at 05:54
To: awslabs/dgl-lifesci ***@***.***>
Cc: Marinapres ***@***.***>, Author ***@***.***>
Subject: Re: [awslabs/dgl-lifesci] cannot import name 'collate_center' from 'utils' (/usr/local/lib/python3.7/dist-packages/utils/__init__.py) (Issue #183)
This should import from this file<https://github.com/awslabs/dgl-lifesci/blob/master/examples/reaction_prediction/rexgen_direct/utils.py> rather than a package called utils. What's your current working directory?
—
Reply to this email directly, view it on GitHub<#183 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AZLT7IM6452GLYZNT3YY35DVRPCGTANCNFSM52B5M4SQ>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Could you provide detailed instructions for me to try reproducing the issue on visual studio?
Also I'm not sure if this is due to something wrong with your python path like pointing to a package called |
can someone help me? I get this error on Colab
_ImportError Traceback (most recent call last)
in ()
----> 1 from utils import collate_center, reaction_center_prediction, output_candidate_bonds_for_a_reaction
ImportError: cannot import name 'collate_center' from 'utils' (/usr/local/lib/python3.7/dist-packages/utils/init.py)_
The text was updated successfully, but these errors were encountered: