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

importing octant.csa #4

Open
fagundesmo opened this issue Dec 8, 2014 · 3 comments
Open

importing octant.csa #4

fagundesmo opened this issue Dec 8, 2014 · 3 comments

Comments

@fagundesmo
Copy link

Dear Dr. Hetland,

I am new octant user and I've just installed octant successfully. However, I have been facing a problem when importing octant.csa, it keeps me showing this error:

OSError Traceback (most recent call last)
in ()
----> 1 import octant.csa

/usr/local/lib/python2.7/dist-packages/octant/csa.py in ()
7 import octant
8
----> 9 class CSA(object):
10 '''cubic spline approximation for re-gridding 2D data sets
11

/usr/local/lib/python2.7/dist-packages/octant/csa.py in CSA()
59 '''
60
---> 61 _csa = np.ctypeslib.load_library('_csa', '/usr/local/lib/python2.7/dis-packages/octant')
62
63

/usr/lib/python2.7/dist-packages/numpy/ctypeslib.pyc in load_library(libname, loader_path)
134 raise
135 ## if no successful return in the libname_ext loop:
--> 136 raise OSError("no file with expected extension")
137
138 ctypes_load_library = deprecate(load_library, 'ctypes_load_library',

OSError: no file with expected extension

Even though, all libs have been installed in their default path (/usr/local/) and csa's path had been changed before I compiled octant. Would you have any idea what it's going on?

Cheers,

Matheus

@garciaga
Copy link

garciaga commented May 4, 2016

I just ran into the same problem. I know this is an old issue but I will write my workaround here for future reference.

To fix it I had to download csa from sakov's github and install it. This generates a libcsa.so which I copied to:

/path/to/my/python/installation/lib/python2.7/site-packages/octant/

as _csa.so

For example in the terminal
cp /path/to/csa/lib/libcsa.so /path/site-packages/octant/_csa.so

It seems to be working so far, I'll report back if I run into issues.

Cheers,

Gabriel

@fagundesmo
Copy link
Author

Hi Gabriel,

let me see if I can help you. I have some notes on how I installed it in
portuguese that I did while I was trying to install. However, I installed
it under Ubuntu using gfortran (I'm not sure what your operational system
is). Considering, you're running the installation in the same conditions
that I installed.

svn checkout http://gridgen-c.googlecode.com/svn/gridgen gridgen
svn checkout http://gridutils-c.googlecode.com/svn/ gridutils
svn checkout http://csa-c.googlecode.com/svn/ csa
svn checkout http://nn-c.googlecode.com/svn/ nn

cd nn/nn/
export FC=gfortran
export F77=gfortran
export CC=gcc
export CXX=g++
./configure --prefix=/home/mf/libsmodels
make
make install

cd ../../csa/csa/
export FC=gfortran
export F77=gfortran
export CC=gcc
export CXX=g++
./configure --prefix=/home/mf/libsmodels
make
make install

Na pasta csa terá um arquivo chamado csa.o, faça:
cp csa.o ../../../../../../libsmodels/lib/

cd ../../gridutils/gridutils/
export FC=gfortran
export F77=gfortran
export CC=gcc
export CXX=g++
./configure --prefix=/home/mf/libsmodels
CPPFLAGS=-I/home/mf/libsmodels/include LDFLAGS=-L/home/mf/libsmodels/lib
make
make install

cd ../../gridgen/
export FC=gfortran
export F77=gfortran
export CC=gcc
export CXX=g++
./configure -prefix=/home/mf/libsmodels
CPPFLAGS=-I/home/mf/libsmodels/include LDFLAGS=-L/home/mf/libsmodels/lib

gedit makefile &

Replace in the makefile with the settings below:
gedit makefile &
CFLAGS = -g -O2 -Wall -I/home/mf/libsmodels/include
LDFLAGS = -L/home/mf/libsmodels/lib
LIBS = -lgu -lm -L/home/mf/libsmodels/lib

Close and sabe e keep following the commands below

make
make lib
make shlib
make install

cd ../../../octant/
cd octant/

Modify in grid.py as showed below in the line ~898 (double check it)

gedit grid.py &

    self._libgridgen = np.ctypeslib.load_library('libgridgen.so',

'/home/mf/libsmodels/lib')
#print octant.path[0]
#self._libgridgen = np.ctypeslib.load_library('_gridgen',
octant.path[0])

save and close it. Afterwards, do one last modification:

cd ../
python setup.py build --fcompiler=gfortran

now in the dir ~/octant/octant/ open the file csa.py and modify with the
same below:

_csa = np.ctypeslib.load_library('csa.o',

'/home/mf/libsmodels/libs(substitute
with your path)
')

Save and close it, go back to the dir

cd ../
python setup.py install --prefix=/home/mf/pythonmodels/octant

Adding the paths on .bashrc
export PYTHONPATH=$PYTHONPATH:/home/mf/pythonmodels/octant
export PYTHONPATH=$PYTHONPATH:/home/mf/pythonmodels/octant/include
export
PYTHONPATH=$PYTHONPATH:/home/mf/pythonmodels/octant/lib/python2.7/site-packages
export PYTHONPATH=$PYTHONPATH:/home/mf/pythonmodels/octant/lib

Sorry for my mistakes in english, I hope that can help you set everything
correct.

Cheers,

Matheus

  •                                                        Matheus
    

    Fagundes, aluno de graduação*

  •                              Laboratório de Hidrodinâmica Costeira,
    

    Estuarina e de Águas Interiores - LHICEAI*

  •                                                    Departamento de
    

    Oceanografia e Limnologia - DEOLI*

  •                                                      Centro de
    

    Ciências Biológicas e da Saúde - CCBS**
    Universidade Federal do Maranhão - UFMA*

On Wed, May 4, 2016 at 5:13 PM, Gabriel García Medina <
notifications@github.com> wrote:

I just ran into the same problem. I know this is an old issue but I will
write my workaround here for future reference.

To fix it I had to download csa from sakov's github and install it. This
generates a libcsa.so which I copied to:

/path/to/my/python/installation/lib/python2.7/site-packages/octant/

as _csa.so

For example in the terminal
cp /path/to/csa/lib/libcsa.so /path/site-packages/octant/_csa.so

It seems to be working so far, I'll report back if I run into issues.

Cheers,

Gabriel


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#4 (comment)

@drf5n
Copy link

drf5n commented Jan 24, 2018

The googlecode links listed above seem broken, but you can do a recent version of csa-c with:

git clone https://github.com/sakov/csa-c.git
pushd csa-c/csa
./configure --prefix=$CONDA_PREFIX # or whereever
make clean install
popd

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

3 participants