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

wrap_train #28

Closed
dinos66 opened this issue Jan 11, 2016 · 67 comments
Closed

wrap_train #28

dinos66 opened this issue Jan 11, 2016 · 67 comments
Labels

Comments

@dinos66
Copy link

dinos66 commented Jan 11, 2016

Hello.

While using somoclu (windows7, python3.4) and calling the som.train() command (with and without args), I get the following error:
som.train(epochs=epochs, radius0=radius0, scale0=scale0)
File "C:\Python34\lib\site-packages\somoclu\train.py", line 158, in train
wrap_train(np.ravel(self._data), epochs, self._n_columns, self._n_rows,
NameError: name 'wrap_train' is not defined
Any ideas?

Thank you!

@xgdgsc
Copy link
Collaborator

xgdgsc commented Jan 12, 2016

There seems some problems with my pre-built wheel package. I will rebuild them.

@xgdgsc
Copy link
Collaborator

xgdgsc commented Jan 12, 2016

I rebuilt them and uploaded to https://github.com/peterwittek/somoclu/releases/tag/1.6 because pypi doesn' t allow files with the same name get reuploaded after deletion. And I remember it may not a building problem as https://github.com/peterwittek/somoclu/tree/master/src/Python#installation documented, before you try the new built packages, you can try using Dependency Walker on site-packages\_somoclu_wrap.pyd. Usually right version (32/64bit) of vcomp90.dll, msvcp90.dll, msvcr90.dll should be put to C:\Windows\System32 or C:\Windows\SysWOW64.

@dinos66
Copy link
Author

dinos66 commented Jan 12, 2016

It must have been the build, cause I reinstalled it using the new 1.6 which you uploaded and it seems to be working fine.

@xgdgsc
Copy link
Collaborator

xgdgsc commented Jan 12, 2016

OK. Thanks for pointing this out. Closing this.

@xgdgsc xgdgsc closed this as completed Jan 12, 2016
@xgdgsc xgdgsc added the bug label Jan 12, 2016
@wooandoo
Copy link

Hi,

I still have the error with os x 10.10 and somoclu 1.6.1.
Do you have an idea?

@dinos66
Copy link
Author

dinos66 commented Mar 22, 2016

Apologies for checking but did you delete all somoclu files and reinstalled fresh?

@xgdgsc
Copy link
Collaborator

xgdgsc commented Mar 23, 2016

@wooandoo Which Python version? How did you install? Wheel package or running setup.py?

@wooandoo
Copy link

@xgdgsc I use python 3.5 in pineapple (iPython on OSX)
@dinos66 it was my first installation

@xgdgsc
Copy link
Collaborator

xgdgsc commented Mar 23, 2016

@arhuang
Copy link

arhuang commented May 10, 2016

Hi, I keep getting the import error: "Warning: training function cannot be imported. Only pre-trained maps can be analyzed." so wrap_train never gets imported from .somoclu_wrap and thus global name 'wrap_train' is not defined

@xgdgsc
Copy link
Collaborator

xgdgsc commented May 10, 2016

@arhuang How did you install?

@arhuang
Copy link

arhuang commented May 10, 2016

I first did it using pip and then the 1.6 version linked above.

@xgdgsc
Copy link
Collaborator

xgdgsc commented May 10, 2016

@arhuang What' s your platform and Python version?

@arhuang
Copy link

arhuang commented May 10, 2016

osx 10.11 python 2.7

@xgdgsc
Copy link
Collaborator

xgdgsc commented May 10, 2016

@arhuang Are you using the python installed by homebrew or system python? I tested the wheel package with the python installed by homebrew and it worked fine.

@arhuang
Copy link

arhuang commented May 10, 2016

I am using python installed by homebrew, is that wheel package the one installed with pip?

@xgdgsc
Copy link
Collaborator

xgdgsc commented May 10, 2016

@arhuang It should be. You can try downloading the wheel to make sure.

@arhuang
Copy link

arhuang commented May 10, 2016

Am I missing .somoclu_wrap? I get the warning both when i import somoclu and when i use train.

@xgdgsc
Copy link
Collaborator

xgdgsc commented May 10, 2016

@arhuang Can you find _somoclu_wrap.so under you site-packages directory?

@arhuang
Copy link

arhuang commented May 10, 2016

sorry where is the site-packages directory?

@arhuang
Copy link

arhuang commented May 10, 2016

I found a site packages directory in ~Library/Python/2.7/site-packages but it does not include somoclu

@arhuang
Copy link

arhuang commented May 10, 2016

I found somoclu_wrap.py in site packages but not somoclu_wrap.so

@arhuang
Copy link

arhuang commented May 10, 2016

oh wait sorry, I found somoclu_wrap.so

@arhuang
Copy link

arhuang commented May 10, 2016

ok sorry, I think the somoclu_wrap.so didn't install the first time, everything works now. Thanks for your help

@kevinayuque
Copy link

I'm getting the same problem "Warning: training function cannot be imported. Only pre-trained maps can be analyzed." using Python 2.7 (default and virtualenv) on OSX El Capitan. Hopefully someone can help me. I tried installing directly from pip and the wheel package with no luck.

@xgdgsc
Copy link
Collaborator

xgdgsc commented May 22, 2016

@kevinayuque Do you mean the system python by "default"? Have you tried the brew python?

@kevinayuque
Copy link

kevinayuque commented May 22, 2016

I'm using the python located on /usr/local/bin/python which I think is the homebrew python.

This are all the files I have related to somoclu:
/usr/local/lib/python2.7/site-packages/_somoclu_wrap.so
/usr/local/lib/python2.7/site-packages/somoclu-1.6.1.dist-info/DESCRIPTION.rst
/usr/local/lib/python2.7/site-packages/somoclu-1.6.1.dist-info/INSTALLER
/usr/local/lib/python2.7/site-packages/somoclu-1.6.1.dist-info/METADATA
/usr/local/lib/python2.7/site-packages/somoclu-1.6.1.dist-info/RECORD
/usr/local/lib/python2.7/site-packages/somoclu-1.6.1.dist-info/WHEEL
/usr/local/lib/python2.7/site-packages/somoclu-1.6.1.dist-info/metadata.json
/usr/local/lib/python2.7/site-packages/somoclu-1.6.1.dist-info/top_level.txt
/usr/local/lib/python2.7/site-packages/somoclu/init.py
/usr/local/lib/python2.7/site-packages/somoclu/init.pyc
/usr/local/lib/python2.7/site-packages/somoclu/somoclu_wrap.py
/usr/local/lib/python2.7/site-packages/somoclu/somoclu_wrap.pyc
/usr/local/lib/python2.7/site-packages/somoclu/train.py
/usr/local/lib/python2.7/site-packages/somoclu/train.pyc

@kevinayuque
Copy link

kevinayuque commented May 23, 2016

I tried with python3 and still get the same problem.
Here is a more detailed look at the error it throws:

som.train()
File "/usr/local/lib/python3.5/site-packages/somoclu/train.py", line 181, in train
wrap_train(np.ravel(self._data), epochs, self._n_columns, self._n_rows,
NameError: name 'wrap_train' is not defined

@xgdgsc
Copy link
Collaborator

xgdgsc commented Aug 9, 2016

@kunal-ray
Copy link

Warning is gone, so I hope it is fine now. Thanks

@davidlamb
Copy link

I'm having the same problem with installing somoclu on Windows 10 Python 2.7 (using 32 bit). It gives me the same warning and then the error name 'wrap_train' is not defined. I have installed through pip using the whl as well as the executable. I've uninstalled through pip and just deleting the folder. I've installed Visual C++ 2008 express, as well as the redistributable.

I've also tried it through winpython https://winpython.github.io/ (64 and 32 bit versions). I was surprised that didn't work and I get the same errors.

I tried anaconda and that did work. I tried copying the dll files that come with that version and paste them in the System32 folder to see if that would do it but it didn't.

Any other suggestions? Is there a way to test it with winpython?

@xgdgsc
Copy link
Collaborator

xgdgsc commented Aug 19, 2016

Is your Windows 10 32bit or 64bit?

@davidlamb
Copy link

It's a 64bit version of windows, but 32bit python. It is an installation of python that comes installed with ArcGIS software. Maybe that's the issue. I've managed to get myself setup with Anaconda, so I will use that instead. Thank you, though.

@Apoorvakuril
Copy link

I am using Windows 10 Python 2.7.11 (using 64 bit). It gives me the same warning and then the error name 'wrap_train' is not defined. Plz help. I installed using pip and wheel for somoclu - 1.7 and before that 1.6.1 too.

@xgdgsc
Copy link
Collaborator

xgdgsc commented Oct 2, 2016

@Apoorvakuril Have you tried adding some dlls as above comments said?

@bennsandoval
Copy link

For Mac users:
is not valid: brew install libiomp
use this instead: brew install homebrew/boneyard/libiomp

@peterwittek
Copy link
Owner

@bennsandoval, thanks for this. If libiomp was migrated to the boneyard, it surely isn't a future-proof solution. As far as I understand, Xcode's clang still does not support OpenMP. On Linux with clang 3.9, the code compiles with OpenMP without any issue. Do you see a better way forward? I can't test it, but would llvm work?

@bennsandoval
Copy link

@peterwittek I tried llvm and did not work.

@peterwittek
Copy link
Owner

peterwittek commented Dec 9, 2016

Thanks for checking it. I just pushed commit c542db9 to update the Mac-related documentation.

@shaayaansayed
Copy link

Facing the same issue on linux machine with python 2.7, using the python installed by anaconda. I'm trying to use pip to install somoclu but getting the 'Warning: training function cannot be imported. Only pre-trained maps can be analyzed' error . Any idea what the issue could be?

@peterwittek
Copy link
Owner

You probably lack a compiler. Either install it from your distribution's repo, or install Anaconda's own by 'conda install gcc'.

@tomekzbrozek
Copy link

@peterwittek did you manage to fix it for Python 3.5, mac OS 64bit? I proceeded with all the tips listed above, and still get the error:

"Warning: training function cannot be imported. Only pre-trained maps can be analyzed.
If you installed Somoclu with pip on OS X, this typically means missing libiomp. Please refer to the documentation and to this issue:
#28"

@peterwittek
Copy link
Owner

The wheel file on PyPI was compiled with Python 3.6. Either upgrade your Python version, or go through the instructions of how to compile it from scratch.

@xgdgsc
Copy link
Collaborator

xgdgsc commented Jul 13, 2017

Sorry currently there is no binary for macOS on pypi now since I have no access to a mac.

@festarju
Copy link

festarju commented Jul 29, 2017

Hi, @xgdgsc & @peterwittek
Thank you for your work!
I tried everything I could imagine, but I sill have problems with the import #83 :

ImportError: failed to import (/home/bdalab/anaconda3/lib/python3.6/site-packages/somoclu-1.7.4-py3.6-linux-x86_64.egg/_somoclu_wrap.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm)

Warning: training function cannot be imported. Only pre-trained maps can be analyzed.

more info: https://a.pomf.space/zilkxsyxitvy.htm

Can you suggest something?

@xgdgsc
Copy link
Collaborator

xgdgsc commented Jul 29, 2017

This usually relates to glibc version, maybe you can try using system python.

@peterwittek
Copy link
Owner

That is precisely the problem. The system GCC and the one that Anaconda was compiled with are different. Either use the system Python or try the experimental conda recipe.

@festarju
Copy link

Thank you @xgdgsc !
I switched to system python (with some downgrading of zlib1g...) and can now compile a binary for CLI & libsomoclu.so (not the _somoclu_wrap.cpython-36m-x86_64-linux-gnu.so)
But what is the trick to get a python module (with pip install somoclu ?) that knows about envvar CUDAHOME?
In jupyter notebook, when
som = somoclu.Somoclu(n_columns, n_rows, compactsupport=False, kerneltype=1)
I get RuntimeError: Compiled without CUDA!

installed with pip:
~/.pyenv/versions/3.6.1/lib/python3.6/site-packages/somoclu-1.7.4-py3.6.egg-info$ cat installed-files.txt
../somoclu/__init__.py
../somoclu/somoclu_wrap.py
../somoclu/train.py
../somoclu/__pycache__/__init__.cpython-36.pyc
../somoclu/__pycache__/somoclu_wrap.cpython-36.pyc
../somoclu/__pycache__/train.cpython-36.pyc
../_somoclu_wrap.cpython-36m-x86_64-linux-gnu.so
dependency_links.txt
requires.txt
SOURCES.txt
PKG-INFO
top_level.txt

@xgdgsc
Copy link
Collaborator

xgdgsc commented Jul 31, 2017

When you run pip install somoclu or python setup.py install , you should run in an environment where variable CUDAHOME has been set.

@festarju
Copy link

I belive I have CUDAHOME set:

group8@bdalab-249:~/git2-somoclu$ python
Python 3.6.1 (default, Jul 30 2017, 15:00:21)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ['CUDAHOME']
'/usr/local/cuda-8.0'

here is the log from my python ./setup.py install
https://a.pomf.space/jwvjtqncqlnw.html

BTW, this I found in setup.py and corrected:
try:
#CUDA = find_cuda()
CUDA = None
except EnvironmentError:
CUDA = None
print("Proceeding without CUDA")

@peterwittek
Copy link
Owner

The log looks fine to me. The CUDA compiler is verbose, but the output is a series of irrelevant warnings.

Please try the conda recipe that we are trying to put together. I just tried it, and if you set CUDAHOME, it compiles with GPU kernel and it works from Anaconda.

@Zub4ir
Copy link

Zub4ir commented Jun 18, 2018

I got this error on my fresh install of Windows 10. An easy fix is to download a "Visual C++ Redistributable for Visual Studio 2015" installer or newer. It contains the OpenMP libraries in an easy single click install.

Edit: Using Windows 10 64bit, Python 3.6.5 64bit, and SOMOCLU via pip3.

@JimmyGao0204
Copy link

I have got the same error as follows:
image
Using Windows 10 64 bit, python 3.5.2 and install somoclu via pip install somoclu.
Does anybody know how to fix this bug?Thank you very much.

@JimmyGao0204
Copy link

@xgdgsc I have not \site-packages_somoclu_wrap.[YOUR ARCH].pyd under my python directory. I have try to add MSVCP90.DLL and VCOMP90.DLL to C:\Windows\System32. But it didn't work. How should I fix this problem.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests