hughperkins / pytorch

Python wrappers for torch and lua
BSD 2-Clause "Simplified" License
431 stars 70 forks source link

Install completes but tests fail: version `GOMP_4.0' not found #28

Open cjmcmurtrie opened 7 years ago

cjmcmurtrie commented 7 years ago

Hi Hugh,

I'm attempting an install on a new GTX1070, Ubuntu 16.10, CUDA 8.0, NVIDIA 367 (it took some research to get this working finally with cutorch and cunn).

Installing PyTorch completes like so:

Uninstalling PyTorch-4.1.1-SNAPSHOT:
  Successfully uninstalled PyTorch-4.1.1-SNAPSHOT
Traceback (most recent call last):
  File "/home/cjmcmurtrie/anaconda/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/home/cjmcmurtrie/anaconda/lib/python2.7/site-packages/pip/__init__.py", line 233, in main
    return command.main(cmd_args)
  File "/home/cjmcmurtrie/anaconda/lib/python2.7/site-packages/pip/basecommand.py", line 252, in main
    pip_version_check(session)
  File "/home/cjmcmurtrie/anaconda/lib/python2.7/site-packages/pip/utils/outdated.py", line 102, in pip_version_check
    installed_version = get_installed_version("pip")
  File "/home/cjmcmurtrie/anaconda/lib/python2.7/site-packages/pip/utils/__init__.py", line 838, in get_installed_version
    working_set = pkg_resources.WorkingSet()
  File "/home/cjmcmurtrie/anaconda/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 644, in __init__
    self.add_entry(entry)
  File "/home/cjmcmurtrie/anaconda/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 700, in add_entry
    for dist in find_distributions(entry, True):
  File "/home/cjmcmurtrie/anaconda/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1949, in find_eggs_in_zip
    if metadata.has_metadata('PKG-INFO'):
  File "/home/cjmcmurtrie/anaconda/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1463, in has_metadata
    return self.egg_info and self._has(self._fn(self.egg_info, name))
  File "/home/cjmcmurtrie/anaconda/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1823, in _has
    return zip_path in self.zipinfo or zip_path in self._index()
  File "/home/cjmcmurtrie/anaconda/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1703, in zipinfo
    return self._zip_manifests.load(self.loader.archive)
  File "/home/cjmcmurtrie/anaconda/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1643, in load
    mtime = os.stat(path).st_mtime
OSError: [Errno 2] No such file or directory: '/home/cjmcmurtrie/.local/lib/python2.7/site-packages/PyTorch-4.1.1_SNAPSHOT-py2.7-linux-x86_64.egg'
-- The C compiler identification is GNU 4.9.4
-- The CXX compiler identification is GNU 4.9.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Torch7 in /home/cjmcmurtrie/torch/install
-- Configuring done
-- Generating done
-- Build files have been written to: /home/cjmcmurtrie/pytorch/cbuild
Scanning dependencies of target PyTorchNative
[ 66%] Building CXX object CMakeFiles/PyTorchNative.dir/src/nnWrapper.cpp.o
[ 66%] Building CXX object CMakeFiles/PyTorchNative.dir/src/LuaHelper.cpp.o
[100%] Linking CXX shared library libPyTorchNative.so
[100%] Built target PyTorchNative
Install the project...
-- Install configuration: "Debug"
-- Installing: /home/cjmcmurtrie/torch/install/lib/libPyTorchNative.so
-- Set runtime path of "/home/cjmcmurtrie/torch/install/lib/libPyTorchNative.so" to "$ORIGIN/../lib:/home/cjmcmurtrie/torch/install/lib:/opt/OpenBLAS/lib"
torch_install: /home/cjmcmurtrie/torch/install
os family Linux
/home/cjmcmurtrie/anaconda/lib/python2.7/site-packages/setuptools-27.2.0-py2.7.egg/setuptools/dist.py:340: UserWarning: The version specified ('4.1.1-SNAPSHOT') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
running install
running bdist_egg
running egg_info
writing requirements to src/PyTorch.egg-info/requires.txt
writing src/PyTorch.egg-info/PKG-INFO
writing top-level names to src/PyTorch.egg-info/top_level.txt
writing dependency_links to src/PyTorch.egg-info/dependency_links.txt
reading manifest file 'src/PyTorch.egg-info/SOURCES.txt'
writing manifest file 'src/PyTorch.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying src/floattensor.py -> build/lib.linux-x86_64-2.7
copying src/PyTorchAug.py -> build/lib.linux-x86_64-2.7
copying src/PyTorchHelpers.py -> build/lib.linux-x86_64-2.7
copying src/PyTorchLua.py -> build/lib.linux-x86_64-2.7
running build_ext
building 'lua' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/cjmcmurtrie/torch/install/include/TH -Ithirdparty/lua-5.1.5/src -I/home/cjmcmurtrie/torch/install/include -I/home/cjmcmurtrie/anaconda/include/python2.7 -c src/lua.cpp -o build/temp.linux-x86_64-2.7/src/lua.o -std=c++0x -Wno-unused-function -Wno-unreachable-code -Wno-strict-prototypes
cc1plus: warning: command line option ‘-Wno-strict-prototypes’ is valid for C/ObjC but not for C++
g++ -pthread -shared -L/home/cjmcmurtrie/anaconda/lib -Wl,-rpath=/home/cjmcmurtrie/anaconda/lib,--no-as-needed build/temp.linux-x86_64-2.7/src/lua.o -L/home/cjmcmurtrie/torch/install/lib -L/home/cjmcmurtrie/anaconda/lib -Wl,-R/home/cjmcmurtrie/torch/install/lib -lPyTorchNative -lpython2.7 -o build/lib.linux-x86_64-2.7/lua.so
building 'Storage' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/cjmcmurtrie/torch/install/include/TH -Ithirdparty/lua-5.1.5/src -I/home/cjmcmurtrie/torch/install/include -I/home/cjmcmurtrie/anaconda/include/python2.7 -c src/Storage.cpp -o build/temp.linux-x86_64-2.7/src/Storage.o -std=c++0x -Wno-unused-function -Wno-unreachable-code -Wno-strict-prototypes
cc1plus: warning: command line option ‘-Wno-strict-prototypes’ is valid for C/ObjC but not for C++
g++ -pthread -shared -L/home/cjmcmurtrie/anaconda/lib -Wl,-rpath=/home/cjmcmurtrie/anaconda/lib,--no-as-needed build/temp.linux-x86_64-2.7/src/Storage.o -L/home/cjmcmurtrie/torch/install/lib -L/home/cjmcmurtrie/anaconda/lib -Wl,-R/home/cjmcmurtrie/torch/install/lib -lPyTorchNative -lpython2.7 -o build/lib.linux-x86_64-2.7/Storage.so
building 'PyTorch' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/cjmcmurtrie/torch/install/include/TH -Ithirdparty/lua-5.1.5/src -I/home/cjmcmurtrie/torch/install/include -I/home/cjmcmurtrie/anaconda/include/python2.7 -c src/PyTorch.cpp -o build/temp.linux-x86_64-2.7/src/PyTorch.o -std=c++0x -Wno-unused-function -Wno-unreachable-code -Wno-strict-prototypes
cc1plus: warning: command line option ‘-Wno-strict-prototypes’ is valid for C/ObjC but not for C++
g++ -pthread -shared -L/home/cjmcmurtrie/anaconda/lib -Wl,-rpath=/home/cjmcmurtrie/anaconda/lib,--no-as-needed build/temp.linux-x86_64-2.7/src/PyTorch.o -L/home/cjmcmurtrie/torch/install/lib -L/home/cjmcmurtrie/anaconda/lib -Wl,-R/home/cjmcmurtrie/torch/install/lib -lPyTorchNative -lpython2.7 -o build/lib.linux-x86_64-2.7/PyTorch.so
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.7/PyTorchHelpers.py -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.7/PyTorchLua.py -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.7/floattensor.py -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.7/lua.so -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.7/PyTorchAug.py -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.7/PyTorch.so -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.7/Storage.so -> build/bdist.linux-x86_64/egg
byte-compiling build/bdist.linux-x86_64/egg/PyTorchHelpers.py to PyTorchHelpers.pyc
byte-compiling build/bdist.linux-x86_64/egg/PyTorchLua.py to PyTorchLua.pyc
byte-compiling build/bdist.linux-x86_64/egg/floattensor.py to floattensor.pyc
byte-compiling build/bdist.linux-x86_64/egg/PyTorchAug.py to PyTorchAug.pyc
creating stub loader for lua.so
creating stub loader for Storage.so
creating stub loader for PyTorch.so
byte-compiling build/bdist.linux-x86_64/egg/lua.py to lua.pyc
byte-compiling build/bdist.linux-x86_64/egg/Storage.py to Storage.pyc
byte-compiling build/bdist.linux-x86_64/egg/PyTorch.py to PyTorch.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying src/PyTorch.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying src/PyTorch.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying src/PyTorch.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying src/PyTorch.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying src/PyTorch.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/PyTorch-4.1.1_SNAPSHOT-py2.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing PyTorch-4.1.1_SNAPSHOT-py2.7-linux-x86_64.egg
Copying PyTorch-4.1.1_SNAPSHOT-py2.7-linux-x86_64.egg to /home/cjmcmurtrie/.local/lib/python2.7/site-packages
Adding PyTorch 4.1.1-SNAPSHOT to easy-install.pth file

Installed /home/cjmcmurtrie/.local/lib/python2.7/site-packages/PyTorch-4.1.1_SNAPSHOT-py2.7-linux-x86_64.egg
Processing dependencies for PyTorch===4.1.1-SNAPSHOT
Searching for numpy==1.11.1
Best match: numpy 1.11.1
Adding numpy 1.11.1 to easy-install.pth file

Using /home/cjmcmurtrie/anaconda/lib/python2.7/site-packages
Finished processing dependencies for PyTorch===4.1.1-SNAPSHOT

However the following tests fail, complaining that versionGOMP_4.0' not found` (related to gcc version? I have 4.9 with I thought was correct):

------------ generated xml file: /home/cjmcmurtrie/pytorch/test/junit-pytest-report.xml -------------
====================================== short test summary info ======================================
ERROR test/testByteTensor.py
ERROR test/test_call_lua.py
ERROR test/testDoubleTensor.py
ERROR test/testFloatTensor.py
ERROR test/testLongTensor.py
ERROR test/test_nnx.py
ERROR test/test_pynn.py
ERROR test/test_pytorch.py
ERROR test/test_pytorch_refcount.py
ERROR test/test_save_load.py
ERROR test/test_throw.py
============================================== ERRORS ===============================================
______________________________ ERROR collecting test/testByteTensor.py ______________________________
test/testByteTensor.py:2: in <module>
    import PyTorch
build/bdist.linux-x86_64/egg/PyTorch.py:7: in <module>
    ???
build/bdist.linux-x86_64/egg/PyTorch.py:6: in __bootstrap__
    ???
E   ImportError: /home/cjmcmurtrie/anaconda/lib/libgomp.so.1: version `GOMP_4.0' not found (required by /home/cjmcmurtrie/torch/install/lib/../lib/libTH.so.0)
______________________________ ERROR collecting test/test_call_lua.py _______________________________
test/test_call_lua.py:1: in <module>
    import PyTorch
build/bdist.linux-x86_64/egg/PyTorch.py:7: in <module>
    ???
build/bdist.linux-x86_64/egg/PyTorch.py:6: in __bootstrap__
    ???
E   ImportError: /home/cjmcmurtrie/anaconda/lib/libgomp.so.1: version `GOMP_4.0' not found (required by /home/cjmcmurtrie/torch/install/lib/../lib/libTH.so.0)
_____________________________ ERROR collecting test/testDoubleTensor.py _____________________________
test/testDoubleTensor.py:2: in <module>
    import PyTorch
build/bdist.linux-x86_64/egg/PyTorch.py:7: in <module>
    ???
build/bdist.linux-x86_64/egg/PyTorch.py:6: in __bootstrap__
    ???
E   ImportError: /home/cjmcmurtrie/anaconda/lib/libgomp.so.1: version `GOMP_4.0' not found (required by /home/cjmcmurtrie/torch/install/lib/../lib/libTH.so.0)
_____________________________ ERROR collecting test/testFloatTensor.py ______________________________
test/testFloatTensor.py:2: in <module>
    import PyTorch
build/bdist.linux-x86_64/egg/PyTorch.py:7: in <module>
    ???
build/bdist.linux-x86_64/egg/PyTorch.py:6: in __bootstrap__
    ???
E   ImportError: /home/cjmcmurtrie/anaconda/lib/libgomp.so.1: version `GOMP_4.0' not found (required by /home/cjmcmurtrie/torch/install/lib/../lib/libTH.so.0)
______________________________ ERROR collecting test/testLongTensor.py ______________________________
test/testLongTensor.py:2: in <module>
    import PyTorch
build/bdist.linux-x86_64/egg/PyTorch.py:7: in <module>
    ???
build/bdist.linux-x86_64/egg/PyTorch.py:6: in __bootstrap__
    ???
E   ImportError: /home/cjmcmurtrie/anaconda/lib/libgomp.so.1: version `GOMP_4.0' not found (required by /home/cjmcmurtrie/torch/install/lib/../lib/libTH.so.0)
_________________________________ ERROR collecting test/test_nnx.py _________________________________
test/test_nnx.py:2: in <module>
    import PyTorch
build/bdist.linux-x86_64/egg/PyTorch.py:7: in <module>
    ???
build/bdist.linux-x86_64/egg/PyTorch.py:6: in __bootstrap__
    ???
E   ImportError: /home/cjmcmurtrie/anaconda/lib/libgomp.so.1: version `GOMP_4.0' not found (required by /home/cjmcmurtrie/torch/install/lib/../lib/libTH.so.0)
________________________________ ERROR collecting test/test_pynn.py _________________________________
test/test_pynn.py:2: in <module>
    import PyTorch
build/bdist.linux-x86_64/egg/PyTorch.py:7: in <module>
    ???
build/bdist.linux-x86_64/egg/PyTorch.py:6: in __bootstrap__
    ???
E   ImportError: /home/cjmcmurtrie/anaconda/lib/libgomp.so.1: version `GOMP_4.0' not found (required by /home/cjmcmurtrie/torch/install/lib/../lib/libTH.so.0)
_______________________________ ERROR collecting test/test_pytorch.py _______________________________
test/test_pytorch.py:5: in <module>
    import PyTorch
build/bdist.linux-x86_64/egg/PyTorch.py:7: in <module>
    ???
build/bdist.linux-x86_64/egg/PyTorch.py:6: in __bootstrap__
    ???
E   ImportError: /home/cjmcmurtrie/anaconda/lib/libgomp.so.1: version `GOMP_4.0' not found (required by /home/cjmcmurtrie/torch/install/lib/../lib/libTH.so.0)
__________________________ ERROR collecting test/test_pytorch_refcount.py ___________________________
test/test_pytorch_refcount.py:2: in <module>
    import PyTorch
build/bdist.linux-x86_64/egg/PyTorch.py:7: in <module>
    ???
build/bdist.linux-x86_64/egg/PyTorch.py:6: in __bootstrap__
    ???
E   ImportError: /home/cjmcmurtrie/anaconda/lib/libgomp.so.1: version `GOMP_4.0' not found (required by /home/cjmcmurtrie/torch/install/lib/../lib/libTH.so.0)
______________________________ ERROR collecting test/test_save_load.py ______________________________
test/test_save_load.py:2: in <module>
    import PyTorch
build/bdist.linux-x86_64/egg/PyTorch.py:7: in <module>
    ???
build/bdist.linux-x86_64/egg/PyTorch.py:6: in __bootstrap__
    ???
E   ImportError: /home/cjmcmurtrie/anaconda/lib/libgomp.so.1: version `GOMP_4.0' not found (required by /home/cjmcmurtrie/torch/install/lib/../lib/libTH.so.0)
________________________________ ERROR collecting test/test_throw.py ________________________________
test/test_throw.py:1: in <module>
    import PyTorchHelpers
build/bdist.linux-x86_64/egg/PyTorchHelpers.py:1: in <module>
    ???
build/bdist.linux-x86_64/egg/PyTorch.py:7: in <module>
    ???
build/bdist.linux-x86_64/egg/PyTorch.py:6: in __bootstrap__
    ???
E   ImportError: /home/cjmcmurtrie/anaconda/lib/libgomp.so.1: version `GOMP_4.0' not found (required by /home/cjmcmurtrie/torch/install/lib/../lib/libTH.so.0)
================================ 11 passed, 11 error in 0.52 seconds ================================

And a load_lua_class import complains about the same thing:

>>> from PyTorchHelpers import load_lua_class
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/PyTorchHelpers.py", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/PyTorch.py", line 7, in <module>
  File "build/bdist.linux-x86_64/egg/PyTorch.py", line 6, in __bootstrap__
ImportError: /home/cjmcmurtrie/anaconda/lib/libgomp.so.1: version `GOMP_4.0' not found (required by /home/cjmcmurtrie/torch/install/lib/../lib/libTH.so.0)

Any suggestions? Thanks!

cjmcmurtrie commented 7 years ago

I believe this is something to do with pointing at anaconda/lib/libgomp package instead of system packages, but I have not seen this issue before after many installs of PyTorch on Ubuntu 14.04, CUDA 7.5, in Anaconda environment.

Edit:

I did a fresh PyTorch install after deactivating Anaconda. Like this all tests passed.

I have a feeling Anaconda gcc is too old for latest CUDA 8.0 dependencies, but it's not my area of expertise so not sure. Would love you hear your thoughts before I close the issue.

pablotcarreira commented 7 years ago

I had the same problem but with /usr/local/lib/python3.5/dist-packages/torch/lib/libgomp.so.1 . I removed it and for now it's working fine, I think it now uses /usr/lib/x86_64-linux-gnu/libgomp.so.1 installed by the system.

This solution was based on this question http://stackoverflow.com/questions/39017485/openmp-linux-gomp-4-0-not-found .

(Ubuntu 16.04, Python 3.5)

prhbrt commented 7 years ago

Mine was in my homedir, as I'm using virtualenvs, but same idea as @pablotcarreira:

mv ~/.virtualenvs/pat/lib/python3.5/site-packages/torch/lib/libgomp.so.1{,.backup20170703}
hughperkins commented 7 years ago

Cool.

Happy to see a conda package created, if someone wants to create one by the way :-)

saurabhbh21 commented 7 years ago

Thanks, @pablotcarreira , worked for me.