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

Python 3.10 configure error #12045

Closed
dg98 opened this issue May 14, 2021 · 13 comments
Closed

Python 3.10 configure error #12045

dg98 opened this issue May 14, 2021 · 13 comments
Labels
Status: Triage Needed New issue which needs to be triaged Type: Building Indicates an issue related to building binaries Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@dg98
Copy link

dg98 commented May 14, 2021

Hello,
I was trying to build ZFS 2.1.0_rc5 on Gentoo with Python 3.10 installed but configure detects it as <= Python 3.4. When running configure through the ebuild, I get the following:

checking for python version... 3.1
checking for python platform... linux
checking for python script directory... ${prefix}/lib/python3.10/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python3.10/site-packages
configure: error: "Python >= 3.4 is required"

So it somehow turns 3.10 into 3.1. If I clone the repo and run configure there, it prints 3.10 but the check for >= '3.4.0' still prints no:

checking for python3... python3
checking for python version... 3.10
checking for python platform... linux
checking for python script directory... ${prefix}/lib/python3.10/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python3.10/site-packages
checking for python3.10... /usr/bin/python3.10
checking for a version of Python >= '2.1.0'... yes
checking for a version of Python >= '3.4.0'... no
@dg98 dg98 added Status: Triage Needed New issue which needs to be triaged Type: Defect Incorrect behavior (e.g. crash, hang) labels May 14, 2021
@behlendorf behlendorf added the Type: Building Indicates an issue related to building binaries label May 14, 2021
@rincebrain
Copy link
Contributor

rincebrain commented May 18, 2021

I found the problem in git master (the conditional appears to be backwards and just worked because it parsed the filename of the interpreter, and many people just have "python3", so it didn't extract a version from that...); I haven't looked at 2.1-rc5 yet.

edit: Hm, I may have been looking at the wrong conditional, nevermind, I'll wait and get back to you when I have a working fix.

@rincebrain
Copy link
Contributor

rincebrain commented May 18, 2021

On my git master clone (7457b02), on Ubuntu 21.04, with Python 3.10.0a7-3, invoked by ./configure --enable-pyzfs --with-python=`which python3.10` the check you're lamenting correctly reports 3.10. (A later check fails, but that's not your current problem.) Can you share what grep -i python config.log says for yours?

@dg98
Copy link
Author

dg98 commented May 19, 2021

Here you go:

config-python.log

@rincebrain
Copy link
Contributor

That log seems to be spitting out the message I'm working on #12073 to solve, not the one you opened this bug about?

@dg98
Copy link
Author

dg98 commented May 19, 2021

It seems like I copied the same text twice in my initial comment, I updated the second one now. Sorry for that

@rincebrain
Copy link
Contributor

Okay, well, if you want, you can grab my PR in #12073 in the meantime to get this working with git master for you. I'll take a look at why 2.1-rc5 is behaving differently when I get a second, because I'm pretty sure the logic it should be using hasn't changed in years at this point.

@ahesford
Copy link
Contributor

@rincebrain your patch does not fix the issue. Configuration fails because https://github.com/openzfs/zfs/blob/master/config/ax_python_devel.m4#L227 relies on sys.version[:3], which returns 3.1 on Python 3.10. The right fix here is doing something like

'.'.join(sys.version.split('.')[:2])

Making this change in config/ax_python_devel.m4 does not seem to be sufficient, since autoreconf can still grab the macro from a still-buggy installation of automake.

@thesamesam
Copy link
Contributor

(Nit: not automake, but autoconf-archive).

@rincebrain
Copy link
Contributor

@rincebrain your patch does not fix the issue. Configuration fails because https://github.com/openzfs/zfs/blob/master/config/ax_python_devel.m4#L227 relies on sys.version[:3], which returns 3.1 on Python 3.10. The right fix here is doing something like

'.'.join(sys.version.split('.')[:2])

Making this change in config/ax_python_devel.m4 does not seem to be sufficient, since autoreconf can still grab the macro from a still-buggy installation of automake.

Huh. I swear I did test that this not only ran but that the check succeeded. Wonder where I went wrong.

I'll go look.

@rincebrain
Copy link
Contributor

@rincebrain your patch does not fix the issue. Configuration fails because https://github.com/openzfs/zfs/blob/master/config/ax_python_devel.m4#L227 relies on sys.version[:3], which returns 3.1 on Python 3.10. The right fix here is doing something like

'.'.join(sys.version.split('.')[:2])

Making this change in config/ax_python_devel.m4 does not seem to be sufficient, since autoreconf can still grab the macro from a still-buggy installation of automake.

...what environment are you on that you got to that codepath? Because on my Fedora Rawhide system, for example, that codepath doesn't get hit.

@ahesford
Copy link
Contributor

The issue is the version of the automake package that pulls this macro. Apparently this is fixed in v1.16.4 (not sure about 1.16.3). The package I'm using, in Void, is 1.16.2. Looks like I can couple an automake update with py3.10 and resolve this problem.

rincebrain added a commit to rincebrain/zfs that referenced this issue Oct 23, 2021
There was a fallback case I overlooked in the initial patch, with
a similarly imperfect version extractor.

Closes: openzfs#12045

Signed-off-by: Rich Ercolani <[email protected]>
@rincebrain rincebrain mentioned this issue Oct 23, 2021
13 tasks
rincebrain added a commit to rincebrain/zfs that referenced this issue Oct 26, 2021
There was a fallback case I overlooked in the initial patch, with
a similarly imperfect version extractor.

Closes: openzfs#12045

Signed-off-by: Rich Ercolani <[email protected]>
behlendorf pushed a commit to behlendorf/zfs that referenced this issue May 2, 2022
There was a fallback case I overlooked in the initial patch, with
a similarly imperfect version extractor.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#12045 
Closes openzfs#12673
behlendorf pushed a commit that referenced this issue May 4, 2022
There was a fallback case I overlooked in the initial patch, with
a similarly imperfect version extractor.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes #12045 
Closes #12673
@ThomasD13
Copy link

ThomasD13 commented Mar 2, 2023

The issue is the version of the automake package that pulls this macro. Apparently this is fixed in v1.16.4 (not sure about 1.16.3). The package I'm using, in Void, is 1.16.2. Looks like I can couple an automake update with py3.10 and resolve this problem.

@ahesford : Hi, I have still the problem of wrong detection of the installed python version on my host. I tried zfs version 2.1.9, I installed python-3.11 on my system.
The configure step always detects python 3.1 and then stops.
You also mentioned that this could be a problem with automake.
My automake version is 1.16.5-1.3.
My host is a ubuntu 22.04 (jammy).

Do you have any suggestions what I can do, to solve this python version problem?

Update:
I fixed the issue. Problem was not my host, but the native automake which yocto have been used buildling zfs. I updated automake (autotools package at yocto) from 1.16.1 to 1.16.3. Thanks everyone for providing all the required information.

@kabu1204
Copy link

kabu1204 commented Nov 27, 2024

All works well after changing the line:

am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"`

to:

am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:4])"`

in configure.

If your python version is >= 3.10, you can try this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needed New issue which needs to be triaged Type: Building Indicates an issue related to building binaries Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

No branches or pull requests

7 participants