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

MacOS python confusion #13

Open
normen opened this issue Feb 27, 2022 · 4 comments
Open

MacOS python confusion #13

normen opened this issue Feb 27, 2022 · 4 comments

Comments

@normen
Copy link

normen commented Feb 27, 2022

Hi,

thanks for this plugin, it works great on Linux on my RasPi but I am having issues on MacOS..

On MacOS theres a bunch of different python installs. For one theres the one from MacOS itself, then theres one that comes with XCode and then usually people like me like to use the one installed via brew install python3.

It seems this plugin is always using the system-installed python in /usr/bin/python while the shell and everything else is using the homebrew-installed /usr/local/bin/python. So when I do pip3 install openai it installs fine but doesn't work in the plugin / in vim.

When I do /usr/bin/pip3 install openai I am getting issues with building, I suppose thats due to the system's python being incompatible with openai or something..

@tom-doerr
Copy link
Owner

Try

/usr/bin/python -m pip install openai

This should install it for your system python version.

@tom-doerr
Copy link
Owner

Please post the error message in case you still get errors.

@normen
Copy link
Author

normen commented Feb 27, 2022

Nah, same result as using /usr/bin/pip, somehow it can't install numpy successfully that way. I guess I'll want to avoid using vim internal python interpreter anyway, maybe I'll just make an external command for this, seems easier.

Heres the error log for reference.

  INFO: CCompilerOpt.cache_flush[817] : write cache to path -> /private/var/folders/nw/hdjmc6911jq5pcvd1z1sfzqh0000gn/T/pip-install-up3c0nkk/numpy/build/temp.macosx-10.14-x86_64-3.8/ccompiler_opt_cache_clib.py
  error: Command "clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -ftrapping-math -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=3 -DHAVE_CBLAS -Ibuild/src.macosx-10.14-x86_64-3.8/numpy/core/src/common -Ibuild/src.macosx-10.14-x86_64-3.8/numpy/core/src/umath -Inumpy/core/include -Ibuild/src.macosx-10.14-x86_64-3.8/numpy/core/include/numpy -Ibuild/src.macosx-10.14-x86_64-3.8/numpy/distutils/include -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -Inumpy/core/src/_simd -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -Ibuild/src.macosx-10.14-x86_64-3.8/numpy/core/src/common -Ibuild/src.macosx-10.14-x86_64-3.8/numpy/core/src/npymath -c numpy/core/src/multiarray/dragon4.c -o build/temp.macosx-10.14-x86_64-3.8/numpy/core/src/multiarray/dragon4.o -MMD -MF build/temp.macosx-10.14-x86_64-3.8/numpy/core/src/multiarray/dragon4.o.d -msse3 -I/System/Library/Frameworks/vecLib.framework/Headers" failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for numpy
Successfully built pandas
Failed to build numpy
ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 20.2.3; however, version 22.0.3 is available.
You should consider upgrading via the '/Applications/Xcode.app/Contents/Developer/usr/bin/python3 -m pip install --upgrade pip' command.

@bEDROch
Copy link

bEDROch commented Feb 16, 2023

brew install python
brew install [email protected]
brew install vim

Now, Vim will force to install Python3.11 a long side within...

brew unlink python3.11
brew unlink python3.10 && brew link python3.10
echo "alias python='$(brew --prefix)/bin/python3'" >> ~/.zshrc
echo "alias pip='pip3'" >> ~/.zshrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants