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

import multivec: Segmentation fault: 11 #2

Open
yuliagrishina opened this issue Jun 1, 2016 · 6 comments
Open

import multivec: Segmentation fault: 11 #2

yuliagrishina opened this issue Jun 1, 2016 · 6 comments

Comments

@yuliagrishina
Copy link

Hi,
after I installed multivec and python wrapper, I was trying to import multivec into python. however, it exits with Segmentation fault: 11
Any ideas what went wrong?
I am using MacOS 10.10.4.
thanks!
Yulia

@alex-berard
Copy link
Owner

Hello Yulia,

Thank you for reaching out to me. I'm sorry that you've run into problems
with MultiVec.
I've not tested MultiVec under MacOS, so this might very well be the issue.
Unfortunately, I don't have a Mac so I cannot replicate your problem.

Which version of gcc are you using (gcc --version), and which version of
python?
python-wrapper/makefile uses python2, can you make sure that you use the
same one? (for example python and python2 might point to different things)

Can you do the following, and give me the console output?

$ cd multivec/python-wrapper
$ echo "import multivec" > test.py
$ gdb python2
(gdb) run test.py
(gdb) backtrace

Also, have you tried running bin/multivec-mono and bin/multivec-bi, without
the python wrapper?

Thank you,

Alexandre

On Wed, Jun 1, 2016 at 4:21 PM, yuliagrishina notifications@github.com
wrote:

Hi,
after I installed multivec and python wrapper, I was trying to import
multivec into python. however, it exits with Segmentation fault: 11
Any ideas what went wrong?
I am using MacOS 10.10.4.
thanks!
Yulia


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#2, or mute the thread
https://github.com/notifications/unsubscribe/ABtk-ZZyZT2CpRiAW5q94mQFwqVN8DVqks5qHZVvgaJpZM4IrmWg
.

@yuliagrishina
Copy link
Author

yuliagrishina commented Jun 1, 2016

Hi Alexandre,

thanks for your quick reply. So I am using

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix
$ python --version
Python 2.7.6

I already changed python2 into python in python-wrapper/makefile, it did not solve the issue.

I don't have gdb installed on mac, I will look it into later, but when I tried to import through ipython, i got the following output:

In [1]: from multivec.so import BiModel
ImportError Traceback (most recent call last)
in ()
----> 1 from multivec.so import BiModel

ImportError: dlopen(/Users/Yulia/Documents/CL/Potsdam2016/multivec/python-wrapper/multivec.so, 2): Symbol not found: _PyCObject_Type
Referenced from: /Users/Yulia/Documents/CL/Potsdam2016/multivec/python-wrapper/multivec.so
Expected in: flat namespace
in /Users/Yulia/Documents/CL/Potsdam2016/multivec/python-wrapper/multivec.so

Here I am trying it without the python wrapper and get a segfault again:
yulia:multivec Yulia$ bin/multivec-mono --train Untitled.txt --save models/europarl.en.bin --threads 16
MultiVec-mono
dimension: 100
window size: 5
min count: 5
alpha: 0.05
iterations: 5
threads: 16
subsampling: 0.001
skip-gram: false
HS: false
negative: 5
sent vector: false
freeze: false
Training file: Untitled.txt
Segmentation fault: 11

thanks again!
y.

@alex-berard
Copy link
Owner

Hi Yulia,

Did you do from multivec.so import BiModel instead of from multivec import BiModel or is it just a typo? (the correct one is the latter).

Also, that's weird that you get a different error with python and ipython. With standard python, you get the segfault right after importing multivec right?

Could you try running those commands, and give me their output? (not sure they work on Mac OS)
$ which python
$ which ipython
$ cat which ipython

For bin/multivec-mono, I suspect that the error that you get is because Untitled.txt is empty (is it?) Try putting a few lines in Untitled.txt, and call multivec-mono with --min-count 1 (I think there should be at least 1 word, that matches the minimum count requirement, otherwise it crashes).

A random guess: try changing --std=c++0x to --std=c++11 in python-wrapper/setup.py

@yuliagrishina
Copy link
Author

yuliagrishina commented Jun 1, 2016

Hi again,

Did you do from multivec.so import BiModel instead of from multivec import BiModel or is it just a typo? (the correct one is the latter).

yes, I tried both actually, they give the same output.

Also, that's weird that you get a different error with python and ipython. With standard python, you get the segfault right after importing multivec right?

yes, exactly.

Could you try running those commands, and give me their output? (not sure they work on Mac OS)

$ which python
/usr/bin/python
$ which ipython
/usr/local/bin/ipython
$ cat which ipython

#!/usr/local/opt/python3/bin/python3.4
# -*- coding: utf-8 -*-
import re
import sys
from IPython import start_ipython
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(start_ipython())

oh here I see that default ipython is ipython3, so if I try from multivec.so import BiModel in ipython2, it again gives a segfault.

For bin/multivec-mono, I suspect that the error that you get is because Untitled.txt is empty (is it?)

no, it actually contained one line. with --min-count 1 it worked!

A random guess: try changing --std=c++0x to --std=c++11 in python-wrapper/setup.py

did that and rebuild wrapper again, same result :(

@simon-clematide
Copy link

simon-clematide commented Jun 3, 2016

I also tried to compile it on my MacOS laptop machine (10.11.5 ) having a macports 2.3.4 installed. I was able to compile everything (only a unused pthread flag warning appeared). Using the macports python2.7 (!! not the built-in from Apple) I was able to train a bivec model and use it via python.

@yuliagrishina
Copy link
Author

Hi Simon,
thanks for the reply. Good to hear that it worked for you with macports; I will try this out on my 10.10.4 machine.
thanks again,
Yulia

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