Ocean Modeling Discussion

ROMS/TOMS

Search for:
It is currently Fri Jul 19, 2019 2:28 pm




Post new topic Reply to topic  [ 13 posts ] 

All times are UTC

Author Message
 Post subject: PYROMS error
PostPosted: Tue Dec 11, 2018 1:00 pm 
Offline

Joined: Mon Dec 19, 2016 8:04 pm
Posts: 2
Location: JNU
I have installed pyroms using python 2.7 in conda. The installation was successful but I am not being able to import pyroms to check whether it is installed or not. It give the error as following:

>>> import pyroms
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ROMS/anaconda2/lib/python2.7/site-packages/pyroms/__init__.py", line 13, in <module>
from . import extern
File "/home/ROMS/anaconda2/lib/python2.7/site-packages/pyroms/extern/__init__.py", line 4, in <module>
from .greatcircle import GreatCircle
File "/home/ROMS/anaconda2/lib/python2.7/site-packages/pyroms/extern/greatcircle.py", line 415
print(" Flinders Peak = %3i\xF8%3i\' %6.3f\", " % ( deg, minn, sec ), end=' ')
^
SyntaxError: invalid syntax

Again, I tried the same with python 3.5 (as mentioned on pyroms github page) in conda, but import pyroms ended up with segmentation fault repeatedly.

Any insight in overcoming the error is appreciated.

Thanks in anticipation

Dhirendra


Top
 Profile  
Reply with quote  
 Post subject: Re: PYROMS error
PostPosted: Tue Dec 11, 2018 6:41 pm 
Offline
User avatar

Joined: Wed Jul 02, 2003 5:29 pm
Posts: 3633
Location: IMS/UAF, USA
The "master" branch of pyroms should work with Python 2.7. The code diffs for that line are:
Code:
-   print " Flinders Peak =   %3i\xF8%3i\' %6.3f\",  " % ( deg, minn, sec ),
+   print(" Flinders Peak =   %3i\xF8%3i\' %6.3f\",  " % ( deg, minn, sec ), end=' ')


I have the new branch working in Python version 3.6.2.


Top
 Profile  
Reply with quote  
 Post subject: Re: PYROMS error
PostPosted: Thu Jun 13, 2019 3:32 am 
Offline

Joined: Sun Mar 10, 2019 2:34 pm
Posts: 28
Location: University of Tsukuba
kate wrote:
The "master" branch of pyroms should work with Python 2.7. The code diffs for that line are:
Code:
-   print " Flinders Peak =   %3i\xF8%3i\' %6.3f\",  " % ( deg, minn, sec ),
+   print(" Flinders Peak =   %3i\xF8%3i\' %6.3f\",  " % ( deg, minn, sec ), end=' ')


I have the new branch working in Python version 3.6.2.


Dear Kate

Could you please kindly share your new branch working in Python version 3.6.2 and some guide to install and using it?

I have ubuntu 18.04 with anaconda3, python 3.6 installed. I have already try to install pyroms with no success. The installed was run smoothly with no error but when i try to import module I have some error because of lacking lpsolve55.so, Script.so and libgu.so.

Thank you.


Top
 Profile  
Reply with quote  
 Post subject: Re: PYROMS error
PostPosted: Thu Jun 13, 2019 4:35 am 
Offline
User avatar

Joined: Wed Jul 02, 2003 5:29 pm
Posts: 3633
Location: IMS/UAF, USA
Type "git branch" to see which branch you have. The "python3" branch is the current default, so that is probably what you have already.

As for those libraries, you need to make sure your LD_LIBRARY_PATH environment variable includes the directory they live in.


Top
 Profile  
Reply with quote  
 Post subject: Re: PYROMS error
PostPosted: Thu Jun 13, 2019 3:50 pm 
Offline

Joined: Sun Mar 10, 2019 2:34 pm
Posts: 28
Location: University of Tsukuba
kate wrote:
Type "git branch" to see which branch you have. The "python3" branch is the current default, so that is probably what you have already.

As for those libraries, you need to make sure your LD_LIBRARY_PATH environment variable includes the directory they live in.


Dear Kate
Thank you so much for your reply, I have tried to reinstall anaconda an python to python 2.6.8 in order to match the pyroms-master requiremenet. Now I have compiled all the lib.
but when I try to install bathy_smoother I got some error and failth.

for pyroms and pyroms-toolbox which completed. I try to import them but still got error at this step with
----------------------------------------------------------------------------------------------------
Traceback (most recent call last):
File "/work/apps/anaconda3/lib/python2.7/site-packages/pyroms/cf.py", line 20, in <module>
import pyroms.io
File "/work/apps/anaconda3/lib/python2.7/site-packages/pyroms/__init__.py", line 14, in <module>
import hgrid
File "/work/apps/anaconda3/lib/python2.7/site-packages/pyroms/hgrid.py", line 19, in <module>
from matplotlib.nxutils import points_inside_poly
ImportError: No module named nxutils
---------------------------------------------------------------------------------------------------

I think that new matplotlib does not have nxutils so
I already tried to rolback by

matplotlib pkgs/main::matplotlib-2.2.3-py27hb69d~ --> uvcdat/label/old::matplotlib-1.5.0-py27_0

but the error still remain

Please help me the link to the right dependencies to download, I am totally messed up now. sorrry!!


Top
 Profile  
Reply with quote  
 Post subject: Re: PYROMS error
PostPosted: Thu Jun 13, 2019 4:49 pm 
Offline
User avatar

Joined: Wed Jul 02, 2003 5:29 pm
Posts: 3633
Location: IMS/UAF, USA
No, don't go backwards! We always had problems with python finding those libraries, so going backwards is not the answer. Stick with Python 3 and read the README where I tell you what I have to do for python to find the libraries - I just have copies in three different places, with hopes that at least one will be found. Your LD_LIBRARY_PATH needs to point to one of them.


Top
 Profile  
Reply with quote  
 Post subject: Re: PYROMS error
PostPosted: Fri Jun 14, 2019 3:15 am 
Offline

Joined: Sun Mar 10, 2019 2:34 pm
Posts: 28
Location: University of Tsukuba
kate wrote:
No, don't go backwards! We always had problems with python finding those libraries, so going backwards is not the answer. Stick with Python 3 and read the README where I tell you what I have to do for python to find the libraries - I just have copies in three different places, with hopes that at least one will be found. Your LD_LIBRARY_PATH needs to point to one of them.


Dear Kate

Now I come back to anaconda3 with python 3.6 and try to install pyroms-python3 again
I have all netcdf and netcdf-fortran installed but with nf-config --all I've got
"nf-config not yet implemented for cmake builds"

so with makefile2 under ~/pyroms-python3/pyroms/external/scrip/source I have

NC_CONFIG = nf-config
LIBDIR = $(shell $(NC_CONFIG) --prefix)/lib
INCDIR = $(shell $(NC_CONFIG) --prefix)/include
SRCDIR = .
PREFIX = /work/apps/anaconda3/lib

these code can not be pass because of nf-config problem.

the README file in ~/pyroms-python3/pyroms suggest that
----------------------------------------------------------------------
"I had to hack the scrip makefile for the fortran90 netcdf stuff. The
anaconda netcdf-fortran reports:
nf-config not yet implemented for cmake builds

A note on the .so files from fortran: They might now end up with names like:

scrip.cpython-35m-x86_64-linux-gnu.so

It's OK - they'll load as long as they are in your PYTHONPATH. You might
also need libgu.so to be in your LD_LIBRARY_PATH. I'm getting inconsistent
results with where the .so files need to be. Best results for me are if I go
to the site-packages directory where pyroms got installed and copy all the
.so files:

cp pyroms/*.so .
cp pyroms_toolbox/*.so .
cp bathy_smoother/*.so .
"
-----------------------------------------------------------------------
Now I still can not pass the nf-config problem, I got these errors

(base) root@C2:/media/bangdt/Ext4/0Setup/Python/pyroms-python3/pyroms/external/scrip/source# make -f makefile2
gfortran -g -fdefault-real-8 -ffixed-form -O2 -fPIC -Inf-config not yet implemented for cmake builds/include -c ./kinds_mod.f
gfortran: error: not: No such file or directory
gfortran: error: yet: No such file or directory
gfortran: error: implemented: No such file or directory
gfortran: error: for: No such file or directory
gfortran: error: cmake: No such file or directory
gfortran: error: builds/include: No such file or directory
makefile2:84: recipe for target 'kinds_mod.o' failed
make: *** [kinds_mod.o] Error 1


I still do not understand how to fix and run the makefile2. Please give me more instructions to solve this.

Thank you so much for your great works.


Top
 Profile  
Reply with quote  
 Post subject: Re: PYROMS error
PostPosted: Fri Jun 14, 2019 5:26 pm 
Offline
User avatar

Joined: Wed Jul 02, 2003 5:29 pm
Posts: 3633
Location: IMS/UAF, USA
This troublesome bit:
Code:
 -Inf-config not yet implemented for cmake builds/include
is coming from:
Code:
INCDIR = $(shell $(NC_CONFIG) --prefix)/include
which as you point out is from nf-config. It is executing "nf-config --prefix" which on my machine gives:
Code:
chinook04.rcs.alaska.edu 543% nf-config --prefix
/home/kshedstrom
Do you get a better result from "nc-config --prefix"?

Alternatively, you need to somehow provide makefile2 with the path to 'netcdf.inc', the Fortran include file for netCDF. You can change:
Code:
LIBDIR = $(shell $(NC_CONFIG) --prefix)/lib
INCDIR = $(shell $(NC_CONFIG) --prefix)/include
to something like:
Code:
LIBDIR = /usr/local/netcdf/lib
INCDIR = /usr/local/netcdf/include
assuming that is where your files live.


Top
 Profile  
Reply with quote  
 Post subject: Re: PYROMS error
PostPosted: Sat Jun 15, 2019 9:07 am 
Offline

Joined: Sun Mar 10, 2019 2:34 pm
Posts: 28
Location: University of Tsukuba
kate wrote:
This troublesome bit:
Alternatively, you need to somehow provide makefile2 with the path to 'netcdf.inc', the Fortran include file for netCDF. You can change:
Code:
LIBDIR = $(shell $(NC_CONFIG) --prefix)/lib
INCDIR = $(shell $(NC_CONFIG) --prefix)/include
to something like:
Code:
LIBDIR = /usr/local/netcdf/lib
INCDIR = /usr/local/netcdf/include
assuming that is where your files live.


Dear Kate

Thank you so much for your useful advice. I finally have pyroms installed. But there is still some more problems

1st when I try to load pyroms_toolbox I have
---------------------------------------------------------------
>>> import pyroms_toolbox

Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
import pyroms_toolbox
File "/work/apps/anaconda3/envs/PYROMS/lib/python2.7/site-packages/pyroms_toolbox/__init__.py", line 52, in <module>
from TS_diagram import TS_diagram
File "/work/apps/anaconda3/envs/PYROMS/lib/python2.7/site-packages/pyroms_toolbox/TS_diagram.py", line 8, in <module>
def TS_diagram(temp, salt, depth=None, dens_lev=None, marker_size=2, fmt='%2.2f', pal=cm.spectral, \
AttributeError: 'module' object has no attribute 'spectral'
---------------------------------------------------------------------------
by comment out the error line I can import pyroms_toolbox
...
from _move_runoff import move_runoff
from _move_river_t import move_river_t
#from TS_diagram import TS_diagram
from date2jday import date2jday
from jday2date import jday2date
...

2nd I have tried to copy lpsolve55.so and liblpsolve55.so to all PATh by following
export LD_LIBRARY_PATH=/work/apps/anaconda3/envs/PYROMS/lib
export PYTHONPATH=/work/apps/anaconda3/envs/PYROMS/lib

but i still have the not found error of lpsolve55.so

But is there any solutions to fix them?

Thank you.


Top
 Profile  
Reply with quote  
 Post subject: Re: PYROMS error
PostPosted: Sat Jun 15, 2019 4:22 pm 
Offline
User avatar

Joined: Wed Jul 02, 2003 5:29 pm
Posts: 3633
Location: IMS/UAF, USA
Spectral has a capital "S". See for example this Stackoverflow thread. I don't know how you ended up with a lower case spectral.

As for the other, my solution is that I don't use lpsolve. I think I once copied the thing to my current directory and that worked.


Top
 Profile  
Reply with quote  
 Post subject: Re: PYROMS error
PostPosted: Sat Jun 15, 2019 4:39 pm 
Offline

Joined: Sun Mar 10, 2019 2:34 pm
Posts: 28
Location: University of Tsukuba
kate wrote:
Spectral has a capital "S". See for example this Stackoverflow thread. I don't know how you ended up with a lower case spectral.

As for the other, my solution is that I don't use lpsolve. I think I once copied the thing to my current directory and that worked.


Dear Kate

Thank you for correct me about the "S", I change it and it run smoothly. I dont know why but my install come with the "Spectra"

Could you please give me more instructions about how to pass or not use lpsolve?

Thank you so much.


Top
 Profile  
Reply with quote  
 Post subject: Re: PYROMS error
PostPosted: Sat Jun 15, 2019 9:59 pm 
Offline
User avatar

Joined: Wed Jul 02, 2003 5:29 pm
Posts: 3633
Location: IMS/UAF, USA
The only use I know of for lpsolve is to smooth the bathymetry. I usually use pyroms for other tasks, not grid generation. What do you need pyroms to do for you?


Top
 Profile  
Reply with quote  
 Post subject: Re: PYROMS error
PostPosted: Sun Jun 16, 2019 2:14 am 
Offline

Joined: Sun Mar 10, 2019 2:34 pm
Posts: 28
Location: University of Tsukuba
kate wrote:
The only use I know of for lpsolve is to smooth the bathymetry. I usually use pyroms for other tasks, not grid generation. What do you need pyroms to do for you?


Dear Kate
Thank you so much for your very quick and useful instructions. I am going to make boundary and initial file for r4dvar case test.
I am newbie in roms. Up to now I can run wc13 test and restart it from his file.
Also I can make grid file. My plan is run a real case for my domain and study mct run with wrf (I can run wrf real case for my domain already).
Thank again and have a nice weakend.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group