question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ERROR] Runtime.ImportModuleError: Unable to import module 'app': No module named 'sascorer' Traceback (most recent call last):

See original GitHub issue
[ERROR] Runtime.ImportModuleError: Unable to import module 'app': No module named 'sascorer' Traceback (most recent call last):

Posting so it’s logged somewhere.

Is this a new dependency for datamol? Disclaimer, I didn’t update datamol in my project (lambdomics) since a couple months (I was at 0.5 before upgrading). sascorer seems to have appear in commit 8576d4b with the descriptors module, and this module is imported by default when using import datamol as dm .

sascorer seems to be a module coming from RDKit but I’m not sure. Is it just a matter of making sure to import RDKit before datamol if you use both in your project?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
adelenelaicommented, May 13, 2022

Hello @MichelML and @maclandrol

I did pip uninstall rdkit-pypi to leave rdkit remaining in the env as you advised.

But…things started to break and I couldn’t even do import rdkit.Chem.rdchem as rdchem any more D:

So…I did a fresh install of rdkit in a new env, then conda install -c conda-forge datamol.

After that, importing datamol was no problem 😃

Thanks a lot for your speedy help

1reaction
maclandrolcommented, May 13, 2022

@adelenelai Confirmed. The rdkit from pypi does not package the ‘Contrib’ module, thus it cannot be imported.

In your case, the interpreter is picking up the rdkit-pypi over the one from conda-forge. This happens likely because you pip install 'rdkit-pypi' AFTER installing datamol.

I am not sure a simple pip uninstall 'rdkit-pypi' would work, so instead you can either create a new env, or run the following:

  • pip uninstall 'rdkit-pypi'
  • mamba install datamol -c conda-forge --force-reinstall
  • mamba install rdkit -c conda-forge --force-reinstall

As a side note, remember that if you install datamol from conda-forge, you don’t need to install rdkit anymore.

@hadim , we should remove anything that links to contrib from the __init__ for cases like this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - "errorMessage": "Unable to import module 'app': No ...
Now I'm getting another error saying “unable to import module app: no module named requests” My current version of python is 3.10.2 and...
Read more >
ModuleNotFoundError: No module named 'rdkit.Contrib' #2279
I get the following error: ModuleNotFoundError: No module named 'rdkit.Contrib'. import rdkit from rdkit.Contrib.SA_Score.sascorer import ...
Read more >
How do I resolve the "Unable to import module" error I receive ...
... the Knowledge Center article with this video: https://aws.amazon.com/premiumsupport/knowledge-center/lambda- import-module-error -python/0 ...
Read more >
2021 How to Fix "No Module Named..." Error in Python
2021 How to Fix ImportError " No Module Named pkg_name" in Python! First, download the package using a terminal outside of python.
Read more >
How to Fix ModuleNotFoundError and ImportError
Module imports can certainly frustrate people and especially those who are fairly new ... import aModuleNotFoundError: No module named 'a'.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found