[pypy-issue] Issue #2633: Cannot import BeautifulSoup from bs4 on pypy3 5.8.0 (pypy/pypy)

Nick Malaguti issues-reply at bitbucket.org
Tue Aug 15 11:14:21 EDT 2017

New issue 2633: Cannot import BeautifulSoup from bs4 on pypy3 5.8.0

Nick Malaguti:

$ docker run -it pypy:3-5.8.0 bash
root at 11a1fb75b382:/# pip install beautifulsoup4
Collecting beautifulsoup4
  Downloading beautifulsoup4-4.6.0-py3-none-any.whl (86kB)
    100% |████████████████████████████████| 92kB 2.2MB/s
Installing collected packages: beautifulsoup4
Successfully installed beautifulsoup4-4.6.0
root at 11a1fb75b382:/# pip install lxml
Collecting lxml
  Downloading lxml-3.8.0.tar.gz (3.8MB)
    100% |████████████████████████████████| 3.8MB 254kB/s
Building wheels for collected packages: lxml
  Running setup.py bdist_wheel for lxml ... done
  Stored in directory: /root/.cache/pip/wheels/e2/52/c3/a7b7aa7dc1294d715fa6eb49d5c63e0d9713652fcc6a609857
Successfully built lxml
Installing collected packages: lxml
Successfully installed lxml-3.8.0
root at 11a1fb75b382:/# pypy3
Python 3.5.3 (a39af0be3a22, Jun 05 2017, 20:18:00)
[PyPy 5.8.0-beta0 with GCC 6.2.0 20160901] on linux
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``"ah, just in time documentation"
>>>> from bs4 import BeautifulSoup
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/site-packages/bs4/__init__.py", line 35, in <module>
    from .builder import builder_registry, ParserRejectedMarkup
  File "/usr/local/site-packages/bs4/builder/__init__.py", line 329, in <module>
    from . import _lxml
  File "/usr/local/site-packages/bs4/builder/_lxml.py", line 11, in <module>
    from lxml import etree
  File "src/lxml/xmlschema.pxi", line 22, in init lxml.etree (src/lxml/lxml.etree.c:231895)
  File "src/lxml/xpath.pxi", line 420, in lxml.etree.XPath.__init__ (src/lxml/lxml.etree.c:173999)
  File "src/lxml/xpath.pxi", line 150, in lxml.etree._XPathEvaluatorBase.set_context (src/lxml/lxml.etree.c:170398)
  File "src/lxml/xpath.pxi", line 66, in lxml.etree._XPathContext.set_context (src/lxml/lxml.etree.c:169176)
  File "src/lxml/extensions.pxi", line 255, in lxml.etree._BaseContext.registerLocalFunctions (src/lxml/lxml.etree.c:160400)
AttributeError: 'dict' object has no attribute 'iteritems'

There is a similar issue #2498 that involved Cython.

More information about the pypy-issue mailing list