martinthomson / i-d-template

A template for IETF internet draft git repositories
Other
207 stars 182 forks source link

Wrong lxml being installed on osx (apple silicon) #368

Closed mnot closed 1 year ago

mnot commented 1 year ago

Hmm, the second issue in #350 just resurfaced:

Traceback (most recent call last):
  File "/Users/mnot/Projects/I-D/lib/.venv/bin/xml2rfc", line 5, in <module>
    from xml2rfc.run import main
  File "/Users/mnot/Projects/I-D/lib/.venv/lib/python3.10/site-packages/xml2rfc/__init__.py", line 14, in <module>
    from xml2rfc.parser import  XmlRfcError, CachingResolver, XmlRfcParser, XmlRfc
  File "/Users/mnot/Projects/I-D/lib/.venv/lib/python3.10/site-packages/xml2rfc/parser.py", line 10, in <module>
    import lxml.etree
ImportError: dlopen(/Users/mnot/Projects/I-D/lib/.venv/lib/python3.10/site-packages/lxml/etree.cpython-310-darwin.so, 0x0002): tried: '/Users/mnot/Projects/I-D/lib/.venv/lib/python3.10/site-packages/lxml/etree.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/mnot/Projects/I-D/lib/.venv/lib/python3.10/site-packages/lxml/etree.cpython-310-darwin.so' (no such file), '/Users/mnot/Projects/I-D/lib/.venv/lib/python3.10/site-packages/lxml/etree.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

That's after a make update; make clean; make clean-venv. Earlier in that was;

Collecting lxml
  Using cached lxml-4.9.2-cp310-cp310-macosx_13_0_arm64.whl

Interestingly, that wheel is not on pypi, so something is going on here. Need to dig.

martinthomson commented 1 year ago

Yeah, the arm64 whl is not listed on pypi, though an x86 version is. 4.9.1 lists neither. If you work out that this is something we can work around, then I'm happy to add haxx as necessary, but I don't have Apple silicon to debug with.

mnot commented 1 year ago

FWIW - I did a brew upgrade; no help.

Then, I did a pip cache purge; make clean; make clean-venv and that seemed to do the trick.

Something transient in the wheels being served, perhaps?

martinthomson commented 1 year ago

Do you think it would help if I added pip cache purge to make clean-deps? This seems like a bit of an odd problem to have, but if it has happened twice, that's almost a pattern.

mnot commented 1 year ago

Yeah, nah - that has a system-wide effect, where everything else is local.

pip help cache tells me:

--no-cache-dir Disable the cache.

which maybe appropriate at some point.

martinthomson commented 1 year ago

I've made a few changes that should at least open an option for people who have trouble. If you run into problems with installations, you can pass DISABLE_CACHE=true to any of the make commands and - for those that support it - any existing cache will not be used. So far, I've done this for xml2rfc (a pain), kramdown-rfc (this will save to the cache, but not read from it), pip (--no-cache-dir), and bundle (install --no-cache, update --all). npm installs already avoid caching.

This won't work automatically, but I don't know how to do that without making things slow in the normal case.

mnot commented 1 year ago

Fair enough. I was thinking of disabling cache when creating a venv (etc.), as that's a fairly rare operation, but that works.

About to fly...