From mortimer.hemmit at gmail.com Thu Sep 3 14:19:22 2020 From: mortimer.hemmit at gmail.com (Mortimer Hemmit) Date: Thu, 3 Sep 2020 14:19:22 -0400 Subject: [C++-sig] Boost Python Wrong Python Version macOS Message-ID: Hello, I am trying to build the Python library for Boost 1.74.0 on macOS Catalina 10.15.8 with the default Clang 11.0.3. I also installed Python 3.7.9 from python.org I am following the instructions located at and I untar the archive and then execute this command in the boost directory: ./bootstrap.sh --with-python=python3.7 --with-libraries=python This gives me output saying that it detected python 3.7. *****BEGIN OUTPUT***** Building Boost.Build engine with toolset clang... tools/build/src/engine/b2 Detecting Python version... 3.7 Detecting Python root... /Library/Frameworks/Python.framework/Versions/3.7 Unicode/ICU support for Boost.Regex?... not found. Backing up existing Boost.Build configuration in project-config.jam.1 Generating Boost.Build configuration in project-config.jam for clang... Bootstrapping is done. To build, run: ./b2 To generate header files, run: ./b2 headers To adjust configuration, edit 'project-config.jam'. Further information: - Command line help: ./b2 --help - Getting started guide: http://www.boost.org/more/getting_started/unix-variants.html - Boost.Build documentation: http://www.boost.org/build/ *****END OUTPUT***** Then, I run sudo ./b2 --with-python However, when it builds the libraries, it saves it with a folder path that has 2.7, and I get files such as libboost_python27.dylib. *****BEGIN OUTPUT***** In file included from /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include/numpy/ufuncobject.h:327: *****END OUTPUT***** /System/Library is where the default macOS Python 2.7 is stored. How can I convince Boost to use the Python 3.7 that I installed, instead of the default Python 2.7? It looked like it detected it in bootstrap, but it doesn't use it later. Is the way that I specified the desired python executable correct? Any help or guidance is greatly appreciated. Thank you, Mortimer From stefan at seefeld.name Sat Sep 5 17:32:32 2020 From: stefan at seefeld.name (Stefan Seefeld) Date: Sat, 5 Sep 2020 17:32:32 -0400 Subject: [C++-sig] Boost Python Wrong Python Version macOS In-Reply-To: References: Message-ID: <9d2ec8c3-6918-aae0-5c2b-50cf20b8a427@seefeld.name> Hi Mortimer, I'm myself not a Boost.Build expert, and I try to avoid it if ever I can. But your description sounds as if invoking `./b2` with the option `--with-python=3.7` rather than just `--with-python` would work. (I have no idea what effect those options to `./bootstrap` would have, but I assume you can leave them out there, as that merely builds the `b2` tool itself.) Regards, Stefan -- ...ich hab' noch einen Koffer in Berlin... -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: .signature.png Type: image/png Size: 2754 bytes Desc: not available URL: From mortimer.hemmit at gmail.com Sun Sep 6 12:54:35 2020 From: mortimer.hemmit at gmail.com (Mortimer Hemmit) Date: Sun, 6 Sep 2020 12:54:35 -0400 Subject: [C++-sig] Boost Python Wrong Python Version macOS In-Reply-To: References: Message-ID: 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- 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 error: legal values: "2.7" /Users/Mort/Downloads/boost_1_74_0/tools/build/src/build/property.jam:333: in validate1 from module property /Users/Mort/Downloads/boost_1_74_0/tools/build/src/build/property.jam:359: in property.validate from module property /Users/Mort/Downloads/boost_1_74_0/tools/build/src/build/build-request.jam:271: in convert-command-line-element from module build-request /Users/Mort/Downloads/boost_1_74_0/tools/build/src/build/build-request.jam:222: in build-request.convert-command-line-elements from module build-request /Users/Mort/Downloads/boost_1_74_0/tools/build/src/build-system.jam:774: in load from module build-system /Users/Mort/Downloads/boost_1_74_0/tools/build/src/kernel/modules.jam:295: in import from module modules /Users/Mort/Downloads/boost_1_74_0/tools/build/src/kernel/bootstrap.jam:139: in boost-build from module /Users/Mort/Downloads/boost_1_74_0/boost-build.jam:17: in module scope from module *****END OUTPUT***** Either way, it seems like the ./b2 program doesn't recognize version 3.7, only 2.7. Let me know if you need any more information. Any help is greatly appreciated. Thanks, Mortimer On Thu, Sep 3, 2020 at 2:19 PM Mortimer Hemmit wrote: > > Hello, > > I am trying to build the Python library for Boost 1.74.0 on macOS > Catalina 10.15.8 with the default Clang 11.0.3. I also installed > Python 3.7.9 from python.org > > I am following the instructions located at > > and > > I untar the archive and then execute this command in the boost directory: > > ./bootstrap.sh --with-python=python3.7 --with-libraries=python > > This gives me output saying that it detected python 3.7. > > *****BEGIN OUTPUT***** > Building Boost.Build engine with toolset clang... tools/build/src/engine/b2 > Detecting Python version... 3.7 > Detecting Python root... /Library/Frameworks/Python.framework/Versions/3.7 > Unicode/ICU support for Boost.Regex?... not found. > Backing up existing Boost.Build configuration in project-config.jam.1 > Generating Boost.Build configuration in project-config.jam for clang... > > Bootstrapping is done. To build, run: > > ./b2 > > To generate header files, run: > > ./b2 headers > > To adjust configuration, edit 'project-config.jam'. > Further information: > > - Command line help: > ./b2 --help > > - Getting started guide: > http://www.boost.org/more/getting_started/unix-variants.html > > - Boost.Build documentation: > http://www.boost.org/build/ > *****END OUTPUT***** > > Then, I run > > sudo ./b2 --with-python > > However, when it builds the libraries, it saves it with a folder path > that has 2.7, and I get files such as libboost_python27.dylib. > > *****BEGIN OUTPUT***** > In file included from > /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include/numpy/ufuncobject.h:327: > *****END OUTPUT***** > > /System/Library is where the default macOS Python 2.7 is stored. > > How can I convince Boost to use the Python 3.7 that I installed, > instead of the default Python 2.7? It looked like it detected it in > bootstrap, but it doesn't use it later. Is the way that I specified > the desired python executable correct? > > Any help or guidance is greatly appreciated. > > Thank you, > Mortimer From stefan at seefeld.name Mon Sep 7 14:47:34 2020 From: stefan at seefeld.name (Stefan Seefeld) Date: Mon, 7 Sep 2020 14:47:34 -0400 Subject: [C++-sig] Boost Python Wrong Python Version macOS In-Reply-To: References: Message-ID: 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- 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 > 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=` will allow you to select one. Hope this helps, Stefan -- ...ich hab' noch einen Koffer in Berlin... -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: .signature.png Type: image/png Size: 2754 bytes Desc: not available URL: From ckim at etri.re.kr Wed Sep 9 05:08:16 2020 From: ckim at etri.re.kr (ckim at etri.re.kr) Date: Wed, 9 Sep 2020 18:08:16 +0900 Subject: [C++-sig] compiler error during boost.python tutorial (exposing class World), wrong number of template arguments Message-ID: <01d601d68688$c11150a0$4333f1e0$@etri.re.kr> Hello all, I was following the boost.python tutorial but have this compile error that I don't know how to solve. The compiler says I need 4 template parameters for the class exposing class_ definition, but I only have one. (the other three are optional, aren't they?) BOOST_PYTHON_MODULE(world_ext) { using namespace boost::python; class_("World") .def("greet", &World::greet) .def("set", &World::set) ; } I have asked the question on https://stackoverflow.com/questions/63803975/compile-error-during-boost-pyth on-tutorial-error-wrong-number-of-template-argu. If someone please tell me how to fix it, I would deeply appreciate it. Thank you. BTW, the tutorial is so old and doesn't fit with current boost code, and even the build method is different from the tutorial. For beginners to boost.python, it will take unnecessarily long to catch things. Chan Kim, Principal Research Member Processor Research Team, Intelligent Semiconductor Research ETRI(Electronics and Telecommunications Research Institute) O) +82-42-860-5773 C) +82-10-3418-9152 E) ckim at etri.re.kr -------------- next part -------------- An HTML attachment was scrubbed... URL: From mortimer.hemmit at gmail.com Thu Sep 10 21:24:20 2020 From: mortimer.hemmit at gmail.com (Mortimer Hemmit) Date: Thu, 10 Sep 2020 21:24:20 -0400 Subject: [C++-sig] Boost Python Wrong Python Version macOS In-Reply-To: References: Message-ID: 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 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- 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 > 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=` will allow you to select one. > > Hope this helps, > > -- > > ...ich hab' noch einen Koffer in Berlin... > > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig at python.org > https://mail.python.org/mailman/listinfo/cplusplus-sig From stefan at seefeld.name Fri Sep 11 09:47:14 2020 From: stefan at seefeld.name (stefan) Date: Fri, 11 Sep 2020 09:47:14 -0400 Subject: [C++-sig] Boost Python Wrong Python Version macOS In-Reply-To: References: Message-ID: <3f5c0985-a1a8-b6d8-c6b4-8c2f68219151@seefeld.name> 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 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- 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 >> 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=` will allow you to select one. >> >> Hope this helps, >> >> -- >> >> ...ich hab' noch einen Koffer in Berlin... >> >> _______________________________________________ >> Cplusplus-sig mailing list >> Cplusplus-sig at python.org >> https://mail.python.org/mailman/listinfo/cplusplus-sig > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig at python.org > https://mail.python.org/mailman/listinfo/cplusplus-sig Stefan -- ...ich hab' noch einen Koffer in Berlin... -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.png Type: image/png Size: 1478 bytes Desc: not available URL: