jackmpcollins / magentic

Seamlessly integrate LLMs as Python functions
https://magentic.dev/
MIT License
2.04k stars 100 forks source link

Installation error in Mac OSX, Python 3.11.4, pip 23.2.1 #30

Closed yudataguy closed 1 year ago

yudataguy commented 1 year ago
Building wheels for collected packages: magnetic
  Building wheel for magnetic (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for magnetic (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [32 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-13-arm64-cpython-311
      creating build/lib.macosx-13-arm64-cpython-311/magnetic
      copying magnetic/asyncore.py -> build/lib.macosx-13-arm64-cpython-311/magnetic
      copying magnetic/_version.py -> build/lib.macosx-13-arm64-cpython-311/magnetic
      copying magnetic/__init__.py -> build/lib.macosx-13-arm64-cpython-311/magnetic
      copying magnetic/_utils.py -> build/lib.macosx-13-arm64-cpython-311/magnetic
      creating build/lib.macosx-13-arm64-cpython-311/magnetic/_internals
      copying magnetic/_internals/inetd.py -> build/lib.macosx-13-arm64-cpython-311/magnetic/_internals
      copying magnetic/_internals/sane_fromfd.py -> build/lib.macosx-13-arm64-cpython-311/magnetic/_internals
      copying magnetic/_internals/systemd.py -> build/lib.macosx-13-arm64-cpython-311/magnetic/_internals
      copying magnetic/_internals/sane_fromfd_build.py -> build/lib.macosx-13-arm64-cpython-311/magnetic/_internals
      copying magnetic/_internals/__init__.py -> build/lib.macosx-13-arm64-cpython-311/magnetic/_internals
      copying magnetic/_internals/launchd.py -> build/lib.macosx-13-arm64-cpython-311/magnetic/_internals
      copying magnetic/_internals/sock_enums.py -> build/lib.macosx-13-arm64-cpython-311/magnetic/_internals
      UPDATING build/lib.macosx-13-arm64-cpython-311/magnetic/_version.py
      set build/lib.macosx-13-arm64-cpython-311/magnetic/_version.py to '0.1'
      running build_ext
      generating cffi module 'build/temp.macosx-13-arm64-cpython-311/magnetic._internals._sane_fromfd.c'
      creating build/temp.macosx-13-arm64-cpython-311
      building 'magnetic._internals._sane_fromfd' extension
      creating build/temp.macosx-13-arm64-cpython-311/build
      creating build/temp.macosx-13-arm64-cpython-311/build/temp.macosx-13-arm64-cpython-311
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I/Users/samyu/Downloads/code/playground/magnetic-test/.venv/include -I/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c build/temp.macosx-13-arm64-cpython-311/magnetic._internals._sane_fromfd.c -o build/temp.macosx-13-arm64-cpython-311/build/temp.macosx-13-arm64-cpython-311/magnetic._internals._sane_fromfd.o
      build/temp.macosx-13-arm64-cpython-311/magnetic._internals._sane_fromfd.c:592:51: error: use of undeclared identifier 'SO_PROTOCOL'
              int flag = getsockopt(sockfd, SOL_SOCKET, SO_PROTOCOL, &sockproto, &socklen);
                                                        ^
      1 error generated.
      error: command '/opt/homebrew/opt/llvm/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 magnetic
Failed to build magnetic
ERROR: Could not build wheels for magnetic, which is required to install pyproject.toml-based projects

Any suggestion on how to folve this?

yudataguy commented 1 year ago

It works on my ubuntu 20.04, so probably macos centric issue

jackmpcollins commented 1 year ago

@yudataguy It's a typo! This should work for you

pip install magentic

Thanks for trying out the package!

yudataguy commented 1 year ago

@yudataguy It's a typo! This should work for you

pip install magentic

Thanks for trying out the package!

lol that's embarrassing. Here's another installation issue:

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.
aws-sam-cli 1.37.0 requires regex==2021.9.30, but you have regex 2023.6.3 which is incompatible.
aws-sam-cli 1.37.0 requires requests==2.25.1, but you have requests 2.30.0 which is incompatible.
aws-sam-cli 1.37.0 requires typing-extensions==3.10.0.0, but you have typing-extensions 4.8.0 which is incompatible.
langchainplus-sdk 0.0.4 requires pydantic<2,>=1, but you have pydantic 2.4.1 which is incompatible.
langchain 0.0.193 requires pydantic<2,>=1, but you have pydantic 2.4.1 which is incompatible.
confection 0.0.4 requires pydantic!=1.8,!=1.8.1,<1.11.0,>=1.7.4, but you have pydantic 2.4.1 which is incompatible.
thinc 8.1.10 requires pydantic!=1.8,!=1.8.1,<1.11.0,>=1.7.4, but you have pydantic 2.4.1 which is incompatible.
spacy 3.5.3 requires pydantic!=1.8,!=1.8.1,<1.11.0,>=1.7.4, but you have pydantic 2.4.1 which is incompatible.

is it possible to run magentic without langchain? I find langchain to be bloated, in the process of removing it entirely from my pipeline.

jackmpcollins commented 1 year ago

Yes, magentic only depends on pydantic and openai but it requires pydantic v2 while the version of langchain you have requires pydantic v1. If you can upgrade your version of langchain to >=0.0.267 then you should be able to use both together (with pydantic v2 installed) according to this comment https://github.com/langchain-ai/langchain/issues/6841#issuecomment-1682996914

You might need to also update some of the other packages mentioned in that error message for the same reason.