poetry icon indicating copy to clipboard operation
poetry copied to clipboard

Can't able to install line-profiler in my Mac M1

Open Ariz-z opened this issue 4 years ago • 4 comments

I am on the latest Poetry version.

I have searched the issues of this repo and believe that this is not a duplicate.

If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

System Platform: darwin OS: posix Python: 3.10.1 Poetry version: 1.2.2

The contents of your pyproject.toml file: ``[tool.poetry.dependencies] python = ">=3.10,<3.11" discord = "^1.0.1" motor = "^2.4.0" umongo = "3.0.0b8" colorthief = "^0.2.1" dnspython = "^2.1.0" Quart = "^0.15.1" parsedatetime = "^2.6" Quart-CORS = "^0.5.0" imgurpython = "^1.1.7" python-dateutil = "^2.8.1" numpy = "^1.20.3" environs = "^9.3.2" uvloop = {version = "^0.16.0", platform = "linux"} ujson = "^5.2.0" redis = "^4.3.3" jishaku = "^2.5.1" easy-pil = "^0.1.9" pilmoji = {git = "https://github.com/jay3332/pilmoji", rev = "2.0"} emojis = "^0.6.0" aiocache = {extras = ["msgpack"], version = "^0.11.1"} hikari = "2.0.0.dev108" fastapi = "^0.79.1" uvicorn = {extras = ["standard"], version = "^0.18.2"} "discord.py" = "^2.0.0" Augmentor = "^0.2.10" Unidecode = "^1.3.4"

[tool.poetry.dev-dependencies] black = "^22.3.0" autopep8 = "^1.6.0"

[build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api"``

#Issue

I am just running poetry install in my Mac M1 and i am getting this error


  • Installing line-profiler (4.0.1): Failed

  CalledProcessError

  Command '['/var/root/Library/Caches/pypoetry/virtualenvs/pokemon-f1Y_BWa2-py3.10/bin/python', '-m', 'pip', 'install', '--use-pep517', '--disable-pip-version-check', '--prefix', '/var/root/Library/Caches/pypoetry/virtualenvs/pokemon-f1Y_BWa2-py3.10', '--no-deps', '/var/root/Library/Caches/pypoetry/artifacts/0d/f5/be/eaf61cb56c3272053c2ffba0da815220dae2e8736f7bb3fa871e737756/line_profiler-4.0.1.tar.gz']' returned non-zero exit status 1.

  at /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py:524 in run
       520│             # We don't call process.wait() as .__exit__ does that for us.
       521│             raise
       522│         retcode = process.poll()
       523│         if check and retcode:
    →  524│             raise CalledProcessError(retcode, process.args,
       525│                                      output=stdout, stderr=stderr)
       526│     return CompletedProcess(process.args, retcode, stdout, stderr)
       527│ 
       528│ 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['/var/root/Library/Caches/pypoetry/virtualenvs/pokemon-f1Y_BWa2-py3.10/bin/python', '-m', 'pip', 'install', '--use-pep517', '--disable-pip-version-check', '--prefix', '/var/root/Library/Caches/pypoetry/virtualenvs/pokemon-f1Y_BWa2-py3.10', '--no-deps', '/var/root/Library/Caches/pypoetry/artifacts/0d/f5/be/eaf61cb56c3272053c2ffba0da815220dae2e8736f7bb3fa871e737756/line_profiler-4.0.1.tar.gz'] errored with the following return code 1, and output: 
  Processing /var/root/Library/Caches/pypoetry/artifacts/0d/f5/be/eaf61cb56c3272053c2ffba0da815220dae2e8736f7bb3fa871e737756/line_profiler-4.0.1.tar.gz
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
    Installing backend dependencies: started
    Installing backend dependencies: finished with status 'done'
    Preparing metadata (pyproject.toml): started
    Preparing metadata (pyproject.toml): finished with status 'done'
  Building wheels for collected packages: line-profiler
    Building wheel for line-profiler (pyproject.toml): started
    Building wheel for line-profiler (pyproject.toml): finished with status 'error'
    error: subprocess-exited-with-error
    
    × Building wheel for line-profiler (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> [20 lines of output]
        running bdist_wheel
        running build
        running build_py
        file line_profiler.py (for module line_profiler) not found
        creating build
        creating build/lib.macosx-10.9-universal2-cpython-310
        copying kernprof.py -> build/lib.macosx-10.9-universal2-cpython-310
        creating build/lib.macosx-10.9-universal2-cpython-310/line_profiler
        copying line_profiler/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/line_profiler
        copying line_profiler/line_profiler.py -> build/lib.macosx-10.9-universal2-cpython-310/line_profiler
        copying line_profiler/ipython_extension.py -> build/lib.macosx-10.9-universal2-cpython-310/line_profiler
        copying line_profiler/__main__.py -> build/lib.macosx-10.9-universal2-cpython-310/line_profiler
        file line_profiler.py (for module line_profiler) not found
        running build_ext
        building 'line_profiler._line_profiler' extension
        creating build/temp.macosx-10.9-universal2-cpython-310
        creating build/temp.macosx-10.9-universal2-cpython-310/line_profiler
        clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DCYTHON_TRACE=0 -Iline_profiler -I/private/var/root/Library/Caches/pypoetry/virtualenvs/pokemon-f1Y_BWa2-py3.10/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c line_profiler/_line_profiler.cpp -o build/temp.macosx-10.9-universal2-cpython-310/line_profiler/_line_profiler.o
        xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
        error: command '/usr/bin/clang' failed with exit code 1
        [end of output]
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
    ERROR: Failed building wheel for line-profiler
  Failed to build line-profiler
  ERROR: Could not build wheels for line-profiler, which is required to install pyproject.toml-based projects
  

  at /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/poetry/utils/env.py:1476 in _run
      1472│                 output = subprocess.check_output(
      1473│                     command, stderr=subprocess.STDOUT, env=env, **kwargs
      1474│                 )
      1475│         except CalledProcessError as e:
    → 1476│             raise EnvCommandError(e, input=input_)
      1477│ 
      1478│         return decode(output)
      1479│ 
      1480│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:


  PoetryException

  Failed to install /var/root/Library/Caches/pypoetry/artifacts/0d/f5/be/eaf61cb56c3272053c2ffba0da815220dae2e8736f7bb3fa871e737756/line_profiler-4.0.1.tar.gz

  at /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/poetry/utils/pip.py:51 in pip_install
       47│ 
       48│     try:
       49│         return environment.run_pip(*args)
       50│     except EnvCommandError as e:
    →  51│         raise PoetryException(f"Failed to install {path.as_posix()}") from e
       52│ ```

Ariz-z avatar Nov 27 '22 18:11 Ariz-z

Not a bug, you have a broken C compiler:

clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DCYTHON_TRACE=0 -Iline_profiler -I/private/var/root/Library/Caches/pypoetry/virtualenvs/pokemon-f1Y_BWa2-py3.10/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c line_profiler/_line_profiler.cpp -o build/temp.macosx-10.9-universal2-cpython-310/line_profiler/_line_profiler.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command '/usr/bin/clang' failed with exit code 1

Set up a working developer tools and you'll be able to compile this wheel (or at least fail in a step past "find a working C compiler").

neersighted avatar Nov 27 '22 18:11 neersighted

Can you please tell me how should i fix it

Ariz-z avatar Nov 27 '22 22:11 Ariz-z

https://www.freecodecamp.org/news/install-xcode-command-line-tools/ will get you a working C compiler, your dependency may still have requirements past that; you'll want to review their documentation to see what the build requirements are.

neersighted avatar Nov 28 '22 00:11 neersighted

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 23:02 github-actions[bot]