implicit icon indicating copy to clipboard operation
implicit copied to clipboard

implicit library not loading in osx

Open sniderg opened this issue 6 years ago • 4 comments

After installing v. 0.4.2 implicit on my macbook, I get a traceback error when running in python3 after running: import implicit

Catalina 10.15.6 Python 3.7.8 (v3.7.8:4b47a5b6ba, Jun 27 2020, 04:47:50) [Clang 6.0 (clang-600.0.57)] on darwin

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/implicit/__init__.py", line 1, in <module>
    from . import als, approximate_als, bpr, lmf, nearest_neighbours
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/implicit/als.py", line 14, in <module>
    from . import _als
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/implicit/_als.cpython-37m-darwin.so, 2): Symbol not found: _GOMP_parallel
  Referenced from: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/implicit/_als.cpython-37m-darwin.so
  Expected in: flat namespace
 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/implicit/_als.cpython-37m-darwin.so

I understand this is related to the c++ libraries. Tried installing conda install libgcc and conda install llvm but there was no change in error.

I believe fundamental problem is related to implicit trying to access libstdc++ vs the newer libc++.

Appears installing glove also has a similar issue https://github.com/maciejkula/glove-python/issues/112

sniderg avatar Jul 22 '20 22:07 sniderg

I'm also having the same problem - did you find a solution?

nicolaneo avatar Jul 29 '20 16:07 nicolaneo

I had similar issues with installation and subsequently importing.

MacOS: Mojave 10.14.5 GCC: gcc@9

I resolved as follows:

  1. reinstall xcode command line tools (according to this, Mojave deletes user/include upon installation):
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
cd /Library/Developer/CommandLineTools/Packages/
open macOS_SDK_headers_for_macOS_10.14.pkg
  1. checkout the implicit source and checkout tag v0.4.0

  2. python setup.py install

gregross avatar Jul 31 '20 19:07 gregross

Hi @gregross that's a good suggestion for Mojave users. Unfortunately, that path (and pkg file) no longer exists in Catalina.

sniderg avatar Aug 04 '20 13:08 sniderg

Update: I fixed problem via this comment:

brew update
brew upgrade
brew cleanup

And then re-installing via pip install implicit in my active environment.

sniderg avatar Aug 21 '20 22:08 sniderg