[Solved] Build fail, python version

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

[Solved] Build fail, python version

Post by drmacro »

With today's git source for 0.21 I get the following message:

Code: Select all

CMake Error at cMake/FreeCAD_Helpers/SetupPython.cmake:158 (message):
  To build FreeCAD you need at least Python 3.8
The cmake line is:

Code: Select all

cmake -DCMAKE_BUILD_TYPE=Release -D PYTHON_INCLUDE_DIR=/usr/include/python3.9 bla,bla
Typically I don't even use the "-D PYTHON_INCLUDE_DIR", but now with or without it, the above message.

Nothing about python on this machine has changed...and /usr/include/python3.9 is there.

What magic incantation is am I missing? :?
Last edited by drmacro on Thu Jan 26, 2023 10:11 pm, edited 1 time in total.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
user1234
Veteran
Posts: 3319
Joined: Mon Jul 11, 2016 5:08 pm

Re: Build fail, python version

Post by user1234 »

drmacro wrote: Wed Jan 25, 2023 3:17 pm What magic incantation is am I missing?
OS? OK, maybe not that importand for this case, but often useful.

30 min ago i also made a update and build, no issues so far (Debian 11).

This seem somehow related to https://github.com/FreeCAD/FreeCAD/comm ... f6b1b97720, but since you have python 3.9, this error should not occur.


drmacro wrote: Wed Jan 25, 2023 3:17 pm Typically I don't even use the "-D PYTHON_INCLUDE_DIR", but now with or without it, the above message.
This is filled automatic while run cmake. I would delete first inspect the CMakeCache.txt if there are lines from python they still use <3.8. Then just delete them and run cmake again. If it still uses it, then you have still some remains of python <3.8 in your OS. Normally when you config then per hand to the newest version of python, it should work.

Note: i would use cmakegui, it is very easy to use and the overview with grouped and advanced option (checkboxes) is really good.

Greetings
user1234
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

Re: Build fail, python version

Post by drmacro »

user1234 wrote: Wed Jan 25, 2023 3:44 pm ...
OS? OK, maybe not that importand for this case, but often useful.

30 min ago i also made a update and build, no issues so far (Debian 11).

This seem somehow related to https://github.com/FreeCAD/FreeCAD/comm ... f6b1b97720, but since you have python 3.9, this error should not occur.
This did not happen the last time I built FC. (48 hours ago) on this Debian 11 and the -D was not needed then.

I have 2 Debian 11 machines (one fails, one not)...same BASH script on both.
This is filled automatic while run cmake. I would delete first inspect the CMakeCache.txt if there are lines from python they still use <3.8. Then just delete them and run cmake again. If it still uses it, then you have still some remains of python <3.8 in your OS. Normally when you config then per hand to the newest version of python, it should work.
grep shows only python 3.9 mentioned.

I cleared the build directory and now it ignores the make "-D PYTHON_INCLUDE_DIR=/usr/include/python3.9" and says it found 3.7.

Code: Select all

-- Found Python3: /usr/local/bin/python3.7 (found version "3.7.3") found components: Interpreter Development Development.Module Development.Embed 
CMake Error at cMake/FreeCAD_Helpers/SetupPython.cmake:158 (message):
  To build FreeCAD you need at least Python 3.8

Call Stack (most recent call first):
  CMakeLists.txt:46 (SetupPython)
Note: i would use cmakegui, it is very easy to use and the overview with grouped and advanced option (checkboxes) is really good.
..
I have been told this before. I must be missing something. When I run cmakegui, it produces a GUI, that I find not easy, no clue what the check boxes mean/do, I have no idea what the grouping means or indicates, I have no idea what the advanced checkboxes mean. It looks like it would be quite useful if you already know what it means/does. I have yet to find a tutorial that get me to the "very easy to use" or maybe I simply don't know what it provides for the user. I simply don't know how to use it to fix/troubleshoot issues like this. :(
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

Re: Build fail, python version

Post by drmacro »

user1234 wrote: Wed Jan 25, 2023 3:44 pm ...

Note: i would use cmakegui, it is very easy to use and the overview with grouped and advanced option (checkboxes) is really good.
...
So, I open it, set the source, set build dir, and hit configure...and it tells me what I already got from the command line.

So it was easy to tell me what I already know. :lol:
Screenshot_20230125_112717.png
Screenshot_20230125_112717.png (135.1 KiB) Viewed 1435 times
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
chennes
Veteran
Posts: 3876
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Build fail, python version

Post by chennes »

If cMake is finding the wrong version of Python, setting the include directory is not enough: in the GUI if you do a search for PYTHON you should see something called "PYTHON_EXECUTABLE" (I think... but can't remember exactly, which is the sole advantage of the GUI, IMO). I do not know why cMake is not choosing the latest version of Python, but of course system configurations vary wildly.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

Re: Build fail, python version

Post by drmacro »

chennes wrote: Wed Jan 25, 2023 5:31 pm If cMake is finding the wrong version of Python, setting the include directory is not enough: in the GUI if you do a search for PYTHON you should see something called "PYTHON_EXECUTABLE" (I think... but can't remember exactly, which is the sole advantage of the GUI, IMO). I do not know why cMake is not choosing the latest version of Python, but of course system configurations vary wildly.
Things do vary, but, nothing about Python or FreeCAD (other than a git pull) has changed since this did work. Python 3.8 is, has not been, on this PC. The only other versions of Python resident are 2.7 and 3.9.

This is what search shows:
Screenshot_20230125_130917.png
Screenshot_20230125_130917.png (50.82 KiB) Viewed 1280 times
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
user1234
Veteran
Posts: 3319
Joined: Mon Jul 11, 2016 5:08 pm

Re: Build fail, python version

Post by user1234 »

drmacro wrote: Wed Jan 25, 2023 4:30 pm So it was easy to tell me what I already know.
Check the checkboxes of Advanced and Grouped, open the tree of Python, then you will see more. Normally you can clear the lines in it and hit Configure and Generate, then it searches automatic the correct libraries and include. If not you can click in the line (three dots, like Attachment in FreeCAD) and then it opens browser, where you can search and add them individuality.

Here my Debian 11 config:
2023-01-25_19-24.png
2023-01-25_19-24.png (118.15 KiB) Viewed 1261 times


Greetings
user1234
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

Re: Build fail, python version

Post by drmacro »

user1234 wrote: Wed Jan 25, 2023 6:31 pm ...
Those entries weren't there. I Removed the ones I'd added. Tried it. It did not search and find the libraries, same error, looking for 3.8.

The I added the same entries as you show. I verified the dir and lib were there. Same error, looking for 3.8.
Attachments
Screenshot_20230125_140335.png
Screenshot_20230125_140335.png (86.8 KiB) Viewed 1234 times
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

Re: Build fail, python version

Post by drmacro »

chennes wrote: Wed Jan 25, 2023 5:31 pm If cMake is finding the wrong version of Python, setting the include directory is not enough: in the GUI if you do a search for PYTHON you should see something called "PYTHON_EXECUTABLE" (I think... but can't remember exactly, which is the sole advantage of the GUI, IMO). I do not know why cMake is not choosing the latest version of Python, but of course system configurations vary wildly.
Where does PYTHON_VERSION_STRING mentioned in the merge get set?
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
chennes
Veteran
Posts: 3876
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Build fail, python version

Post by chennes »

Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
Post Reply