This morning I decided to make the big switch to Python 3.0 on my Gentoo Laptop. I have been avoiding it since there are some changes to 3.0 that are not backwards compatible with scripts and tool written in 2.6. The emerge of Python 3.0 went fine but I had some issues with beauitfulsoup which is a python dependency in many tools including fast-track which is a great tool written by my friend Dave Kennedy (ReL1k). As always if you have any questions regarding this or any other issues please make a post in the Question section of the site.
As soon as i tried to emerge Python 3.0, emerge let me know that it needed a masked version of beautifulsoup so I went ahead and added it to my keywords file
pwnsauce ~ # echo “dev-python/beautifulsoup” >> /etc/portage/package.keywords
So here is the first small issue I ran into:
r00t@pwnsauce ~ $ sudo emerge -avuDN world
These are the packages that would be merged, in order:
Calculating dependencies… done!
[ebuild NS ] dev-python/beautifulsoup-3.1.0.1-r1 [3.0.7, 3.0.8] 0 kB
[uninstall ] dev-python/beautifulsoup-3.0.7
[blocks b ] dev-python/beautifulsoup:0 (“dev-python/beautifulsoup:0” is blocking dev-python/beautifulsoup-3.1.0.1-r1)
Total: 1 package (1 in new slot, 1 uninstall), Size of downloads: 0 kB
Conflicts: 1 block
This is reall no big deal. all we need to do for this is:
r00t@pwnsauce ~ $ sudo emerge -C =dev-python/beautifulsoup-3.0.7
dev-python/beautifulsoup
selected: 3.0.7
protected: none
omitted: 3.0.8
>>> ‘Selected’ packages are slated for removal.
>>> ‘Protected’ and ‘omitted’ packages will not be removed.
>>> Waiting 5 seconds before starting…
>>> (Control-C to abort)…
>>> Unmerging in: 5 4 3 2 1
>>> Unmerging dev-python/beautifulsoup-3.0.7…
* GNU info directory index is up-to-date.
So now what we do is to go ahead emerge beautiful soup:
r00t@pwnsauce ~ $ sudo emerge dev-python/beautifulsoup
Calculating dependencies… done!
>>> Verifying ebuild manifests
>>> Emerging (1 of 1) dev-python/beautifulsoup-3.1.0.1-r1
* BeautifulSoup-3.1.0.1.tar.gz RMD160 SHA1 SHA256 size ;-) … [ ok ]
* checking ebuild checksums ;-) … [ ok ]
* checking auxfile checksums ;-) … [ ok ]
* checking miscfile checksums ;-) … [ ok ]
* CPV: dev-python/beautifulsoup-3.1.0.1-r1
* REPO: gentoo
* USE: elibc_glibc kernel_linux userland_GNU x86
>>> Unpacking source…
>>> Unpacking BeautifulSoup-3.1.0.1.tar.gz to /var/tmp/portage/dev-python/beautifulsoup-3.1.0.1-r1/work
>>> Source unpacked in /var/tmp/portage/dev-python/beautifulsoup-3.1.0.1-r1/work
>>> Preparing source in /var/tmp/portage/dev-python/beautifulsoup-3.1.0.1-r1/work/BeautifulSoup-3.1.0.1 …
* Applying beautifulsoup-3.1.0.1-python-3.patch … [ ok ]
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-python/beautifulsoup-3.1.0.1-r1/work/BeautifulSoup-3.1.0.1 …
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-python/beautifulsoup-3.1.0.1-r1/work/BeautifulSoup-3.1.0.1 …
* Python wrapper is configured incorrectly or /usr/bin/python2 or /usr/bin/python3 symlink
* is set incorrectly. Use `eselect python` to fix configuration.
* ERROR: dev-python/beautifulsoup-3.1.0.1-r1 failed:
* Incorrect configuration of Python
*
* Call stack:
* ebuild.sh, line 61: Called src_compile
* environment, line 3173: Called distutils_src_compile
* environment, line 735: Called python_execute_function ‘building’
* environment, line 2751: Called validate_PYTHON_ABIS
* environment, line 3815: Called die
* The specific snippet of code:
* die “Incorrect configuration of Python”;
*
* If you need support, post the output of ’emerge –info =dev-python/beautifulsoup-3.1.0.1-r1′,
* the complete build log and the output of ’emerge -pqv =dev-python/beautifulsoup-3.1.0.1-r1′.
* The complete build log is located at ‘/var/tmp/portage/dev-python/beautifulsoup-3.1.0.1-r1/temp/build.log’.
* The ebuild environment file is located at ‘/var/tmp/portage/dev-python/beautifulsoup-3.1.0.1-r1/temp/environment’.
* S: ‘/var/tmp/portage/dev-python/beautifulsoup-3.1.0.1-r1/work/BeautifulSoup-3.1.0.1’
>>> Failed to emerge dev-python/beautifulsoup-3.1.0.1-r1, Log file:
>>> ‘/var/tmp/portage/dev-python/beautifulsoup-3.1.0.1-r1/temp/build.log’
* Messages for package dev-python/beautifulsoup-3.1.0.1-r1:
* Python wrapper is configured incorrectly or /usr/bin/python2 or /usr/bin/python3 symlink
* is set incorrectly. Use `eselect python` to fix configuration.
* ERROR: dev-python/beautifulsoup-3.1.0.1-r1 failed:
* Incorrect configuration of Python
*
* Call stack:
* ebuild.sh, line 61: Called src_compile
* environment, line 3173: Called distutils_src_compile
* environment, line 735: Called python_execute_function ‘building’
* environment, line 2751: Called validate_PYTHON_ABIS
* environment, line 3815: Called die
* The specific snippet of code:
* die “Incorrect configuration of Python”;
*
* If you need support, post the output of ’emerge –info =dev-python/beautifulsoup-3.1.0.1-r1′,
* the complete build log and the output of ’emerge -pqv =dev-python/beautifulsoup-3.1.0.1-r1′.
* The complete build log is located at ‘/var/tmp/portage/dev-python/beautifulsoup-3.1.0.1-r1/temp/build.log’.
* The ebuild environment file is located at ‘/var/tmp/portage/dev-python/beautifulsoup-3.1.0.1-r1/temp/environment’.
* S: ‘/var/tmp/portage/dev-python/beautifulsoup-3.1.0.1-r1/work/BeautifulSoup-3.1.0.1’
* GNU info directory index is up-to-date.
The problem here is a Gentoo specific issue. What has happened is that the system doesn’t know its supposed to be using the new Python interpreter. The system is still using 2.6 but since we keyworded the newest version of beutifulsoup it needs Python 3.0. to build.
Its easy to check which Python system your using with eselect:
r00t@pwnsauce ~ $ sudo eselect python list
Available python interpreters:
[1] python2.6 *
[2] python3.1
Looks like we are still using 2.6 like we thought so all we need to do is use eselect to choose the one we want.
r00t@pwnsauce ~ $ sudo eselect python set 2
r00t@pwnsauce ~ $ sudo eselect python list
Available python interpreters:
[1] python2.6
[2] python3.1 *
After we do this beautifulsoup should build fine.