ESMG / pyroms

Python tools for the Regional Ocean Modeling System (ROMS)
Other
138 stars 88 forks source link

Error in Import pyrom #49

Open pradhancda opened 1 year ago

pradhancda commented 1 year ago

Please suggest the possible solutions for following error

import pyroms Traceback (most recent call last): File "", line 1, in File "c:\pyroms_sp\pyroms\pyroms\pyroms__init__.py", line 19, in from . import tools File "c:\pyroms_sp\pyroms\pyroms\pyroms\tools.py", line 4, in from . import _iso ImportError: DLL load failed while importing _iso: The specified module could not be found.

kshedstrom commented 1 year ago

That _iso thing is a compiled object file with a full name something like _iso.cpython-310-x86_64-linux-gnu.so If it built correctly, according to the "pip install -e pyroms/pyroms", then it will be in that pyroms/pyroms directory. Do you have any such files?

pradhancda commented 12 months ago

Sir, Thank you, I trying in Anaconda under Windows. _iso.cp310-win_amd64.pyd ...This file is available in C:\pyroms_sp\pyroms\pyroms\pyroms.

regards, Subhasis

kshedstrom commented 12 months ago

I'm sorry, I have no idea about Windows.

pradhancda commented 11 months ago

Can you please help ? how to solve the below problem. I am using Anaconda in Windows

import numpy, scipy, matplotlib, basemap, netCDF4, cftime, lpsolve55 import pyroms Traceback (most recent call last): File "", line 1, in File "c:\users\hp\pyroms\pyroms\pyroms__init__.py", line 19, in from . import tools File "c:\users\hp\pyroms\pyroms\pyroms\tools.py", line 4, in from . import _iso ImportError: DLL load failed while importing _iso: The specified module could not be found. import pyroms_toolbox Traceback (most recent call last): File "", line 1, in File "c:\users\hp\pyroms\pyroms_toolbox\pyroms_toolbox__init.py", line 12, in from .iview import iview File "c:\users\hp\pyroms\pyroms_toolbox\pyroms_toolbox\iview.py", line 5, in import pyroms File "c:\users\hp\pyroms\pyroms\pyroms\init__.py", line 19, in from . import tools File "c:\users\hp\pyroms\pyroms\pyroms\tools.py", line 4, in from . import _iso ImportError: DLL load failed while importing _iso: The specified module could not be found. import bathy_smoother

regards, Subhasis

pradhancda commented 11 months ago

Sir, I also tried in Ubuntu 22.04, but there is no such file like _iso.cpython-310-x86_64-linux-gnu.so. and still shows the error.

pip install -e pyroms/pyroms Obtaining file:///home/sp/pyroms/pyroms Installing collected packages: pyroms Attempting uninstall: pyroms Found existing installation: pyroms 0.0.0 Uninstalling pyroms-0.0.0: Successfully uninstalled pyroms-0.0.0 Running setup.py develop for pyroms ERROR: Command errored out with exit status 1: command: /home/sp/anaconda3/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/sp/pyroms/pyroms/setup.py'"'"'; file='"'"'/home/sp/pyroms/pyroms/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps cwd: /home/sp/pyroms/pyroms/ Complete output (162 lines): running develop /home/sp/anaconda3/lib/python3.9/site-packages/setuptools/command/develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated. !!

        ********************************************************************************
        Please avoid running ``setup.py`` and ``easy_install``.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://github.com/pypa/setuptools/issues/917 for details.
        ********************************************************************************

!!
  easy_install.initialize_options(self)
/home/sp/anaconda3/lib/python3.9/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
running build_scripts
running egg_info
running build_src
build_src
writing pyroms.egg-info/PKG-INFO
writing dependency_links to pyroms.egg-info/dependency_links.txt
writing top-level names to pyroms.egg-info/top_level.txt
/home/sp/anaconda3/lib/python3.9/site-packages/setuptools/command/sdist.py:126: SetuptoolsDeprecationWarning: `build_py` command does not inherit from setuptools' `build_py`.
!!

        ********************************************************************************
        Custom 'build_py' does not implement 'get_data_files_without_manifest'.
        Please extend command classes from setuptools instead of distutils.

        See https://peps.python.org/pep-0632/ for details.
        ********************************************************************************

!!
  self._add_data_files(self._safe_data_files(build_py))
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
reading manifest file 'pyroms.egg-info/SOURCES.txt'
adding license file 'LICENSE.txt'
writing manifest file 'pyroms.egg-info/SOURCES.txt'
running build_ext
Creating /home/sp/anaconda3/lib/python3.9/site-packages/pyroms.egg-link (link to .)
Adding pyroms 0.2.0 to easy-install.pth file

Installed /home/sp/pyroms/pyroms
Warning: distutils distribution has been initialized, it may be too late to add an extension _interp
Warning: distutils distribution has been initialized, it may be too late to add an extension _obs_interp
Warning: distutils distribution has been initialized, it may be too late to add an extension _remapping
Warning: distutils distribution has been initialized, it may be too late to add an extension _remapping_fast
Warning: distutils distribution has been initialized, it may be too late to add an extension _remapping_fast_weighted
Warning: distutils distribution has been initialized, it may be too late to add an extension _iso
running develop
running build_scripts
running egg_info
running build_src
build_src
building extension "pyroms._interp" sources
f2py options: []
  adding 'build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/pyroms/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/pyroms' to include_dirs.
building extension "pyroms._obs_interp" sources
f2py options: []
  adding 'build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/pyroms/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/pyroms' to include_dirs.
  adding 'build/src.linux-x86_64-3.9/pyroms/_obs_interp-f2pywrappers.f' to sources.
building extension "pyroms._remapping" sources
f2py options: []
  adding 'build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/pyroms/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/pyroms' to include_dirs.
building extension "pyroms._remapping_fast" sources
f2py options: []
  adding 'build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/pyroms/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/pyroms' to include_dirs.
building extension "pyroms._remapping_fast_weighted" sources
f2py options: []
  adding 'build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/pyroms/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/pyroms' to include_dirs.
building extension "pyroms._iso" sources
f2py options: []
  adding 'build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/pyroms/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/pyroms' to include_dirs.
build_src: building npy-pkg config files
writing pyroms.egg-info/PKG-INFO
writing dependency_links to pyroms.egg-info/dependency_links.txt
writing top-level names to pyroms.egg-info/top_level.txt
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
reading manifest file 'pyroms.egg-info/SOURCES.txt'
adding license file 'LICENSE.txt'
writing manifest file 'pyroms.egg-info/SOURCES.txt'
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
CCompilerOpt.__init__[758] : load cache from file -> /home/sp/pyroms/pyroms/build/temp.linux-x86_64-cpython-39/ccompiler_opt_cache_ext.py
CCompilerOpt.__init__[769] : hit the file cache
get_default_fcompiler: matching types: '['gnu95', 'intel', 'lahey', 'pg', 'nv', 'absoft', 'nag', 'vast', 'compaq', 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor', 'fujitsu']'
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize IntelFCompiler
Could not locate executable ifort
Could not locate executable ifc
customize LaheyFCompiler
Could not locate executable lf95
customize PGroupFCompiler
Could not locate executable pgfortran
customize NVHPCFCompiler
Could not locate executable nvfortran
customize AbsoftFCompiler
Could not locate executable f90
Could not locate executable f77
customize NAGFCompiler
customize VastFCompiler
customize CompaqFCompiler
Could not locate executable fort
customize IntelItaniumFCompiler
Could not locate executable efort
Could not locate executable efc
customize IntelEM64TFCompiler
customize GnuFCompiler
Could not locate executable g77
customize G95FCompiler
Could not locate executable g95
customize PathScaleFCompiler
Could not locate executable pathf95
customize NAGFORCompiler
Could not locate executable nagfor
customize FujitsuFCompiler
Could not locate executable frt
don't know how to compile Fortran code on platform 'posix'
warning: build_ext: f77_compiler=None is not available.

building 'pyroms._interp' extension
error: extension 'pyroms._interp' has Fortran sources but no Fortran compiler found

########### EXT COMPILER OPTIMIZATION ###########
Platform      :
  Architecture: x64
  Compiler    : gcc

CPU baseline  :
  Requested   : 'min'
  Enabled     : SSE SSE2 SSE3
  Flags       : -msse -msse2 -msse3
  Extra checks: none

CPU dispatch  :
  Requested   : 'max -xop -fma4'
  Enabled     : SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL
  Generated   : none
CCompilerOpt._cache_write[796] : write cache to path -> /home/sp/pyroms/pyroms/build/temp.linux-x86_64-cpython-39/ccompiler_opt_cache_ext.py
----------------------------------------

Rolling back uninstall of pyroms Moving to /home/sp/anaconda3/lib/python3.9/site-packages/pyroms.egg-link from /tmp/pip-uninstall-h5y7mpto/pyroms.egg-link ERROR: Command errored out with exit status 1: /home/sp/anaconda3/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/sp/pyroms/pyroms/setup.py'"'"'; file='"'"'/home/sp/pyroms/pyroms/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

regards, Subhasis

kshedstrom commented 11 months ago

You do need to have a working fortran compiler. It should compile with gfortran once you load the gcc compiler collection.

MBendoni commented 3 months ago

Hi, I am having a similar error once I successfully installed pyroms.

$ pip install -e pyroms/pyroms
Using pip 23.3.2 from /home/bendoni/miniconda3/envs/py38/lib/python3.8/site-packages/pip (python 3.8)
Obtaining file:///home/bendoni/scripts/roms/pyroms/pyroms
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Installing collected packages: pyroms
  Running setup.py develop for pyroms
Successfully installed pyroms-0.0.0

Then, if in a python shell I try: >>> import pyroms I get the follwoing error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/bendoni/scripts/roms/pyroms/pyroms/pyroms/__init__.py", line 19, in <module>
    from . import tools
  File "/home/bendoni/scripts/roms/pyroms/pyroms/pyroms/tools.py", line 4, in <module>
    from . import _iso
ImportError: /home/bendoni/scripts/roms/pyroms/pyroms/pyroms/_iso.cpython-38-x86_64-linux-gnu.so: undefined symbol: __intel_sse2_strcpy

I am working on a linux machine under the conda environment py38 activated with all packages indicated in the instructions for installation. Have you gat oany suggestion on how to fix it?