Installing version of cunn from GitHub and using multilabelmargin criterion - machine-learning

I need to use multilabelmargin criterion in torch7 to train a CNN. It is not supported by the current cunn. I have tried installing a different version of cunn, as here: source
git clone https://github.com/clementfarabet/cunn -b master
cd cunn
Luarocks make rocks/cunn-scm-1.rockspec
However, when I do, torch stops working and I get the error:
make[1]: *** [CMakeFiles/cunn.dir/all] Error 2
make: *** [all] Error 2
I subsequently needed to reinstall torch7 using ezinstall. How can I correctly install the version of cunn required, without affecting my torch installation, and therefore use multilabelmargin?

Related

EEXIST 17 error while installing opencv using conda on windows

I am trying to install opencv using conda on a windows machine. I am running the following command:
conda install --channel https://conda.anaconda.org/menpo opencv
and getting the following error:
Solving environment: done
## Package Plan ##
environment location: C:\ProgramData\Anaconda2
added / updated specs:
- opencv
The following NEW packages will be INSTALLED:
opencv: 2.4.11-py27_1 menpo
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: - WARNING conda.gateways.disk:exp_backoff_fn(49):
Uncaught backoff with errno EEXIST 17
failed
ERROR conda.core.link:_execute(502): An error occurred while installing
package 'None'.
IOError(13, 'Permission denied')
Attempting to roll back.
Rolling back transaction: done
IOError(13, 'Permission denied')
WindowsError(183, 'Cannot create a file when that file already exists')
Other people seem to have similar problems (https://github.com/conda/conda/issues/4393). One of the solutions I found was to downgrade conda. I am currently using conda 4.5.4 and when I try to downgrade using conda install conda=4.2 I get the following error:
The following packages will be DOWNGRADED:
conda: 4.5.4-py27_0 --> 4.2.16-py27_0
conda-build: 3.10.5-py27_0 --> 3.9.2-py27_0
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: failed
ERROR conda.core.link:_execute(502): An error occurred while uninstalling
package 'defaults::conda-build-3.10.5-py27_0'.
WindowsError(5, 'Access is denied')
Attempting to roll back.
Rolling back transaction: done
WindowsError(5, 'Access is denied')
Regarding this issue I found the following similar posts:
conda update conda permission error
Anaconda : Update conda failed because permission error
But the solutions given do not fix my problem.
I also had a problem with installation and usage of the OpenCV library. If you have such а problem, you can try:
uninstall opencv with: conda remove --yes opencv (in case you have an installation but it does not work properly)
install OpenCV through pip: pip install opencv-python
I think this is a problem with opencv that comes from Anaconda channels. I came across this problem four months ago. Тhe problem may be resolved right now.
My guess is that you did not run this command with administrator privileges!

opencv-3.3.0 Stops compiling at 58%

I'm compiling opencv for Rasbian Stretch, running on the Pi 3b.
It compiled all the way to 58% before outputting this error.
Anybody familiar with the error and how to correct it?
[58%]Linking CXX shared library ../../lib/libopencv_datasets.so
CMakeFiles/opencv_datasets.dir/src/gr_chalearn.cpp.o: file not recognized: File truncated
collect2: error: id returned 1 exit status
modules/datasets/CMakeFiles/opencv_datasets.dir/build.make:858: recipe for target 'lib/libopencv_datasets.so.3.3.0' failed
make[2]: * [lib/libopencv_datasets.so.3.3.] Error 1
CMakeFiles/Makefile2:14481: recipe for target 'modules/datasets/CmakeFiles/opencv_datasets.dir/all' failed
make[1]: * [modules/datasets/CMakeFiles/opencv_datasets.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make *** [all] Error 2
I solved this issue by downloading opencv-3.4 and running make with -j4
Building OpenCV binaries on officially supported Ubuntu/Linux based operating systems has always been a little more troublesome than normal images. One of the core reasons is the visual graphics (mostly, but not limited to) used by these distributions are different than general ones. You'll find some similar errors while installing it on LXDE based Ubuntu distributions, for the same reason. I spotted different errors for the same method on Ubuntu 18.04 Gnome, Ubuntu 18.04 LXDE, Ubuntu 16.04 LXDE, and Raspbian OS. Having said that, there are always solutions available.
Please check this link for libraries required. Make sure you have all the repositories added which are required for installation. You must look extremely carefully for these libraries:
libgsteramer1.0-dev, libgstreamer1.0-plugins-base-dev & libgstreamer1.0-base-dev.
libprotobuf-dev & protobuf-compliler
libatlas-base-dev
libjasper-dev (this one for wheezy, you'll need to enable repository)
libfaac-dev
These libraries will be required and a test will run on them during CMake. Some of them have a lot of dependency issues like libpng-dev and libtheora-dev. If you can paste the initial part of your CMake build, we can pin-point those libraries.

What CUDA version does torch/lua require?

I'm trying to install Torch/Lua version and am getting the build errors shown below. I see this discussion on Github encountering the same errors, but I don't see a resolution to it.
https://github.com/torch/torch7/issues/670
What version of CUDA does torch require? My best guess right now is that this is a CUDA version mismatch.
CMake Error at THC_generated_THCBlas.cu.o.cmake:267 (message):
Error generating file
~/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCBlas.cu.o
CMake Error at THC_generated_THCSleep.cu.o.cmake:267 (message):
Error generating file
~/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCSleep.cu.o
lib/THC/CMakeFiles/THC.dir/build.make:392: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCBlas.cu.o' failed
make[2]: *** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCBlas.cu.o] Error 1
It appears that these issues were related to the g++ version I had (4.8). I installed the latest g++ version (5.2), then had to delete the torch directory, re-clone it, and the installation worked. Note that build artifacts will be left over so actually removing the whole torch directory was necessary.

Can't find location of libopencv_core.so.3.4.0 even though program is installed and working perfectly

I installed the openCV library through apt-get. I am trying to install the BGSLibrary and the cmake file tries to find " /usr/local/lib/libopencv_core.so.3.4.0" The script fails and looking manually the folder isn't there. I have tried searching for it and nothing is turning, infact nothing is turning up for openCV, apart from a folder in usr/local/share which only contains a few cmake files and folders about the haar cascade. I don't even know where openCV is installed even though it is working perfectly.
I am using python 2.7 with openCV 3.4.0
Its important to have your cMake report (outputlog file) up to the error reporting included into your question without it a black box is presented. Anyhow.. a shot for the bow below.
Look into your cMake output/log for:
CMakeFiles/Makefile2:123456: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed.
followed by something like:
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
make[1]: Leaving directory '/tmp/opencv32018MMDD7-12345-abcdefg/opencv-3.4.0/>OS system <'
Makefile:123: recipe for target 'all' failed
make: *** [all] Error 2
Then see if below is showing up:
make[2]: *** No rule to make target '/libpython2.7.so', needed by 'lib/cv2.so'. Stop.
If so you need to check CMake/Modules/FindPythonLibs.cmake
file what to do. Github check here at L30-L35 in the cMake pythonlib file what to do exactly to set python lib path correctly... to prevent a cascade of underlying errors.
...but as no cMake output/log file was given and OS remains undetermined ..its a shot in the dark. Nevertheless, I hope it points you in the right direction how to fix it.

installing hdf5, mattorch/matio for lua/torch

I am configuring the packages for torch.I can't install these packages using luarocks.
for the matio, I followed the instruction on github, the matio is installed. But I cannot require it.
for the hdf5,see following.
Does anyone know what is the problem? I am new to Lua. Thanks very much!
$luarocks install hdf5
then I got the error information:
CMake Error at /usr/local/Cellar/cmake/3.5.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find HDF5: Found unsuitable version "", but required is at least
"1.8" (found HDF5_hdf5_LIBRARY-NOTFOUND)
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.5.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:386 (_FPHSA_FAILURE_MESSAGE)
/usr/local/Cellar/cmake/3.5.1/share/cmake/Modules/FindHDF5.cmake:398 (find_package_handle_standard_args)
CMakeLists.txt:4 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
See also "/tmp/luarocks_hdf5-20-0-5408/torch-hdf5/build/CMakeFiles/CMakeOutput.log".
make: *** No targets specified and no makefile found. Stop.
Error: Build error: Failed building.
I encountered the same problem on ubuntu >= 13.04, this command solves my problem:
sudo apt-get install libhdf5-serial-dev hdf5-tools
Then you can use luarocks to install hdf5
luarocks install hdf5
For other systems, you can reference this link for dependencies.

Resources