poetry icon indicating copy to clipboard operation
poetry copied to clipboard

Poetry cannot choose orjson wheel for M1 macos

Open pszpetkowski opened this issue 3 years ago • 2 comments

  • Poetry version: 1.2.1
  • Python version: 3.10.6
  • OS version and name: macOS 12.5
  • pyproject.toml: https://gist.github.com/pszpetkowski/f7fc2ababaf0580847b0286d20110f94
  • [x] I am on the latest stable Poetry version, installed using a recommended method.
  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x] I have consulted the FAQ and blog for any relevant entries or release notes.
  • [x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

Poetry is unable to choose the orjson wheel for M1 macos i.e. https://files.pythonhosted.org/packages/74/71/5024229c3e6ca20ba069fd4428e322c3e038a881320491e7b9fe98a2df88/orjson-3.8.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl when orjson 3.8 is specified in pyproject.toml dependencies, and instead goes for the plain tar.gz (https://files.pythonhosted.org/packages/0a/de/282b8ca582b63e39e9ef7069c47c7be617d201e47ae435da851f7ffe61d1/orjson-3.8.0.tar.gz) and tries to build it.

Meanwhile if installed with pip, the proper wheel (URL mentioned above) is used:

$ python3 -m pip install orjson
Collecting orjson
  Downloading orjson-3.8.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (483 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 483.2/483.2 kB 8.2 MB/s eta 0:00:00
Installing collected packages: orjson
Successfully installed orjson-3.8.0

pszpetkowski avatar Sep 20 '22 12:09 pszpetkowski

is this during installation, or during locking? does poetry lock succeed?

if no then this is resolved by #6547

dimbleby avatar Sep 20 '22 12:09 dimbleby

This happens during installation, I'm currently unable to verify if poetry lock works.

Tomorrow I'll test the latest master of poetry to find out if #6547 fixed the issue.

pszpetkowski avatar Sep 20 '22 15:09 pszpetkowski

Did you solve the problem? I have the same issue now.

qhuang0411 avatar Oct 04 '22 16:10 qhuang0411

Nope and unfortunately I cannot install poetry from commit in my environment and will have to wait for the next release to verify if it still occurs.

pszpetkowski avatar Oct 05 '22 03:10 pszpetkowski

since neither of you has provided any output showing either what you are doing or what the result is, it's going to be hard for anyone to offer any help

dimbleby avatar Oct 05 '22 08:10 dimbleby

I'm unable to reproduce this on a M1 mac using Poetry 1.2.1. When I install using the pyproject provided or poetry add orjson, I end up with orjson-3.8.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl as expected.

I suspect this issue is external to Poetry -- maybe your Python is not reporting the correct compatible tags. python -m pip install packaging; python3 -c 'import packaging.tags; list(packaging.tags.compatible_tags())' may be informative if you run it with your problematic Python; however, as I cannot reproduce this in a clean macOS VM with a Homebrew-built Python, I am closing this for now.

If you can reproduce this, the output of the above command plus details on how your Python is built/installed will be necessary.

neersighted avatar Oct 05 '22 13:10 neersighted

Different hardware (pc) and different software (Ubuntu) and had very same issue, in my case it was cache of poetry that got garbled somehow. I just went to $HOM/.cache/pypoetry found an existing (and cached) orsjon and nuked it out of this planet, after that poetry add worked just fine.

Drachenfels avatar Jan 18 '23 15:01 Drachenfels

poetry add orjson

this gives error and no installation done

• Installing orjson (3.8.5): Failed

CalledProcessError 

Command '['/venv/bin/python', '-m', 'pip', 'install', '--disable-pip-version-check', '--isolated', '--no-input', '--prefix', '/venv', '--no-deps', '/home/.cache/pypoetry/artifacts/d3/e7/5a/d917a8adba1c2617ef5c67ddd5aab133e6df329301662da55d71fd0331/orjson-3.8.5-cp38-cp38-manylinux_2_28_x86_64.whl']' returned non-zero exit status 1.

repeats similar multiple times and

at /usr/lib/python3.8/subprocess.py:516 in run
       512│             # We don't call process.wait() as .__exit__ does that for us.
       513│             raise
       514│         retcode = process.poll()
       515│         if check and retcode:
    →  516│             raise CalledProcessError(retcode, process.args,
       517│                                      output=stdout, stderr=stderr)
       518│     return CompletedProcess(process.args, retcode, stdout, stderr)
       519│ 
       520│ 

The following error occurred when trying to handle this error: EnvCommandError

Command ['/venv/bin/python', '-m', 'pip', 'install', '--disable-pip-version-check', '--isolated', '--no-input', '--prefix', '/venv', '--no-deps', '/home/.cache/pypoetry/artifacts/d3/e7/5a/d917a8adba1c2617ef5c67ddd5aab133e6df329301662da55d71fd0331/orjson-3.8.5-cp38-cp38-manylinux_2_28_x86_64.whl'] errored with the following return code 1, and output: ERROR: orjson-3.8.5-cp38-cp38-manylinux_2_28_x86_64.whl is not a supported wheel on this platform.

and finally goes to

The following error occurred when trying to handle this error:
  PoetryException

Failed to install /home/reminiz/.cache/pypoetry/artifacts/d3/e7/5a/d917a8adba1c2617ef5c67ddd5aab133e6df329301662da55d71fd0331/orjson-3.8.5-cp38-cp38-manylinux_2_28_x86_64.whl

  at venv/lib/python3.8/site-packages/poetry/utils/pip.py:58 in pip_install
       54│ 
       55│     try:
       56│         return environment.run_pip(*args)
       57│     except EnvCommandError as e:
    →  58│         raise PoetryException(f"Failed to install {path.as_posix()}") from e
       59│ 

kabartay avatar Jan 24 '23 08:01 kabartay

That's a partial duplicate of #7161, and is caused by pip not having updated their vendored dependencies yet. There's not a great workaround yet, please see that issue for details.

neersighted avatar Jan 24 '23 15:01 neersighted

https://github.com/python-poetry/poetry/issues/7177#issuecomment-1346937017, upgrade your pip

dimbleby avatar Jan 24 '23 15:01 dimbleby

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Feb 29 '24 20:02 github-actions[bot]