vim_codex
vim_codex copied to clipboard
MacOS python confusion
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..
Try
/usr/bin/python -m pip install openai
This should install it for your system python version.
Please post the error message in case you still get errors.
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.
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