Re: [C++-sig] Boost Python Wrong Python Version macOS

stefan <[email protected]> Fri, 11 Sep 2020 09:47:14 -0400
Newsgroups gmane.comp.python.c++,gmane.comp.lib.boost.build
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============3482858031840161958==
Content-Type: multipart/alternative;
 boundary="------------91BA93CE5DBF305C5C84E83E"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------91BA93CE5DBF305C5C84E83E
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Mortimer,

let me forward your message to the Boost.Build list, where I hope 
someone will take appropriate action.

Thanks,

On 2020-09-10 9:24 p.m., Mortimer Hemmit wrote:
> Hi Stefan,
>
> Thanks for the advice and the link; they were really helpful.
> Just by itself, the line "using python : 3.7 ;" still returned an
> error. However, upon reading the link, I could also specify the path
> that leads to Python. So, I tried:
>
> using python : 3.7 :
> /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7
>
> Now, even without explicitly saying the python version,
>
> sudo ./b2 install
>
> began to use the right Python version. However, now the compiler
> complained about not finding the file pyconfig.h. Looking at the
> output, it seems like the build was specifying the following
> nonexistent directory as an include path
> "/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7/".
> Actually, pyconfig.h is located inside
> "/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/".
> Note the extra "m" at the end (I don't know what the m means though).
> Anyway, as per the link you sent, I could add another path to the .jam
> file to specify an include directory, so the final line was
>
> using python : 3.7 :
> "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7" :
> "/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/"
>
> Now it compiled relatively smoothly :)
>
> Now, I tried getting it to work without making a user-specific file. I
> looked at the boost folder and saw that inside "project-config.jam",
> there was a section that said
>
> if ! [ python.configured ]
> {
>      using python : 3.7 : "/Library/Frameworks/Python.framework/Versions/3.7"
> }
>
> When I ran it just like this, it still failed. However, when I edited
> "project-config.jam" to go to the exact python executable (not just
> the parent directory), it started working, but this time with the
> header problem again.
>
> using python : 3.7 :
> "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7"
>
> So, I added the whole include line from my user file, and now it worked.
>
> using python : 3.7 :
> "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7" :
> "/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/"
>
> Ultimately, my prediction is that there are two problems:
> 1) The script ./bootstrap.sh, which generates the project-config.jam,
> should print the full path to the python3.7 executable instead of just
> the parent directory when given a --with-python=[executable] flag.
> 2) Somewhere in the build process, an include flag is missing an "m"
> at the end which specifies the following nonexistent directory as an
> include path "/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7/".
> This prevents the compiler from finding pyconfig.h, causing an error.
> Actually, pyconfig.h is located inside
> "/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/".
>
> However, I'm not sure if these are specific to the version 3.7, or in general.
>
> You have helped me a lot to get this working, and I hope this
> information helps you (or someone else) find (and fix!) some of them.
>
> Thank you very much,
> Mortimer
>
>
> On Mon, Sep 7, 2020 at 2:47 PM Stefan Seefeld <[email protected]> wrote:
>> Hi Mortimer,
>>
>> On 2020-09-06 12:54 p.m., Mortimer Hemmit wrote:
>>
>> Hi Stefan,
>>
>> Apologies for breaking the reply chain; I wasn't subscribed to the
>> list earlier, so this is the only message I could reply to. Now I
>> should be able to reply to other messages.
>>
>> Thanks for your email. I don't think that ./b2 has the option to
>> specify the python version within --with-python - I think only
>> ./bootstrap does. When I tried
>>
>> ./b2 --with-python=3.7
>>
>> I got;
>>
>> *****BEGIN OUTPUT*****
>> error: wrong library name 'python=3.7' in the --with-<library> option.
>> *****END OUTPUT*****
>>
>> Then, I tried invoking ./b2 with option python=3.7.
>>
>> sudo ./b2 python=3.7 --with-python
>>
>> *****BEGIN OUTPUT*****
>> /Users/Mort/Downloads/boost_1_74_0/tools/build/src/build/feature.jam:491:
>> in feature.validate-value-string from module feature
>> error: "3.7" is not a known value of feature <python>
>> error: legal values: "2.7"
>>
>> you are entirely right, there is no `--with-python` option to `b2`. Sorry for sending you down a wrong route.
>>
>> I think what you need is described in https://www.boost.org/doc/libs/1_74_0/libs/python/doc/html/building/configuring_boost_build.html
>>
>> Create a ~/user-config.jam file containing the line "using python : 3.7 ;"
>>
>> This informs Boost.Build of the availability of that Python version (depending on your system you may want to add more parameters to specify paths, library name, etc.). You could define multiple versions (one per line), in which case the option `./b2 python=<python-version>` will allow you to select one.
>>
>> Hope this helps,
>>
>> --
>>
>>        ...ich hab' noch einen Koffer in Berlin...
>>
>> _______________________________________________
>> Cplusplus-sig mailing list
>> [email protected]
>> https://mail.python.org/mailman/listinfo/cplusplus-sig
> _______________________________________________
> Cplusplus-sig mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/cplusplus-sig

Stefan

--

       ...ich hab' noch einen Koffer in Berlin...
     


--------------91BA93CE5DBF305C5C84E83E
Content-Type: multipart/related;
 boundary="------------BA5C2B0095372C3FE1708883"


--------------BA5C2B0095372C3FE1708883
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi Mortimer,</p>
    <p>let me forward your message to the Boost.Build list, where I hope
      someone will take appropriate action.</p>
    <p>Thanks,<br>
    </p>
    <div class="moz-cite-prefix">On 2020-09-10 9:24 p.m., Mortimer
      Hemmit wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAHLdEh1MVi5W_7ypeHKd3LG1xYVxS+NsJbGwjZrBa4+SVe9LxA@mail.gmail.com">
      <pre class="moz-quote-pre" wrap="">Hi Stefan,

Thanks for the advice and the link; they were really helpful.
Just by itself, the line "using python : 3.7 ;" still returned an
error. However, upon reading the link, I could also specify the path
that leads to Python. So, I tried:

using python : 3.7 :
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7

Now, even without explicitly saying the python version,

sudo ./b2 install

began to use the right Python version. However, now the compiler
complained about not finding the file pyconfig.h. Looking at the
output, it seems like the build was specifying the following
nonexistent directory as an include path
"/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7/".
Actually, pyconfig.h is located inside
"/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/".
Note the extra "m" at the end (I don't know what the m means though).
Anyway, as per the link you sent, I could add another path to the .jam
file to specify an include directory, so the final line was

using python : 3.7 :
"/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7" :
"/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/"

Now it compiled relatively smoothly :)

Now, I tried getting it to work without making a user-specific file. I
looked at the boost folder and saw that inside "project-config.jam",
there was a section that said

if ! [ python.configured ]
{
    using python : 3.7 : "/Library/Frameworks/Python.framework/Versions/3.7"
}

When I ran it just like this, it still failed. However, when I edited
"project-config.jam" to go to the exact python executable (not just
the parent directory), it started working, but this time with the
header problem again.

using python : 3.7 :
"/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7"

So, I added the whole include line from my user file, and now it worked.

using python : 3.7 :
"/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7" :
"/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/"

Ultimately, my prediction is that there are two problems:
1) The script ./bootstrap.sh, which generates the project-config.jam,
should print the full path to the python3.7 executable instead of just
the parent directory when given a --with-python=[executable] flag.
2) Somewhere in the build process, an include flag is missing an "m"
at the end which specifies the following nonexistent directory as an
include path "/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7/".
This prevents the compiler from finding pyconfig.h, causing an error.
Actually, pyconfig.h is located inside
"/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/".

However, I'm not sure if these are specific to the version 3.7, or in general.

You have helped me a lot to get this working, and I hope this
information helps you (or someone else) find (and fix!) some of them.

Thank you very much,
Mortimer


On Mon, Sep 7, 2020 at 2:47 PM Stefan Seefeld <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]">&lt;[email protected]&gt;</a> wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">
Hi Mortimer,

On 2020-09-06 12:54 p.m., Mortimer Hemmit wrote:

Hi Stefan,

Apologies for breaking the reply chain; I wasn't subscribed to the
list earlier, so this is the only message I could reply to. Now I
should be able to reply to other messages.

Thanks for your email. I don't think that ./b2 has the option to
specify the python version within --with-python - I think only
./bootstrap does. When I tried

./b2 --with-python=3.7

I got;

*****BEGIN OUTPUT*****
error: wrong library name 'python=3.7' in the --with-&lt;library&gt; option.
*****END OUTPUT*****

Then, I tried invoking ./b2 with option python=3.7.

sudo ./b2 python=3.7 --with-python

*****BEGIN OUTPUT*****
/Users/Mort/Downloads/boost_1_74_0/tools/build/src/build/feature.jam:491:
in feature.validate-value-string from module feature
error: "3.7" is not a known value of feature &lt;python&gt;
error: legal values: "2.7"

you are entirely right, there is no `--with-python` option to `b2`. Sorry for sending you down a wrong route.

I think what you need is described in <a class="moz-txt-link-freetext" href="https://www.boost.org/doc/libs/1_74_0/libs/python/doc/html/building/configuring_boost_build.html">https://www.boost.org/doc/libs/1_74_0/libs/python/doc/html/building/configuring_boost_build.html</a>

Create a ~/user-config.jam file containing the line "using python : 3.7 ;"

This informs Boost.Build of the availability of that Python version (depending on your system you may want to add more parameters to specify paths, library name, etc.). You could define multiple versions (one per line), in which case the option `./b2 python=&lt;python-version&gt;` will allow you to select one.

Hope this helps,

--

      ...ich hab' noch einen Koffer in Berlin...

_______________________________________________
Cplusplus-sig mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/cplusplus-sig">https://mail.python.org/mailman/listinfo/cplusplus-sig</a>
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Cplusplus-sig mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/cplusplus-sig">https://mail.python.org/mailman/listinfo/cplusplus-sig</a>
</pre>
    </blockquote>
    <div class="moz-signature"><br>
      <div class="moz-signature"><img moz-do-not-send="false"
          src="cid:[email protected]" alt="Stefan"
          width="73" height="45"><br>
        <pre>--

      ...ich hab' noch einen Koffer in Berlin...
    </pre>
      </div>
    </div>
  </body>
</html>

--------------BA5C2B0095372C3FE1708883
Content-Type: image/png;
 name="signature.png"
Content-Transfer-Encoding: base64
Content-ID: <[email protected]>
Content-Disposition: inline;
 filename="signature.png"

iVBORw0KGgoAAAANSUhEUgAAAEkAAAAtCAYAAADiFkaQAAAABHNCSVQICAgIfAhkiAAAAAlw
SFlzAAAVhwAAFYcBshnuugAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoA
AAVDSURBVGiB5dpprF1TFMDx33u0iqpWW6LmqWpIVUkoNVbM81ShiJifIakgxAc1VEzxwRiC
8EHwgaAilBhCg6BClJIYaqohSM1t6fVh7afXfffcd+55d8I/uXnvnL3PWuvus/daa699+e8x
CFfhlnYb0qkMw40o4dA229KRDMLL+AnvYYX2mtOZXIj5+B4HttmWjmQkfsCreLDNtnQsV+Er
fIsxbbalI1kDi/AnTm6zLR3LpSKazUJXm23JRauNHIyF+ByjWqy7boagB59gGR4QIbnZHCeW
2Z4t0DUgNsXh4k2Owxti+l/eAt0vt0jPgNgUn2FC2b2NsFjkK81M6E4UDntYE3UMmC6Rl9xU
pW2WmE2bNUn3OPzsX7A/OxC/q+4wrxGDtE3GszvgmIJ6h+CtJH/7gjJaxiO4P6PtSvEltqjS
tifmYXhBvXeJAPF2wedbxmgswd4Z7bfgR30j3Dr4FFsV1HsmZmMOpheU0TJ6hE9YKaN9Hm6v
uNeF53F+QZ2T8IFYYouxZkE5LeNhPJHRNgXfiVlTzikiPeguoG8UFmBXkWE/WkBGS+kWg1Bt
uo/AXOxRcX8kvhFfsl668BhmpusPMK2AnJaytXDKk7EyrhNlihfFbnztKs/chocK6jsbLwn/
Nl5E1NULymoZ08RWYDUMxUE4UiSR1dhQVAuL5EwrieDQu0QvEzlYx3M93q+j/724oUG638U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B6q0GfN5WKxKdOkhjRF72TLsNgb8A
ty4jMPtjABcAAAAASUVORK5CYII=
--------------BA5C2B0095372C3FE1708883--

--------------91BA93CE5DBF305C5C84E83E--

--===============3482858031840161958==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Cplusplus-sig mailing list
[email protected]
https://mail.python.org/mailman/listinfo/cplusplus-sig

--===============3482858031840161958==--