Discussion:
[gensim:4114] No module named word2vec_inner
Naveen lda
2015-04-24 16:37:13 UTC
Permalink
the word2vec_inner.pyx/c files are in the gensim/modules directory
In word2vec.py:
try:
from gensim.models.word2vec_inner import train_sentence_sg,
train_sentence_cbow, FAST_VERSION
except ImportError as e:
print "{0}".format(str(e))
# failed... fall back to plain numpy (20-80x slower training than the
above)
FAST_VERSION = -1

"No module named word2vec_inner"

When I try to run an example program, i get FAST_VERSION = -1 because of
the import error above. I am using an unpacked version of gensim without
installing it. I have openblas installed and tested. Any ideas why this
could be happening?

numpy - 1.9.2
scipy - 0.15.1

I have seen a similar issue posted here in the
comments: http://radimrehurek.com/2013/09/word2vec-in-python-part-two-optimizing/

Thank you,
Naveen
--
You received this message because you are subscribed to the Google Groups "gensim" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gensim+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Naveen lda
2015-04-24 19:46:30 UTC
Permalink
Update: I realized that I did not have cython installed. I installed cython
and added the following lines to models/word2vec.py
import pyximport
pyximport.install(setup_args={
"include_dirs":numpy.get_include()},
reload_support=True)

However, this fails with
~/.pyxbld/temp.linux-x86_64-2.6/pyrex/gensim/models/word2vec_inner.c:253:21:
error: voidptr.h: No such file or directory
Building module gensim.models.word2vec_inner failed: ["CompileError:
command 'gcc' failed with exit status 1\n"]

Not sure how to make models/voidptr.h findable
Post by Naveen lda
the word2vec_inner.pyx/c files are in the gensim/modules directory
from gensim.models.word2vec_inner import train_sentence_sg,
train_sentence_cbow, FAST_VERSION
print "{0}".format(str(e))
# failed... fall back to plain numpy (20-80x slower training than the
above)
FAST_VERSION = -1
"No module named word2vec_inner"
When I try to run an example program, i get FAST_VERSION = -1 because of
the import error above. I am using an unpacked version of gensim without
installing it. I have openblas installed and tested. Any ideas why this
could be happening?
numpy - 1.9.2
scipy - 0.15.1
http://radimrehurek.com/2013/09/word2vec-in-python-part-two-optimizing/
Thank you,
Naveen
--
You received this message because you are subscribed to the Google Groups "gensim" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gensim+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Naveen lda
2015-04-24 20:22:11 UTC
Permalink
Did the obvious hack (cp voidptr.h
to .pyxbld/temp.linux-x86_64-2.6/pyrex/gensim/models/) to make this work.
If anyone knows how to make this work out of the box (without the voidptr.h
copy and without the pyximport addition to word2vec.py), please let me know.
Post by Naveen lda
Update: I realized that I did not have cython installed. I installed
cython and added the following lines to models/word2vec.py
import pyximport
pyximport.install(setup_args={
"include_dirs":numpy.get_include()},
reload_support=True)
However, this fails with
error: voidptr.h: No such file or directory
command 'gcc' failed with exit status 1\n"]
Not sure how to make models/voidptr.h findable
Post by Naveen lda
the word2vec_inner.pyx/c files are in the gensim/modules directory
from gensim.models.word2vec_inner import train_sentence_sg,
train_sentence_cbow, FAST_VERSION
print "{0}".format(str(e))
# failed... fall back to plain numpy (20-80x slower training than the
above)
FAST_VERSION = -1
"No module named word2vec_inner"
When I try to run an example program, i get FAST_VERSION = -1 because of
the import error above. I am using an unpacked version of gensim without
installing it. I have openblas installed and tested. Any ideas why this
could be happening?
numpy - 1.9.2
scipy - 0.15.1
http://radimrehurek.com/2013/09/word2vec-in-python-part-two-optimizing/
Thank you,
Naveen
--
You received this message because you are subscribed to the Google Groups "gensim" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gensim+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Radim Řehůřek
2015-04-25 18:18:54 UTC
Permalink
Hello Naveen,

the normal way to install gensim is with

`$ pip install -e .`

Pip (or easy_install, or `python setup.py install`) will do the module
compilation for you.

Best,
Radim
Post by Naveen lda
Did the obvious hack (cp voidptr.h
to .pyxbld/temp.linux-x86_64-2.6/pyrex/gensim/models/) to make this work.
If anyone knows how to make this work out of the box (without the voidptr.h
copy and without the pyximport addition to word2vec.py), please let me know.
Post by Naveen lda
Update: I realized that I did not have cython installed. I installed
cython and added the following lines to models/word2vec.py
import pyximport
pyximport.install(setup_args={
"include_dirs":numpy.get_include()},
reload_support=True)
However, this fails with
error: voidptr.h: No such file or directory
command 'gcc' failed with exit status 1\n"]
Not sure how to make models/voidptr.h findable
Post by Naveen lda
the word2vec_inner.pyx/c files are in the gensim/modules directory
from gensim.models.word2vec_inner import train_sentence_sg,
train_sentence_cbow, FAST_VERSION
print "{0}".format(str(e))
# failed... fall back to plain numpy (20-80x slower training than
the above)
FAST_VERSION = -1
"No module named word2vec_inner"
When I try to run an example program, i get FAST_VERSION = -1 because of
the import error above. I am using an unpacked version of gensim without
installing it. I have openblas installed and tested. Any ideas why this
could be happening?
numpy - 1.9.2
scipy - 0.15.1
http://radimrehurek.com/2013/09/word2vec-in-python-part-two-optimizing/
Thank you,
Naveen
--
You received this message because you are subscribed to the Google Groups "gensim" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gensim+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Naveen lda
2015-04-27 14:06:57 UTC
Permalink
Hi Radim,

Thank you for the reply. Is there anyway to fix the above issue (with
Cython) without installing gensim? I am required to work on a machine
without admin privileges. I can install locally in my home directory. This
is on redhat.

Thank you,
Naveen
Post by Radim Řehůřek
Hello Naveen,
the normal way to install gensim is with
`$ pip install -e .`
Pip (or easy_install, or `python setup.py install`) will do the module
compilation for you.
Best,
Radim
Post by Naveen lda
Did the obvious hack (cp voidptr.h
to .pyxbld/temp.linux-x86_64-2.6/pyrex/gensim/models/) to make this work.
If anyone knows how to make this work out of the box (without the voidptr.h
copy and without the pyximport addition to word2vec.py), please let me know.
Post by Naveen lda
Update: I realized that I did not have cython installed. I installed
cython and added the following lines to models/word2vec.py
import pyximport
pyximport.install(setup_args={
"include_dirs":numpy.get_include()},
reload_support=True)
However, this fails with
error: voidptr.h: No such file or directory
command 'gcc' failed with exit status 1\n"]
Not sure how to make models/voidptr.h findable
Post by Naveen lda
the word2vec_inner.pyx/c files are in the gensim/modules directory
from gensim.models.word2vec_inner import train_sentence_sg,
train_sentence_cbow, FAST_VERSION
print "{0}".format(str(e))
# failed... fall back to plain numpy (20-80x slower training than
the above)
FAST_VERSION = -1
"No module named word2vec_inner"
When I try to run an example program, i get FAST_VERSION = -1 because
of the import error above. I am using an unpacked version of gensim without
installing it. I have openblas installed and tested. Any ideas why this
could be happening?
numpy - 1.9.2
scipy - 0.15.1
http://radimrehurek.com/2013/09/word2vec-in-python-part-two-optimizing/
Thank you,
Naveen
--
You received this message because you are subscribed to the Google Groups "gensim" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gensim+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Radim Řehůřek
2015-04-28 10:10:07 UTC
Permalink
You can compile with pyximport dynamically. The code is here (from an old
version of gensim):

https://github.com/piskvorky/gensim/commit/d4b9ec0ca35ec039a3194411a01139fe7a149fa5#diff-673fdc31e9aae23291039b143f451b9eL90

I remember Cython didn't like dynamic compilations for some reason, so
beware. I think Cython has problems with the order of importing compiled
modules -- the dynamic pyximport has to come after any other packages that
use cython (sklearn etc.). I forgot why, but it is (was?) a limitation of
Cython.

Hope that helps,
Radim
Post by Naveen lda
Hi Radim,
Thank you for the reply. Is there anyway to fix the above issue (with
Cython) without installing gensim? I am required to work on a machine
without admin privileges. I can install locally in my home directory. This
is on redhat.
Thank you,
Naveen
Post by Radim Řehůřek
Hello Naveen,
the normal way to install gensim is with
`$ pip install -e .`
Pip (or easy_install, or `python setup.py install`) will do the module
compilation for you.
Best,
Radim
Post by Naveen lda
Did the obvious hack (cp voidptr.h
to .pyxbld/temp.linux-x86_64-2.6/pyrex/gensim/models/) to make this work.
If anyone knows how to make this work out of the box (without the voidptr.h
copy and without the pyximport addition to word2vec.py), please let me know.
Post by Naveen lda
Update: I realized that I did not have cython installed. I installed
cython and added the following lines to models/word2vec.py
import pyximport
pyximport.install(setup_args={
"include_dirs":numpy.get_include()},
reload_support=True)
However, this fails with
error: voidptr.h: No such file or directory
command 'gcc' failed with exit status 1\n"]
Not sure how to make models/voidptr.h findable
Post by Naveen lda
the word2vec_inner.pyx/c files are in the gensim/modules directory
from gensim.models.word2vec_inner import train_sentence_sg,
train_sentence_cbow, FAST_VERSION
print "{0}".format(str(e))
# failed... fall back to plain numpy (20-80x slower training than
the above)
FAST_VERSION = -1
"No module named word2vec_inner"
When I try to run an example program, i get FAST_VERSION = -1 because
of the import error above. I am using an unpacked version of gensim without
installing it. I have openblas installed and tested. Any ideas why this
could be happening?
numpy - 1.9.2
scipy - 0.15.1
http://radimrehurek.com/2013/09/word2vec-in-python-part-two-optimizing/
Thank you,
Naveen
--
You received this message because you are subscribed to the Google Groups "gensim" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gensim+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Naveen lda
2015-04-28 13:42:15 UTC
Permalink
Thanks Radim. This is what I am doing at present. Maybe the prder of import
has something to do with the error:
"~/.pyxbld/temp.linux-x86_64-2.6/pyrex/gensim/models/word2vec_inner.c:253:21:
error: voidptr.h: No such file or directory"

Will test this.
Post by Radim Řehůřek
You can compile with pyximport dynamically. The code is here (from an old
https://github.com/piskvorky/gensim/commit/d4b9ec0ca35ec039a3194411a01139fe7a149fa5#diff-673fdc31e9aae23291039b143f451b9eL90
I remember Cython didn't like dynamic compilations for some reason, so
beware. I think Cython has problems with the order of importing compiled
modules -- the dynamic pyximport has to come after any other packages that
use cython (sklearn etc.). I forgot why, but it is (was?) a limitation of
Cython.
Hope that helps,
Radim
Post by Naveen lda
Hi Radim,
Thank you for the reply. Is there anyway to fix the above issue (with
Cython) without installing gensim? I am required to work on a machine
without admin privileges. I can install locally in my home directory. This
is on redhat.
Thank you,
Naveen
Post by Radim Řehůřek
Hello Naveen,
the normal way to install gensim is with
`$ pip install -e .`
Pip (or easy_install, or `python setup.py install`) will do the module
compilation for you.
Best,
Radim
Post by Naveen lda
Did the obvious hack (cp voidptr.h
to .pyxbld/temp.linux-x86_64-2.6/pyrex/gensim/models/) to make this work.
If anyone knows how to make this work out of the box (without the voidptr.h
copy and without the pyximport addition to word2vec.py), please let me know.
Post by Naveen lda
Update: I realized that I did not have cython installed. I installed
cython and added the following lines to models/word2vec.py
import pyximport
pyximport.install(setup_args={
"include_dirs":numpy.get_include()},
reload_support=True)
However, this fails with
error: voidptr.h: No such file or directory
command 'gcc' failed with exit status 1\n"]
Not sure how to make models/voidptr.h findable
Post by Naveen lda
the word2vec_inner.pyx/c files are in the gensim/modules directory
from gensim.models.word2vec_inner import train_sentence_sg,
train_sentence_cbow, FAST_VERSION
print "{0}".format(str(e))
# failed... fall back to plain numpy (20-80x slower training than
the above)
FAST_VERSION = -1
"No module named word2vec_inner"
When I try to run an example program, i get FAST_VERSION = -1 because
of the import error above. I am using an unpacked version of gensim without
installing it. I have openblas installed and tested. Any ideas why this
could be happening?
numpy - 1.9.2
scipy - 0.15.1
http://radimrehurek.com/2013/09/word2vec-in-python-part-two-optimizing/
Thank you,
Naveen
--
You received this message because you are subscribed to the Google Groups "gensim" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gensim+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Radim Řehůřek
2015-04-28 19:51:14 UTC
Permalink
Post by Naveen lda
Thanks Radim. This is what I am doing at present. Maybe the prder of
error: voidptr.h: No such file or directory"
Are you setting up the include_dirs the same way?

Radim
Post by Naveen lda
Will test this.
Post by Radim Řehůřek
You can compile with pyximport dynamically. The code is here (from an old
https://github.com/piskvorky/gensim/commit/d4b9ec0ca35ec039a3194411a01139fe7a149fa5#diff-673fdc31e9aae23291039b143f451b9eL90
I remember Cython didn't like dynamic compilations for some reason, so
beware. I think Cython has problems with the order of importing compiled
modules -- the dynamic pyximport has to come after any other packages that
use cython (sklearn etc.). I forgot why, but it is (was?) a limitation of
Cython.
Hope that helps,
Radim
Post by Naveen lda
Hi Radim,
Thank you for the reply. Is there anyway to fix the above issue (with
Cython) without installing gensim? I am required to work on a machine
without admin privileges. I can install locally in my home directory. This
is on redhat.
Thank you,
Naveen
Post by Radim Řehůřek
Hello Naveen,
the normal way to install gensim is with
`$ pip install -e .`
Pip (or easy_install, or `python setup.py install`) will do the module
compilation for you.
Best,
Radim
Post by Naveen lda
Did the obvious hack (cp voidptr.h
to .pyxbld/temp.linux-x86_64-2.6/pyrex/gensim/models/) to make this work.
If anyone knows how to make this work out of the box (without the voidptr.h
copy and without the pyximport addition to word2vec.py), please let me know.
Post by Naveen lda
Update: I realized that I did not have cython installed. I installed
cython and added the following lines to models/word2vec.py
import pyximport
pyximport.install(setup_args={
"include_dirs":numpy.get_include()},
reload_support=True)
However, this fails with
error: voidptr.h: No such file or directory
command 'gcc' failed with exit status 1\n"]
Not sure how to make models/voidptr.h findable
Post by Naveen lda
the word2vec_inner.pyx/c files are in the gensim/modules directory
from gensim.models.word2vec_inner import train_sentence_sg,
train_sentence_cbow, FAST_VERSION
print "{0}".format(str(e))
# failed... fall back to plain numpy (20-80x slower training
than the above)
FAST_VERSION = -1
"No module named word2vec_inner"
When I try to run an example program, i get FAST_VERSION = -1
because of the import error above. I am using an unpacked version of gensim
without installing it. I have openblas installed and tested. Any ideas why
this could be happening?
numpy - 1.9.2
scipy - 0.15.1
http://radimrehurek.com/2013/09/word2vec-in-python-part-two-optimizing/
Thank you,
Naveen
--
You received this message because you are subscribed to the Google Groups "gensim" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gensim+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...