Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 898642 - dev-libs/libxml2-2.10.3-r1[python_targets_python3_11] -- ModuleNotFoundError: No module named 'libxml2'
Summary: dev-libs/libxml2-2.10.3-r1[python_targets_python3_11] -- ModuleNotFoundError:...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sam James
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-01 22:54 UTC by Sebastian Pipping
Modified: 2023-03-01 23:47 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Pipping gentoo-dev 2023-03-01 22:54:02 UTC
Hi!

For some reason, libxml2 can be imported from Python 3.9 and 3.10 but not from 3.11:


# qlist dev-libs/libxml2 | grep /libxml2.py
/usr/lib/python3.9/site-packages/libxml2.py
/usr/lib/python3.10/site-packages/libxml2.py
/usr/lib/python3.11/site-packages/libxml2.py

# python3.9 -c 'import libxml2' ; echo $?
0

# python3.10 -c 'import libxml2' ; echo $?
0

# python3.11 -c 'import libxml2' ; echo $?
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'libxml2'
1


Same after re-install.  Does it work for 3.11 for you?  Any ideas?

Thanks in advance!


PS: What made me notice was gnome-extra/zenity install failing with ModuleNotFoundError.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-03-01 23:02:07 UTC
Please include emerge -pvO dev-libs/libxml2.

For me with

[ebuild   R    ] dev-libs/libxml2-2.10.3-r1:2::gentoo  USE="ftp icu python readline -debug -examples -lzma -static-libs -test" ABI_X86="32 (64) (-x32)" PYTHON_TARGETS="python3_9 python3_10 python3_11" 0 KiB

I can import it:

$ python3.11 -c 'import libxml2' ; echo $?
0
$ python3.10 -c 'import libxml2' ; echo $?
0
$ python3.9 -c 'import libxml2' ; echo $?
0

and

$ python3.12 -c 'import libxml2' ; echo $? # expected failure for new impl
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'libxml2'
1
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-03-01 23:04:07 UTC
(In reply to Sebastian Pipping from comment #0)
> 
> PS: What made me notice was gnome-extra/zenity install failing with
> ModuleNotFoundError.

Please be more specific (full output/build.log would be great). What was failing to import it? What during the zenity build needed libxml2?
Comment 3 Sebastian Pipping gentoo-dev 2023-03-01 23:47:35 UTC
(In reply to Sam James from comment #1)
> Please include emerge -pvO dev-libs/libxml2.
> 
> For me with
> 
> [ebuild   R    ] dev-libs/libxml2-2.10.3-r1:2::gentoo  USE="ftp icu python
> readline -debug -examples -lzma -static-libs -test" ABI_X86="32 (64) (-x32)"
> PYTHON_TARGETS="python3_9 python3_10 python3_11" 0 KiB

That would be:

  # emerge -pvO dev-libs/libxml2
  
  These are the packages that would be merged, in order:
  
  [ebuild   R    ] dev-libs/libxml2-2.10.3-r1:2::gentoo  USE="ftp icu python readline static-libs -debug -examples -lzma -test" ABI_X86="32 (64) (-x32)" PYTHON_TARGETS="python3_9 python3_10 python3_11" 0 KiB
  
  Total: 1 package (1 reinstall), Size of downloads: 0 KiB

For some reason "python3.11 -c 'import libxml2'" magically works without error now.  All I did was change "eselect python ..." and that should have no effect.  Can be closed as magically disappeared I guess? *shrug*


> Please be more specific (full output/build.log would be great). What was
> failing to import it? What during the zenity build needed libxml2?

The build uses dev-util/itstool and that tries to import libxml2.

Thanks for your quick reply!