Skip to content
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

Error message: name 'load' is not defined #79

Closed
1980whisky opened this issue Sep 6, 2023 · 4 comments · Fixed by #81
Closed

Error message: name 'load' is not defined #79

1980whisky opened this issue Sep 6, 2023 · 4 comments · Fixed by #81
Labels

Comments

@1980whisky
Copy link

1980whisky commented Sep 6, 2023

Hello,

I am using spyrmsd to compute the RMSD between two mol2 structures. The installation was carried out as instructed. When I type: python3 -m spyrmsd -h, the help message appears as it is supposed to, so I think there's no problem till this point.

However, when I type the command line to compare two mol2 files as follows: python3 -m spyrmsd xxx.mol2 yyy.mol2, an error message appears:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~ /anaconda3/envs/spyrmsd-env/lib/python3.11/site-packages/spyrmsd/__main__.py", line 31, in <module>
    ref = io.loadmol(args.reference)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~ /anaconda3/envs/spyrmsd-env/lib/python3.11/site-packages/spyrmsd/io.py", line 65, in loadmol
    mol = load(fname)
          ^^^^
NameError: name 'load' is not defined. Did you mean: 'float'?

The job is not done. Could you please verify this problem? Thank you in advance.

Regards,

@1980whisky 1980whisky added the bug label Sep 6, 2023
@RMeli
Copy link
Owner

RMeli commented Sep 6, 2023

Hi @1980whisky, thank you for your interest in spyrmsd and for reporting the issue.

In order to use spyrmsd as a standalone tool, you also need to install either OpenBabel or RDKit. If you install one of the two libraries spyrmsd should work as expected. If you install both libraries, OpenBabel will be used by default.


The reason for not providing OpenBabel or RDKit is that they are relatively heavy dependencies, and spyrmsd can also be used as a library (for integration in existing packages). So I don't want to force downstream users to install such libraries if they don't need them (because they already have their own parsers).

I'll try to make the documentation clearer, and I'll see if I can raise a better error message, which is definitely needed! Apologies for the inconvenience.

@RMeli
Copy link
Owner

RMeli commented Sep 6, 2023

PR #81 will add a proper error message if neither RDKit nor OpenBabel are found.

@1980whisky
Copy link
Author

Thank you for your response. The problem has been fixed.

@RMeli
Copy link
Owner

RMeli commented Sep 6, 2023

No problem @1980whisky, I'm glad it's solved.

@RMeli RMeli closed this as completed Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants