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 support, and Python dependencies #9

Closed
mvasilkov opened this issue Apr 18, 2019 · 9 comments
Closed

macOS support, and Python dependencies #9

mvasilkov opened this issue Apr 18, 2019 · 9 comments

Comments

@mvasilkov
Copy link

Hi all, these are two related issues:

  1. After running pip3 install blingfire in macOS, which appears to work fine, it's impossible to use the library since the .dylib isn't there. And the error message is rather meh: AttributeError: 'NoneType' object has no attribute 'TextToWords'

  2. It appears to require NumPy, but doesn't specify it as a dependency, so running from a venv without numpy in it also fails.

Both can be fixed by tuning the setup.py metadata, but wrt macOS, can we please actually support it? I can't imagine it being very different from the Linux build, if at all.

Thanks for open sourcing this!

@jialigit
Copy link

I also find this problem of not supporting macOs platform. Really hope for the open source of it.

@SergeiAlonichau
Copy link
Member

Looking into it.

@ma2rten
Copy link

ma2rten commented May 15, 2019

Same problem:

$ python3 -m virtualenv env
Using base prefix '/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7'
/Users/bosma/Library/Python/3.7/lib/python/site-packages/virtualenv.py:1041: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
New python executable in /Users/bosma/projects/env/bin/python3.7
Also creating executable in /Users/bosma/projects/env/bin/python
Installing setuptools, pip, wheel...done.
$ source env/bin/activate
$ pip install blingfire
Collecting blingfire
Downloading https://files.pythonhosted.org/packages/6b/aa/f999e3ca3e826cbdefe7dea7f90baf06db26448ef4cfd80f4800d84d660f/blingfire-0.0.9-py3-none-any.whl (248kB)
|████████████████████████████████| 256kB 1.5MB/s
Installing collected packages: blingfire
Successfully installed blingfire-0.0.9
$ python
Python 3.7.0 (default, Aug 17 2018, 21:14:48)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

from blingfire import *
Traceback (most recent call last):
File "", line 1, in
File "/Users/bosma/projects/env/lib/python3.7/site-packages/blingfire/init.py", line 5, in
import numpy as np
ModuleNotFoundError: No module named 'numpy'
text = 'This is the Bling-Fire tokenizer'
output = text_to_words(text)
KeyboardInterrupt

$ pip install numpy
Collecting numpy
Downloading https://files.pythonhosted.org/packages/43/6e/71a3af8680a159a141fab5b4d19988111a09c02ffbfdeb42175cca0fa341/numpy-1.16.3-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (13.9MB)
|████████████████████████████████| 13.9MB 2.1MB/s
Installing collected packages: numpy
Successfully installed numpy-1.16.3
$ python
Python 3.7.0 (default, Aug 17 2018, 21:14:48)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

from blingfire import *
text = 'This is the Bling-Fire tokenizer'
output = text_to_words(text)
Traceback (most recent call last):
File "", line 1, in
File "/Users/bosma/projects/env/lib/python3.7/site-packages/blingfire/init.py", line 58, in text_to_words
o_len = blingfire.TextToWords(c_char_p(s_bytes), c_int(len(s_bytes)), byref(o_bytes), c_int(o_bytes_count))
AttributeError: 'NoneType' object has no attribute 'TextToWords'

@sandeepeecs
Copy link

Looking into it.

Any suggested fixes to make it work no macOS?

@ZPVIP
Copy link

ZPVIP commented Sep 19, 2019

there is no mac OS support:

# detect windows
if platform.system() == "Windows":
blingfire = cdll.LoadLibrary(os.path.join(path, "blingfiretokdll.dll"))
# detect Mac OSX
elif platform.system() == "Darwin":
pass
else:
# detect linux
blingfire = cdll.LoadLibrary(os.path.join(path, "libblingfiretokdll.so"))

@ankane
Copy link
Contributor

ankane commented Feb 24, 2020

fwiw, I was able to get it working on Mac with the following changes: master...ankane:mac. There's probably a cleaner way to do it.

@SergeiAlonichau
Copy link
Member

SergeiAlonichau commented Feb 25, 2020 via email

@ankane ankane mentioned this issue Feb 25, 2020
@SergeiAlonichau
Copy link
Member

Thank you, Andrew, for doing the change!

Starting from version 0.0.16 blingfire package supports Mac.

@ankane
Copy link
Contributor

ankane commented Mar 2, 2020

Awesome, thanks @SergeiAlonichau!

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

7 participants