Skip to content

First import in the interpreter always fails in python 3.13 #36

Description

@dariuszd21

Hi!

I've tried to play with the interpreter from the python:3.13-25.04_stable image, but it seems that whatever I do the first import always fails.
If I import something again, then it just works.

I think it might be due to the REPL change that was part of python 3.13 PEP and changelog

Here is a quick reproducer:

❯ podman run -ti -u 1000 --rm docker.io/ubuntu/python:3.13-25.04_stable exec -ti /usr/bin/python3.13
Python 3.13.3 (main, Aug 14 2025, 11:53:40) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
ModuleNotFoundError: No module named '_pyrepl'
>>> os.path
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    os.path
    ^^
NameError: name 'os' is not defined. Did you forget to import 'os'?
>>> import os
>>> os.path
<module 'posixpath' (frozen)>
>>>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions