ImportError without optional dependencies
See original GitHub issueAfter #8, from testcontainers import PostgresContainer
fails because __init__.py
imports the selenium submodule.
If you want to keep the top level imports the submodules will need to catch ImportError
and set the imported names as None
. Then in the classes that use them check if the imported names are None and raise an exception about the optional dependencies.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Missing optional dependency 'openpyxl' still doesn't work after ...
I've installed using pip3 install openpyxl and it say requirement is already satisfied.
Read more >Optional dependency groups omitting package requirements
The main package at runtime can then do try: import foobar; except ImportError; import foobar_compiled as foobar . My own use case is...
Read more >Missing optional dependency 'pytables'. Use pip or conda to ...
It ran for a long time and finally gave an error: “ImportError: Missing optional dependency 'pytables'. Use pip or conda to install pytables.”...
Read more >Installation — pandas 1.1.5 documentation
If the optional dependency is not installed, pandas will raise an ImportError when the method requiring that dependency is called.
Read more >Optional imports | Modular Programming with Python
ImportError : No module named 'nonexistent_module' Copy. This shouldn't be a surprise to you; you may have even seen this error in your...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
v2.2 has been released to PYPI.
Will do it this weekend.