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

trio 0.23.0 - AssertionError in Conda #2855

Closed
anakin87 opened this issue Nov 3, 2023 · 5 comments · Fixed by #2856
Closed

trio 0.23.0 - AssertionError in Conda #2855

anakin87 opened this issue Nov 3, 2023 · 5 comments · Fixed by #2856

Comments

@anakin87
Copy link

anakin87 commented Nov 3, 2023

To reproduce

docker run -it continuumio/miniconda3 /bin/bash

pip install trio

python -c "import trio"

Error

Traceback (most recent call last):
File "/opt/conda/lib/python3.11/site-packages/trio/_subprocess.py", line 50, in
from os import pidfd_open
ImportError: cannot import name 'pidfd_open' from 'os' (/opt/conda/lib/python3.11/os.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/opt/conda/lib/python3.11/site-packages/trio/init.py", line 23, in
from . import abc, from_thread, lowlevel, socket, to_thread
File "/opt/conda/lib/python3.11/site-packages/trio/lowlevel.py", line 48, in
from ._subprocess import open_process as open_process
File "/opt/conda/lib/python3.11/site-packages/trio/_subprocess.py", line 54, in
assert sys.version_info < (3, 9) or sys.implementation.name != "cpython"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

Why

It seems related to

trio/trio/_subprocess.py

Lines 49 to 54 in eef24cb

try:
from os import pidfd_open
except ImportError:
if sys.platform == "linux":
# This workaround is only needed on 3.8 and pypy
assert sys.version_info < (3, 9) or sys.implementation.name != "cpython"

  • the os package in Conda deviates from std python and does not have pidfd_open --> ImportError (see a similar issue).
  • sys.platform == "linux" is True
  • sys.version_info < (3, 9) or sys.implementation.name != "cpython" is False or False --> AssertionError
@caner-cetin
Copy link

Having same issue. Bump.

@caner-cetin
Copy link

0.22.2 also fixes the issue.

@A5rocks
Copy link
Contributor

A5rocks commented Nov 3, 2023

Hi, sorry about this!

-snip- sorry, should have read the initial comment better.

@caner-cetin
Copy link

I am not quite sure, but you can check https://hub.docker.com/layers/library/python/3.9-slim-buster/images/sha256-5c6f48d1bb7f592ed9b78b4c4efce099957da5fc0b677b8e79a8ba2bd1b087e8 to see which environment I am running my code.

@A5rocks
Copy link
Contributor

A5rocks commented Nov 4, 2023

FYI fix is released in trio==0.23.1

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

Successfully merging a pull request may close this issue.

3 participants