Open meniapi opened 2 years ago
This should import from this file rather than a package called utils
. What's your current working directory?
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 examples/reaction_prediction/rexgen_direct
?
Hello again,
I have changed the directory into this,
/content/gdriveexamples/reaction_prediction/rexgen_direct
With this command
if IN_COLAB:
mount='/content/gdrive' print("Colab: mounting Google drive on ", mount)
drive.mount(mount)
import os drive_root = mount + "examples/reaction_prediction/rexgen_direct"
create_drive_root = True if create_drive_root: print("\nColab: making sure ", drive_root, " exists.") os.makedirs(drive_root, exist_ok=True)
print("\nColab: Changing directory to ", drive_root) %cd $drive_root
ImportError Traceback (most recent call last)
Hello again,
I have changed the directory into this,
/content/gdriveexamples/reaction_prediction/rexgen_direct
With this command
_if IN_COLAB:
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 = True if create_drive_root: print("\nColab: making sure ", drive_root, " exists.") os.makedirs(drive_root, exist_ok=True)
print("\nColab: Changing directory to ", drive_root) %cd $driveroot
ImportError Traceback (most recent call last)
ImportError: cannot import name 'collate_center' from 'utils' (/usr/local/lib/python3.7/dist-packages/utils/init.py)
Can you help me please?
I'm not familiar with Colab. What's the result of running the code snippet below?
import os
directory = os.getcwd()
print(directory)
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 filehttps://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 GitHubhttps://github.com/awslabs/dgl-lifesci/issues/183#issuecomment-1169505450, or unsubscribehttps://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 utils
or pointing to a path where there is another utils
file.
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 'collatecenter' from 'utils' (/usr/local/lib/python3.7/dist-packages/utils/init.py)