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

I have some trobule when running the code #2

Open
yangyang20171121 opened this issue Jul 18, 2018 · 5 comments
Open

I have some trobule when running the code #2

yangyang20171121 opened this issue Jul 18, 2018 · 5 comments

Comments

@yangyang20171121
Copy link

I clone the project from github, the runtime environment are python3.6.1, cpython0.25. The error is described below:

File "E:/ComE/ADSCModel/context_embeddings.py", line 15, in
from utils.training_sdg_inner import train_o2, loss_o2, FAST_VERSION
ModuleNotFoundError: No module named 'utils.training_sdg_inner'

please tell me, what did I miss!

@SeekPoint
Copy link

the same problemn

@dongwu92
Copy link

dongwu92 commented Oct 30, 2018

  1. compile training_sdg_inner at root dir

    sudo python3 cython_utils.py install

  2. install networkx with version of 1.11

    sudo python3 -m pip install networkx==1.11

  3. copy voidptr.h into build directory

  4. imsert the following code at the front of main.py

    import pyximport

    pyximport.install()

@TimRepke
Copy link

TimRepke commented Nov 22, 2018

Hi, I run into the same problem and tried to adapt with the steps @PetroWu suggested. However, I still have problems compiling the code. Maybe someone could help me, I haven't really used Cython yet and don't know what to look out for. Any hints or help are much appreciated. Thanks :-)

% conda env create -f env.yml                                                                                                                                     
Solving environment: done
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Collecting gensim==0.10.2 (from -r /home/tim/Uni/HPI/workspace/ComE/ComE/condaenv.gu9vbtvy.requirements.txt (line 1))
Requirement already satisfied: six>=1.2.0 in /home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages (from gensim==0.10.2->-r /home/tim/Uni/HPI/workspace/ComE/ComE/condaenv.gu9vbtvy.requirements.txt (line 1))
Requirement already satisfied: scipy>=0.7.0 in /home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages (from gensim==0.10.2->-r /home/tim/Uni/HPI/workspace/ComE/ComE/condaenv.gu9vbtvy.requirements.txt (line 1))
Installing collected packages: gensim
Successfully installed gensim-0.10.2
#
# To activate this environment, use
#
#     $ conda activate ComE
#
# To deactivate an active environment, use
#
#     $ conda deactivate

  11.59s user 1.32s system 95% cpu 13.487 total

% conda activate ComE
% python cython_utils.py install                                                                                                                                  :(
running install
running build
running build_ext
building 'utils.training_sdg_inner' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/utils
gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Iutils -I/home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/numpy/core/include -I/home/tim/miniconda3/envs/ComE/include/python3.6m -c utils/training_sdg_inner.c -o build/temp.linux-x86_64-3.6/utils/training_sdg_inner.o
In file included from /home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1788,
                 from /home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                 from /home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from utils/training_sdg_inner.c:493:
/home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it by " \
  ^~~~~~~
utils/training_sdg_inner.c: In function ‘__pyx_pf_5utils_18training_sdg_inner_loss_o1’:
utils/training_sdg_inner.c:3400:7: warning: variable ‘__pyx_v_codelens’ set but not used [-Wunused-but-set-variable]
   int __pyx_v_codelens[0x2710];
       ^~~~~~~~~~~~~~~~
utils/training_sdg_inner.c: In function ‘__pyx_pf_5utils_18training_sdg_inner_4train_o1’:
utils/training_sdg_inner.c:4682:7: warning: variable ‘__pyx_v_codelens’ set but not used [-Wunused-but-set-variable]
   int __pyx_v_codelens[0x2710];
       ^~~~~~~~~~~~~~~~
utils/training_sdg_inner.c: In function ‘__pyx_pf_5utils_18training_sdg_inner_loss_o1.isra.11’:
utils/training_sdg_inner.c:3671:31: warning: ‘__pyx_v_indexes[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         __pyx_v_next_random = __pyx_f_5utils_18training_sdg_inner_loss_o1_o2(__pyx_v_negative, __pyx_v_table, __pyx_v_table_len, __pyx_v_node_embedding, __pyx_v_node_embedding, __pyx_v_size, (__pyx_v_indexes[1]), (__pyx_v_indexes[0]), __pyx_v_5utils_18training_sdg_inner_ONEF, __pyx_v_loss, __pyx_v_work, __pyx_v_next_random);
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
utils/training_sdg_inner.c:3671:31: warning: ‘__pyx_v_indexes[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
utils/training_sdg_inner.c: In function ‘__pyx_pf_5utils_18training_sdg_inner_4train_o1.isra.9’:
utils/training_sdg_inner.c:4954:31: warning: ‘__pyx_v_indexes[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         __pyx_v_next_random = __pyx_v_5utils_18training_sdg_inner_fast_o1(__pyx_v_negative, __pyx_v_table, __pyx_v_table_len, __pyx_v_node_embedding, __pyx_v_node_embedding, __pyx_v_size, (__pyx_v_indexes[1]), (__pyx_v_indexes[0]), __pyx_v__lr, __pyx_v_work, __pyx_v_next_random);
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
utils/training_sdg_inner.c:4954:31: warning: ‘__pyx_v_indexes[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/utils
gcc -pthread -shared -L/home/tim/miniconda3/envs/ComE/lib -Wl,-rpath=/home/tim/miniconda3/envs/ComE/lib,--no-as-needed build/temp.linux-x86_64-3.6/utils/training_sdg_inner.o -L/home/tim/miniconda3/envs/ComE/lib -lpython3.6m -o build/lib.linux-x86_64-3.6/utils/training_sdg_inner.cpython-36m-x86_64-linux-gnu.so
running install_lib
creating /home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/utils
copying build/lib.linux-x86_64-3.6/utils/training_sdg_inner.cpython-36m-x86_64-linux-gnu.so -> /home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/utils
running install_egg_info
Writing /home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/SDG_app-0.0.0-py3.6.egg-info


% python main.py                          
/home/tim/.pyxbld/temp.linux-x86_64-3.6/pyrex/utils/training_sdg_inner.c:475:10: fatal error: numpy/arrayobject.h: No such file or directory
 #include "numpy/arrayobject.h"
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
2018-11-22 18:15:17 ERROR context_embeddings.py: 18 Building module utils.training_sdg_inner failed: ["distutils.errors.CompileError: command 'gcc' failed with exit status 1\n"]
Traceback (most recent call last):
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/distutils/unixccompiler.py", line 118, in _compile
    extra_postargs)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/distutils/ccompiler.py", line 909, in spawn
    spawn(cmd, dry_run=self.dry_run)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/distutils/spawn.py", line 36, in spawn
    _spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/distutils/spawn.py", line 159, in _spawn_posix
    % (cmd, exit_status))
distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/pyximport/pyximport.py", line 215, in load_module
    inplace=build_inplace, language_level=language_level)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/pyximport/pyximport.py", line 191, in build_module
    reload_support=pyxargs.reload_support)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/pyximport/pyxbuild.py", line 102, in pyx_to_dll
    dist.run_commands()
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 185, in run
    _build_ext.build_ext.run(self)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 193, in build_extensions
    self.build_extension(ext)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension
    depends=ext.depends)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/distutils/unixccompiler.py", line 120, in _compile
    raise CompileError(msg)
distutils.errors.CompileError: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 13, in <module>
    from ADSCModel.context_embeddings import Context2Vec
  File "/home/tim/Uni/HPI/workspace/ComE/ComE/ADSCModel/context_embeddings.py", line 19, in <module>
    raise e
  File "/home/tim/Uni/HPI/workspace/ComE/ComE/ADSCModel/context_embeddings.py", line 15, in <module>
    from utils.training_sdg_inner import train_o2, loss_o2, FAST_VERSION
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/pyximport/pyximport.py", line 458, in load_module
    language_level=self.language_level)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/pyximport/pyximport.py", line 231, in load_module
    raise exc.with_traceback(tb)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/pyximport/pyximport.py", line 215, in load_module
    inplace=build_inplace, language_level=language_level)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/pyximport/pyximport.py", line 191, in build_module
    reload_support=pyxargs.reload_support)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/pyximport/pyxbuild.py", line 102, in pyx_to_dll
    dist.run_commands()
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 185, in run
    _build_ext.build_ext.run(self)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 193, in build_extensions
    self.build_extension(ext)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension
    depends=ext.depends)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/home/tim/miniconda3/envs/ComE/lib/python3.6/distutils/unixccompiler.py", line 120, in _compile
    raise CompileError(msg)
ImportError: Building module utils.training_sdg_inner failed: ["distutils.errors.CompileError: command 'gcc' failed with exit status 1\n"]

Note: I renamed the environment in env.yml to ComE and inserted import pyximport and pyximport.install() in the main.py directly after the __author__ line.

@vaudaine
Copy link

Hello,
I successfully installed comE today.

  1. Install Cython==0.25
  2. In comE-master, run: 'python3 cython_utils.py build_ext'
    A new directory 'build' will be created.
  3. Navigate the directories and find training_sdg_inner.cpython-36m-x86_64-linux-gnu.so and training_sdg_inner.o. Copy and paste both files to the comE-master/utils/ directory.
  4. run: 'python3 main.py'
    You can also edit main.py to change the parameters at your will.

Rémi

PS : you also need to downgrade networkx to 1.11 or see pull requests

abegehr added a commit to abegehr/ComE_BGMM that referenced this issue Jul 27, 2020
@UncleLLD
Copy link

UncleLLD commented Aug 8, 2022

#2 (comment)

this help me fix the problem, thanks

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

6 participants