Bug 2344401 - direnv =< v2.34.0 throws DeprecationWarning: 'pkgutil.find_loader' trying to run layout_python3 or "layout python3" to load a Python venv
Summary: direnv =< v2.34.0 throws DeprecationWarning: 'pkgutil.find_loader' trying to ...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: direnv
Version: 41
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Ed Marshall
QA Contact: Fedora Extras Quality Assurance
URL: https://github.com/direnv/direnv/issu...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-02-07 20:44 UTC by Will McDonald
Modified: 2025-12-16 18:40 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-12-16 18:40:07 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Will McDonald 2025-02-07 20:44:16 UTC
direnv v2.34.0 and earlier using deprecated pkgutil.find_loader. 

[vagrant@localhost ~]$ rpm -q direnv
direnv-2.32.3-5.fc41.x86_64
[vagrant@localhost ~]$ cat project-a/.envrc 
layout python3
[vagrant@localhost ~]$ cd project-a/
direnv: loading ~/project-a/.envrc
<string>:1: DeprecationWarning: 'pkgutil.find_loader' is deprecated and slated for removal in Python 3.14; use importlib.util.find_spec() instead
  import pkgutil as u, platform as p;ve='venv' if u.find_loader('venv') else ('virtualenv' if u.find_loader('virtualenv') else '');print('.'.join(p.python_version_tuple()[:2])+' '+ve)
direnv: export +VIRTUAL_ENV ~PATH

https://github.com/direnv/direnv/issues/1177 indicates the cause.

https://github.com/direnv/direnv/commit/af06cb05c1468f4b80a7548818d096625fb04c36 indicates the upstream direnv fix.

Reproducible: Always

Steps to Reproduce:
1. $ sudo dnf -y install direnv
2. $ echo eval "$(direnv hook bash)" >> ~/.bashrc
3. $ mkdir ~/project-a
4. $ python -m venv ~/project-a/.venv
5. $ cd ~/project-a
6. $ echo 'layout python3' > .envrc
7. $ direnv allow

Actual Results:  
[vagrant@localhost ~]$ cd project-a/
direnv: loading ~/project-a/.envrc
<string>:1: DeprecationWarning: 'pkgutil.find_loader' is deprecated and slated for removal in Python 3.14; use importlib.util.find_spec() instead
  import pkgutil as u, platform as p;ve='venv' if u.find_loader('venv') else ('virtualenv' if u.find_loader('virtualenv') else '');print('.'.join(p.python_version_tuple()[:2])+' '+ve)
direnv: export +VIRTUAL_ENV ~PATH


Expected Results:  
direnv invokes the venv without throwing the exception.

https://github.com/direnv/direnv/issues/1177 indicates the cause.

https://github.com/direnv/direnv/commit/af06cb05c1468f4b80a7548818d096625fb04c36 indicates the upstream direnv fix.

Comment 1 Adam Williamson 2025-12-02 02:19:58 UTC
This message is a reminder that Fedora Linux 41 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 41 on 2025-12-15.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '41'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 41 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 2 Samyak Jain (RedHat) 2025-12-16 18:40:07 UTC
Fedora Linux 41 entered end-of-life (EOL) status on 2025-12-15.

Fedora Linux 41 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.