I would like to call C++ functions in python which return uBLAS vector/matrices.
There is a package to do this called PyUblas,
but am having trouble getting this to work in Ubuntu.
Can anyone walk me through the steps to get this sample to work?
Also, I am somewhat confused with the installation instructions. I did not follow the instructions to install boost and numpy since I have already installed them from the Ubuntu repositories.
I guess that wasn't so hard. Here's what I did to run the small sample on the website and in test/samply.py.
After downloading and unpacking PyUblas, and having the necessary libraries installed, cd into PyUblas-VERSION
./configure.py --help
./configure.py --some-options
sudo python setup.py install
cd test/
g++ -I/usr/include/python2.7 -fPIC -g -fpic -shared sample_ext.cpp -lboost_python -lpython2.7 -o sample_ext.so
python sample.py
It's going to be difficult to help without knowing what exactly your issues are. My first guess if the tests aren't working would be that your config file is not pointing to the right directories/files.
Related
I'm working on a project for my graphics class, which the professor provided the base code. He coded it up with our lab computers (Ubuntu 16.04 LTS) in mind. I wanted to work on this project from my own computer at home, but I cant seem to figure out how to run it.
I do know the Makefile he gave us is specific to the lab computers, once again, but I'm not skilled enough to figure out how to alter it for a macOS.
Makefile
CPP = g++ -std=c++11
INC = -I../glslutil -I../mvcutil -I.
C_FLAGS = -fPIC -g -c -DGL_GLEXT_PROTOTYPES $(INC)
LINK = g++ -fPIC -g
LOCAL_UTIL_LIBRARIES = ../lib/libglsl.so
GL_LIB_LOC = -L/usr/lib/nvidia-375
GL_LIBRARIES = $(GL_LIB_LOC) -lglfw -lGLU -lGL
OBJS = project1.o ModelView.o Controller.o GLFWController.o
project1: $(OBJS) $(LOCAL_UTIL_LIBRARIES)
$(LINK) -o project1 $(OBJS) $(LOCAL_UTIL_LIBRARIES) $(GL_LIBRARIES)
../lib/libglsl.so: ../glslutil/ShaderIF.h ../glslutil/ShaderIF.c++
(cd ../glslutil; make)
project1.o: project1.c++
$(CPP) $(C_FLAGS) project1.c++
ModelView.o: ModelView.h ModelView.c++
$(CPP) $(C_FLAGS) ModelView.c++
Controller.o: ../mvcutil/Controller.h ../mvcutil/Controller.c++
$(CPP) $(C_FLAGS) ../mvcutil/Controller.c++
GLFWController.o: ../mvcutil/GLFWController.h
../mvcutil/GLFWController.c++
$(CPP) $(C_FLAGS) ../mvcutil/GLFWController.c++
Although, I'm not even sure that's the problem. I just want to see the graphics on my laptop! :) I appreciate any help!
Overall, I would like to see something similar to this on my mac.
My errors when compiling on my mac.
I, personally, wouldn't go that way, unless you really have to.
I'd go a different path:
download VirtualBox from here: https://www.virtualbox.org/wiki/Downloads
download Ubuntu 16.04 LTS: http://releases.ubuntu.com/16.04/ubuntu-16.04.3-desktop-amd64.iso
ask your teacher what exact packages does he use for the class
install Ubuntu 16.04 inside VirtualBox
install all packages required by your teacher
use VirtualBox installation for this particular class
This way, you will save lots of time and effort.
I suspect this is going to be rather hard to do, and this is only a partial answer, so maybe some other kind folk will know how to do the other half, or 80% - not even sure how much I am missing.
The Makefile looks like it is using glslang and glfw and some Nvidia library. To get some of those packages on a Mac, you would need to:
install Xcode - start AppStore, find and download Xcode for free
install Command Line Tools with xcode-select --install in Terminal
install homebrew - goto Homebrew website
Then you could search for your packages with
brew search glfw
brew search glslang
Then you can find out what the packages are with:
brew info glfw
Sample Output
glfw: stable 3.2.1 (bottled), HEAD
Multi-platform library for OpenGL applications
http://www.glfw.org/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/glfw.rb
==> Dependencies
Build: cmake ✘
==> Options
--with-examples
Build examples
--with-test
Build test programs
--without-shared-library
Build static library only (defaults to building dylib only)
--HEAD
Install HEAD version
Then install it with:
brew install glfw
You will still probably have a load of problems and I cannot find the Nvidia stuff... maybe someone else can add more help.
I have installed mod_wsgi on Ubuntu 14.04 as described in their documentation. While I don't get any errors from Apache or anything my Django setup does not work (no idea why exactly) so I would like to start over and use libapache2-mod-wsgi.
However, I don't know how to uninstall mod_wsgi. This answer to a more general question on the subject advises trying make uninstall which does not work in this case.
make -n install gives me the following output:
/usr/bin/apxs2 -c -I/usr/include/python2.7 -DNDEBUG -D_FORTIFY_SOURCE=2 -Wc,-g -Wc,-O2 src/server/mod_wsgi.c src/server/wsgi_*.c -L/usr/lib -L/usr/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm
/usr/bin/apxs2 -i -S LIBEXECDIR=/usr/lib/apache2/modules -n 'mod_wsgi' src/server/mod_wsgi.la
What exactly do I have to do to uninstall this?
Thanks!
Edit: I'm using mod_wsgi-4.5.3.
Remove any configuration you added to Apache configuration files and also run:
sudo rm /usr/lib/apache2/modules/mod_wsgi.so
I would strongly recommend against using the system provided mod_wsgi package as it is generally out of date by many many versions and is also thus not supported. You are better off using the latest from source code and trying to work out what the problem is, exact details of which you haven't posted.
Installed cygwin64, including Python 2.7, on my new computer running Windows10.
Python runs fine, adding modules like matplotlib or bitstream goes fine, but when trying to add scipy the build eventually, after about an hour, having successfully compiled lots of fortran and C/C++ files, fails with:
error: Setup script exited with error: Command "g++ -fno-strict-aliasing -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/build=/usr/src/debug/python-2.7.10-1 -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/src/Python-2.7.10=/usr/src/debug/python-2.7.10-1 -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/include/python2.7 -I/usr/lib/python2.7/site-packages/numpy/core/include -Iscipy/spatial/ckdtree/src -I/usr/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c scipy/spatial/ckdtree/src/ckdtree_query.cxx -o build/temp.cygwin-2.2.1-x86_64-2.7/scipy/spatial/ckdtree/src/ckdtree_query.o" failed with exit status 1
I've tried both pip install and easy_install, both result in the same error.
Greatful for any hints on what to try next.
I suffered for days with the same issue. My final solution was to install scipy0.15.1: pip install scipy==0.15.1. Hope it works for you too.
I found this while looking for a solution to the same problem but I could not downgrade to 0.15.1 as suggested because of 1.16 dependencies.
The problem is related to infinity having been defined twice in the official v0.16.1 but it only seems to cause issues for a couple platforms.
It was fixed in this commit. https://github.com/scipy/scipy/commit/832baa20f0b5
You should be able to download and compile the master branch from here on cygwin: https://github.com/scipy/scipy
I just finished installing numpy,scipy,scikit-learn,theano on cygwin.
I'm trying to install pygame with cygwin with the step by step below
http://msdl.cs.mcgill.ca/people/tfeng/svmsccdoc/node49.html
Things are going fine until the last part when I'm running theses 3 lines
export LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH
export CPATH=/usr/local/include/SDL:$CPATH
python setup.py install build
I have this issue
gcc -fno-strict-aliasing -ggdb -O2 -pipe -Wimplicit-function-declaration - fdebug-prefix-map=/usr/src/ports/python/python-2.7.8-1.i686/build=/usr/src/debug/python-2.7.8-1 -fdebug-prefix-map=/usr/src/ports/python/python-2.7.8-1.i686/src/Python-2.7.8=/usr/src/debug/python-2.7.8-1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/NEED_INC_PATH_FIX -I/usr/include/python2.7 -c src/imageext.c -o build/temp.cygwin-1.7.33-i686-2.7/src/imageext.o
src/imageext.c:35:21: erreur fatale: jpeglib.h : No such file or directory
#include <jpeglib.h>
As you can see, the file jpeglib.h is missing
I tried to install the missing file by downloading the lib
apt-cyg install libjpeg62
But to no avail
Does anyone have seen that issue before? I browsed the net but found nothing relevant.
TIA
libjpeg62 doesn't have jpeglib.h. You need libjpeg-devel instead.
You can search for specific files in packages using the package search function on the Cygwin website.
You can download an already compiled version of PyGame and skip these steps. This can be painful sometimes.
Just check this page : http://www.lfd.uci.edu/~gohlke/pythonlibs/
or
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame , to get directly to PyGame section.
The Python extension unofficial windows binaries. You can find alot of Python libraries on this page.
Using theses packages will make you save a lot of time.
I'm trying to call R from c++ on linux via RInside, I compiled R-2.15.1 from source with gcc version 4.5.3 (Debian 4.5.3-1) , I don't have sudo rights to use apt-get install. I'm using OpenBlas and a system optimized lapack. The blas and lapack libraries work fine for many scalapack applications
I installed R with
./configure --with-blas="-I/lib/OpenBLAS-v0.2.3-0/xianyi-OpenBLAS-48f075c/install/include -L/lib/OpenBLAS-v0.2.3-0/xianyi-OpenBLAS-48f075c/install/lib -lopenblas -lgfortran" --with-lapack="/usr/lib/liblapack.so -lgfortran" --enable-BLAS-shlib=yes --enable-R-shlib --enable-R-static-lib --prefix= .
which installed and runs fine,I ran make check with no errors, also all the packages (Rcpp and RInside) installed fine..
however when i use the given RInside makefile , the basic hello world example from /standard/rinside_sample0.cpp compiles! but it does not run and i get the following error
./rinside_sample0: error while loading shared libraries: libRblas.so: cannot open shared object file: No such file or directory
the file libRblas.so exists and is in the R/lib folder,
when i try to link it manually with the g++ command the make file creates or linking as follows i get a segmentation fault
/R/lib/libRblas.so ./hello_world
Segmentation fault
EDIT: heres how the example make file tries to compile an example, (which compiles fine) but won't run with the above missing libRblas.so error
g++ -I/nfs/user03/jimmie21/libs/lib64/R/include -I/nfs/user03/jimmie21/libs/lib64/R/library/Rcpp/include -I/nfs/user03/jimmie21/libs/lib64/R/library/RInside/include -g -O2 -Wall -I/usr/local/include hello_world.cpp -L/nfs/user03/jimmie21/libs/lib64/R/lib -lR -L/nfs/user03/jimmie21/libs/lib64/R/lib -lRblas -L/nfs/user03/jimmie21/libs/lib64/R/lib -lRlapack -L/nfs/user03/jimmie21/libs/lib64/R/lib -lRblas -L/nfs/user03/jimmie21/libs/lib64/R/library/Rcpp/lib -lRcpp -Wl,-rpath,/nfs/user03/jimmie21/libs/lib64/R/library/Rcpp/lib -L/nfs/user03/jimmie21/libs/lib64/R/library/RInside/lib -lRInside -Wl,-rpath,/nfs/user03/jimmie21/libs/lib64/R/library/RInside/lib -o hello_world
Couple of things:
Reproducible examples, please
You have a non-standard setup
With the script from 1), try it on a standard setting as that is how Rcpp / RInside get developed and tested (on Ubuntu / Debian)
The Rcpp test suite now contains almost 800 unit tests from around 350 unit test functions. These do not seg.fault, so the issue is at your end. Similarly, RInside has dozens of examples in the four examples/ subdirectories. This also works.
It may be as easy as tweaking the Makefile / Makevars files to make sure you get your libraries in all cases. But we can't tell as there is nothing reproducible here.
Edit If you want to link with libRblas.so then you have a completely non-standard setup as the R packages for Debian / Ubuntu as use the external BLAS. Again, not an RInside issue.
I fixed the problem by adding the R install path lib ../R/lib: to the beginning of LD_LIBRARY_PATH after that all the examples compiled and run fine