Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xattr/lib_build.h not found mac M1 install #6891

Closed
4 tasks done
GeeCastro opened this issue Oct 26, 2022 · 16 comments · Fixed by #7005
Closed
4 tasks done

xattr/lib_build.h not found mac M1 install #6891

GeeCastro opened this issue Oct 26, 2022 · 16 comments · Fixed by #7005
Labels
status/external-issue Issue is caused by external project (platform, dep, etc)

Comments

@GeeCastro
Copy link

GeeCastro commented Oct 26, 2022

Issue

The xattr/lib_build.h file doesn't exist. Could there be a problem with the dependencies?
The same problem with the following libraries:

  • flask
  • numy
  • onnx

but works with:

  • loguru
  • urllib3

So it clearly seems to be related to packages that require a build/compilation.

@GeeCastro GeeCastro added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 26, 2022
@dimbleby
Copy link
Contributor

looks like it's a problem simply with import xattr.

If you create a new virtual environment, pip install xattr and python -c "import xattr" (ie without using poetry at all) how does that go?

Perhaps we are learning that xattr has some system dependency that some users don't have.

If so, suggest that submitting a pull request putting a try-except near to

poetry/src/poetry/utils/env.py

Lines 1104 to 1110 in 1ec8be3

import xattr
xattr.setxattr(
str(path),
"com.apple.metadata:com_apple_backup_excludeItem",
plistlib.dumps("com.apple.backupd", fmt=plistlib.FMT_BINARY),
)
would be the way to go.

@GeeCastro
Copy link
Author

xattr doesn't seem to install the lib_build.h file it requires. I've opened an issue there

$ python -c "import xattr"
Traceback (most recent call last):
  File "/Users/gauthiercastro/.pyenv/versions/3.8.13/lib/python3.8/site-packages/xattr/lib.py", line 7, in <module>
    from ._lib import lib, ffi
ImportError: dlopen(/Users/gauthiercastro/.pyenv/versions/3.8.13/lib/python3.8/site-packages/_cffi_backend.cpython-38-darwin.so, 0x0002): Library not loaded: '@rpath/libffi.8.dylib'
  Referenced from: '/Users/gauthiercastro/.pyenv/versions/3.8.13/lib/python3.8/site-packages/_cffi_backend.cpython-38-darwin.so'
  Reason: tried: '/Users/gauthiercastro/miniconda3/envs/speccheck_eval/lib/libffi.8.dylib' (no such file), '/Users/gauthiercastro/miniconda3/envs/speccheck_eval/lib/libffi.8.dylib' (no such file), '/Users/gauthiercastro/miniconda3/envs/speccheck_eval/lib/libffi.8.dylib' (no such file), '/Users/gauthiercastro/miniconda3/envs/speccheck_eval/lib/libffi.8.dylib' (no such file), '/opt/homebrew/lib/libffi.8.dylib' (no such file), '/opt/homebrew/lib/libffi.8.dylib' (no such file), '/opt/homebrew/lib/libffi.8.dylib' (no such file), '/opt/homebrew/lib/libffi.8.dylib' (no such file), '/opt/homebrew/lib/libffi.8.dylib' (no such file), '/opt/homebrew/lib/libffi.8.dylib' (no such file), '/usr/local/lib/libffi.8.dylib' (no such file), '/usr/lib/libffi.8.dylib' (no such file)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/gauthiercastro/.pyenv/versions/3.8.13/lib/python3.8/site-packages/xattr/__init__.py", line 13, in <module>
    from .lib import (XATTR_NOFOLLOW, XATTR_CREATE, XATTR_REPLACE,
  File "/Users/gauthiercastro/.pyenv/versions/3.8.13/lib/python3.8/site-packages/xattr/lib.py", line 9, in <module>
    from .lib_build import ffi, c_source
  File "/Users/gauthiercastro/.pyenv/versions/3.8.13/lib/python3.8/site-packages/xattr/lib_build.py", line 7, in <module>
    with open(os.path.join(PATH, 'lib_build.h')) as hf:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/gauthiercastro/.pyenv/versions/3.8.13/lib/python3.8/site-packages/xattr/lib_build.h'

@GeeCastro
Copy link
Author

I have uninstalled/re-installed both pyenv and poetry. Everything and got it to work. Not quite sure what is the issue... My new environments don't seem to have xattr at all. 🤷

@dimbleby
Copy link
Contributor

I see that xattr say that it's a problem with your environment, and that would seem to be consistent with "well it works now".

Anyway it seems you got far enough to prove that if this was anyone's problem it was an xattr problem and not a poetry problem: so I guess this should be closed out.

Secrus added a commit that referenced this issue Nov 11, 2022
# Pull Request Check List

Resolves: #6928 

<!-- This is just a reminder about the most common mistakes. Please make
sure that you tick all *appropriate* boxes. But please read our
[contribution guide](https://python-poetry.org/docs/contributing/) at
least once, it will save you unnecessary review cycles! -->

- [ ] Added **tests** for changed code.
- [ ] Updated **documentation** for changed code.

<!-- If you have *any* questions to *any* of the points above, just
**submit and ask**! This checklist is here to *help* you, not to deter
you from contributing! -->

Bump `xattr` version to `0.10.0`.

This fixes #6891, which is not a problem with the user's environment as
suggested by the maintainer of xattr at xattr/xattr#108, but in fact the
problem of the package which was fixed by xattr/xattr#106.

Looking at the [changes in the version
bump](xattr/xattr@v0.9.9...v0.10.0), there
does not seem to be any significant changes other than shabang
xattr/xattr#106.

Co-authored-by: Moonsik Park <[email protected]>
Co-authored-by: Bartosz Sokorski <[email protected]>
moonsikpark added a commit to moonsikpark/poetry that referenced this issue Nov 15, 2022
update lockfile.

pip install --no-input everywhere (python-poetry#6966)

This is an extension of
python-poetry#6724. I think `pip install`
invoked by poetry should never ask for user input.

Motivation is that it happened to myself and a number of colleagues many
times that poetry got seemingly stuck while it was just waiting for a
user input because of a private pypi repository that needed
authentication.

I hope this is a valuable contribution to a tool I like a lot and would
like to use more and more :)

docs: update Windows cache path to match 1.2

Bump `xattr` version to `0.10.0`. (python-poetry#7005)

Resolves: python-poetry#6928

<!-- This is just a reminder about the most common mistakes. Please make
sure that you tick all *appropriate* boxes. But please read our
[contribution guide](https://python-poetry.org/docs/contributing/) at
least once, it will save you unnecessary review cycles! -->

- [ ] Added **tests** for changed code.
- [ ] Updated **documentation** for changed code.

<!-- If you have *any* questions to *any* of the points above, just
**submit and ask**! This checklist is here to *help* you, not to deter
you from contributing! -->

Bump `xattr` version to `0.10.0`.

This fixes python-poetry#6891, which is not a problem with the user's environment as
suggested by the maintainer of xattr at xattr/xattr#108, but in fact the
problem of the package which was fixed by xattr/xattr#106.

Looking at the [changes in the version
bump](xattr/xattr@v0.9.9...v0.10.0), there
does not seem to be any significant changes other than shabang
xattr/xattr#106.

Co-authored-by: Moonsik Park <[email protected]>
Co-authored-by: Bartosz Sokorski <[email protected]>

tests: add coverage to `poetry install`

update lockfile.

[pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/asottile/pyupgrade: v3.2.0 → v3.2.2](asottile/pyupgrade@v3.2.0...v3.2.2)
- [github.com/hadialqattan/pycln: v2.1.1 → v2.1.2](hadialqattan/pycln@v2.1.1...v2.1.2)
moonsikpark added a commit to moonsikpark/poetry that referenced this issue Nov 15, 2022
update lockfile.

pip install --no-input everywhere (python-poetry#6966)

This is an extension of
python-poetry#6724. I think `pip install`
invoked by poetry should never ask for user input.

Motivation is that it happened to myself and a number of colleagues many
times that poetry got seemingly stuck while it was just waiting for a
user input because of a private pypi repository that needed
authentication.

I hope this is a valuable contribution to a tool I like a lot and would
like to use more and more :)

docs: update Windows cache path to match 1.2

Bump `xattr` version to `0.10.0`. (python-poetry#7005)

Resolves: python-poetry#6928

<!-- This is just a reminder about the most common mistakes. Please make
sure that you tick all *appropriate* boxes. But please read our
[contribution guide](https://python-poetry.org/docs/contributing/) at
least once, it will save you unnecessary review cycles! -->

- [ ] Added **tests** for changed code.
- [ ] Updated **documentation** for changed code.

<!-- If you have *any* questions to *any* of the points above, just
**submit and ask**! This checklist is here to *help* you, not to deter
you from contributing! -->

Bump `xattr` version to `0.10.0`.

This fixes python-poetry#6891, which is not a problem with the user's environment as
suggested by the maintainer of xattr at xattr/xattr#108, but in fact the
problem of the package which was fixed by xattr/xattr#106.

Looking at the [changes in the version
bump](xattr/xattr@v0.9.9...v0.10.0), there
does not seem to be any significant changes other than shabang
xattr/xattr#106.

Co-authored-by: Moonsik Park <[email protected]>
Co-authored-by: Bartosz Sokorski <[email protected]>

tests: add coverage to `poetry install`

update lockfile.

[pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/asottile/pyupgrade: v3.2.0 → v3.2.2](asottile/pyupgrade@v3.2.0...v3.2.2)
- [github.com/hadialqattan/pycln: v2.1.1 → v2.1.2](hadialqattan/pycln@v2.1.1...v2.1.2)
moonsikpark added a commit to moonsikpark/poetry that referenced this issue Nov 15, 2022
update lockfile.

pip install --no-input everywhere (python-poetry#6966)

This is an extension of
python-poetry#6724. I think `pip install`
invoked by poetry should never ask for user input.

Motivation is that it happened to myself and a number of colleagues many
times that poetry got seemingly stuck while it was just waiting for a
user input because of a private pypi repository that needed
authentication.

I hope this is a valuable contribution to a tool I like a lot and would
like to use more and more :)

docs: update Windows cache path to match 1.2

Bump `xattr` version to `0.10.0`. (python-poetry#7005)

Resolves: python-poetry#6928

<!-- This is just a reminder about the most common mistakes. Please make
sure that you tick all *appropriate* boxes. But please read our
[contribution guide](https://python-poetry.org/docs/contributing/) at
least once, it will save you unnecessary review cycles! -->

- [ ] Added **tests** for changed code.
- [ ] Updated **documentation** for changed code.

<!-- If you have *any* questions to *any* of the points above, just
**submit and ask**! This checklist is here to *help* you, not to deter
you from contributing! -->

Bump `xattr` version to `0.10.0`.

This fixes python-poetry#6891, which is not a problem with the user's environment as
suggested by the maintainer of xattr at xattr/xattr#108, but in fact the
problem of the package which was fixed by xattr/xattr#106.

Looking at the [changes in the version
bump](xattr/xattr@v0.9.9...v0.10.0), there
does not seem to be any significant changes other than shabang
xattr/xattr#106.

Co-authored-by: Moonsik Park <[email protected]>
Co-authored-by: Bartosz Sokorski <[email protected]>

tests: add coverage to `poetry install`

update lockfile.

[pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/asottile/pyupgrade: v3.2.0 → v3.2.2](asottile/pyupgrade@v3.2.0...v3.2.2)
- [github.com/hadialqattan/pycln: v2.1.1 → v2.1.2](hadialqattan/pycln@v2.1.1...v2.1.2)

update lockfile.

update lockfile.
@MBARIMike
Copy link

I did the following on my Intel Mac which seems to get around this problem:

pip uninstall xattr
pip install xattr

@neersighted neersighted added status/external-issue Issue is caused by external project (platform, dep, etc) and removed kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Dec 8, 2022
@rec
Copy link

rec commented Jan 5, 2023

I encountered the same issue on an M1 Mac with a fairly recently installation of Poetry.

Reinstalling xattr within the poetry venv did not fix it (it doesn't seem to install that header file at all, in fact).

Uninstalling and reinstalling poetry (as per https://python-poetry.org/docs/) got everything working.

Thanks for your hard work on this excellent package!

@tduque-beon
Copy link

I've just rerun the code to install poetry and it fixed.

From official docs:

curl -sSL https://install.python-poetry.org | python3 -

@phdowling
Copy link

I am using python 3.12 on an M2 MBA (Sonoma) and still regularly getting this issue. I tried lots of things to no avail, including:

  • using brew installed python3.12, uninstall poetry then reinstall using the same command as @tduque-beon
  • removing brew python, installing via pyenv, reinstalling poetry with that command
  • install poetry via pip

Steps to reproduce:

  • nuke everything, then:
  • brew install pyenv and set up PATH, shims, etc. as per official instructions
  • pyenv install 3.12
  • pyenv global 3.12
  • curl -sSL https://install.python-poetry.org | python3 -
  • mkdir my_project && cd my_project
  • poetry init and specify e.g. onnx as a depencency
  • poetry install -> fails:
  FileNotFoundError

  [Errno 2] No such file or directory: '/Users/dowling/Library/Application Support/pypoetry/venv/lib/python3.12/site-packages/xattr/lib_build.h'

  at ~/Library/Application Support/pypoetry/venv/lib/python3.12/site-packages/xattr/lib_build.py:7 in <module>
        3│ from cffi import FFI
        4│ 
        5│ PATH = os.path.dirname(__file__)
        6│ 
    →   7│ with open(os.path.join(PATH, 'lib_build.h')) as hf:
        8│     c_header = hf.read()
        9│ with open(os.path.join(PATH, 'lib_build.c')) as cf:
       10│     c_source = cf.read()
       11│ 

Cannot install onnx.

I also tried install poetry via pip install poetry with the above, seems to have made no difference. My installation is not completely broken, but there are some packages where this fails. fastapi, flask, numpy actually seem to work for me, but e.g. onnx and sentencepiece break.

@samuelchrist
Copy link

samuelchrist commented Nov 20, 2023

I am using poetry on M1 mac os Sonoma. Tried reinstalling poetry, xattr, cffi as well as my entire python environment but python -c "import xattr" still fails:

I am using xattr 0.10.1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/user/Library/Caches/pypoetry/virtualenvs/venv/lib/python3.8/site-packages/xattr/__init__.py", line 13, in <module>
    from .lib import (XATTR_NOFOLLOW, XATTR_CREATE, XATTR_REPLACE,
  File "/Users/user/Library/Caches/pypoetry/virtualenvs/venv/lib/python3.8/site-packages/xattr/lib.py", line 9, in <module>
    from .lib_build import ffi, c_source
  File "/Users/user/Library/Caches/pypoetry/virtualenvs/venv/lib/python3.8/site-packages/xattr/lib_build.py", line 7, in <module>
    with open(os.path.join(PATH, 'lib_build.h')) as hf:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/user/Library/Caches/pypoetry/virtualenvs/venv/lib/python3.8/site-packages/xattr/lib_build.h'

Please help

To recreate this

  1. install pyenv using homebrew.
  2. Install python 3.8.17 in pyenv.
  3. Set python 3.8.17 in pyenv as global.
  4. then install poetry 1.2.0 using python 3.8.17 in pyenv.
  5. Try doing poetry add flaml==1.0.8 or install any other package using poetry

I have raised an issue on xattr but it was mentioned the poetry may be the issue. Please help.

@samuelchrist
Copy link

samuelchrist commented Nov 20, 2023

I tried reinstalling poetry, pyenv, creating new env, install poetry using pipx, poetry install using script, pip install etc. Nothing worked

@phdowling
Copy link

xattr just got an new release (7 hours ago as of right now), I'll try to check if that fixes things for me later, but maybe it helps someone here in the mean time.

@samuelchrist
Copy link

@phdowling let us know if new xattr fixed your issue. I am unable to install it

@nholbanremedy
Copy link

Sonoma, M1
Initially I've tried to install poetry with python3.12 that in my case resulted in the error above. Installing poetry with python3.10 via pyenv solved my issue

Commands(considering pyenv installed):

curl -sSL https://install.python-poetry.org | python3 - --uninstall
pyenv install --skip-existing 3.10
pyenv local 3.10
curl -sSL https://install.python-poetry.org | python3 -

In case you want to create poetry environment with python3.10

poetry env use 3.10

In case you want to create poetry environment with python3.12

pyenv local 3.12
poetry env use 3.12

@ryan-williams
Copy link

I believe I was seeing this while switching between Python versions (e.g. 3.8 and 3.11) in a project, and re-running poetry install.

I needed to re-run poetry lock after switching Python versions, before running poetry install, otherwise I was e.g. in Python 3.11 trying to install dependency versions that only work in lower versions of Python.

I'm not 100% sure that's the whole story, as I believe I originally tried poetry lock && poetry install after switching Python versions, and it didn't fix the error, but eventually that seemed to fix the issue. It's possible I was messing something else up when I originally tried it.

@yeszao
Copy link

yeszao commented Jan 2, 2024

@MBARIMike saved me.
I got this error after re-install:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
poetry 1.7.1 requires xattr<0.11.0,>=0.10.0; sys_platform == "darwin", but you have xattr 1.0.0 which is incompatible.

so I did this and success:

pip3 uninstall xattr
pip3 install xattr==0.10.1

Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/external-issue Issue is caused by external project (platform, dep, etc)
Projects
None yet
Development

Successfully merging a pull request may close this issue.