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

No module named 'exceptiongroup' #12177

Closed
oliverfunk opened this issue Apr 2, 2024 · 6 comments
Closed

No module named 'exceptiongroup' #12177

oliverfunk opened this issue Apr 2, 2024 · 6 comments

Comments

@oliverfunk
Copy link

oliverfunk commented Apr 2, 2024

Hello,

I'm getting an error when trying to run pytest.

_pytest/_code/code.py", line 56, in <module>
    from exceptiongroup import BaseExceptionGroup
ModuleNotFoundError: No module named 'exceptiongroup'

I'm on Python 3.10 and from what I can find, pytest supports 3.8+

ExceptionGroup was only added in Python 3.11

(see https://docs.python.org/3.11/library/exceptions.html#exception-groups vs 3.10)

The following line is causing the issue:

if sys.version_info[:2] < (3, 11):

I don't understand how I can be the first to pick up on this though so I'm pretty wary posting this issue.

Here are my versions:

pytest                        8.1.1
pytest-cov                    5.0.0
pytest-html                   4.1.1
pytest-json-report            1.5.0
pytest-metadata               3.1.1
@oliverfunk
Copy link
Author

Okay I see what's happened.

For some reason, the exceptiongroup dep from this project did not install.

The dep. is listed here

'exceptiongroup>=1.0.0rc8; python_version < "3.11"',

Best

@whateverforever
Copy link

same install problem here on python3.10 why this external dependency in the first place? especially in light of recent supply chain attacks

@The-Compiler
Copy link
Member

@whateverforever You'll need to install pytest properly then, this it not a pytest issue. I feel like I'm stating the obvious here, but the response to supply chain attacks is not to stop using dependencies altogether and reinventing the wheel every time. The dependency is used to provide support for exception groups on older Python versions.

@whateverforever
Copy link

sure, every dependency is used for something. but why use a python3.11 feature if you want to support older versions? there are dependencies on which you depend, and there is fluff.

@The-Compiler
Copy link
Member

You're free to use Python 3.11, in which case the backport isn't installed. 🤷

@nicoddemus
Copy link
Member

nicoddemus commented Apr 5, 2024

but why use a python3.11 feature if you want to support older versions?

Just to clarify: we need to support the Python 3.11 feature in the same code base, that's why the backport is used. Note also that users in older versions might also be using the backport, in which case pytest will work as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants