CNES / aviso-fes

FES is the last version of the FES (Finite Element Solution) tide model.
https://cnes.github.io/aviso-fes
BSD 3-Clause "New" or "Revised" License
59 stars 24 forks source link

Installing FES2014 with `pip`, not `conda` #6

Closed robbibt closed 2 years ago

robbibt commented 2 years ago

We've been looking to install FES2014 in an AWS Jupyterhub Sandbox (Python 3.8.10) environment containing Python packages that are currently managed using Pip. However, from what I can tell, all of the instructions for installing FES2014 rely on using Conda, and right now it isn't possible for us to switch to Conda for package management in this environment.

Is it possible to install FES2014 and all its requirements (cmake, netcdf) using Pip instead of Conda? I can see that this repo includes a setup.py, so I have so far tried the following:

pip install cmake
pip install netcdf4

git clone https://github.com/CNES/aviso-fes
pip install -e aviso-fes

​However, this produces the error below that suggests to me that this isn't correctly finding NetCDF.

Any advice or recommendations on the best way to install FES2014 without Conda would be greatly appreciated.

Installing collected packages: pyfes
  Running setup.py develop for pyfes
    ERROR: Command errored out with exit status 1:
     command: /env/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/jovyan/Robbi/aviso-fes/setup.py'"'"'; __file__='"'"'/home/jovyan/Robbi/aviso-fes/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/jovyan/Robbi/aviso-fes/
    Complete output (79 lines):
    running develop
    running egg_info
    writing pyfes.egg-info/PKG-INFO
    writing dependency_links to pyfes.egg-info/dependency_links.txt
    writing top-level names to pyfes.egg-info/top_level.txt
    adding license file 'COPYING'
    adding license file 'AUTHORS'
    writing manifest file 'pyfes.egg-info/SOURCES.txt'
    running build_ext
    -- The C compiler identification is GNU 9.3.0
    -- The CXX compiler identification is GNU 9.3.0
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /usr/bin/cc - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found Python3: /usr/bin/python3.8 (found version "3.8.10") found components: Interpreter Development Development.Module Development.Embed
    -- FES version: 2.9.3
    -- Build type: Release
    -- Performing Test HAS_CPP14_FLAG
    -- Performing Test HAS_CPP14_FLAG - Success
    -- Looking for pow
    -- Looking for pow - not found
    -- Looking for pow
    -- Looking for pow - found
    CMake Error at /env/lib/python3.8/site-packages/cmake/data/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
      Could NOT find NetCDF (missing: NETCDF_LIBRARIES NETCDF_INCLUDE_DIRS)
      (Required is at least version "4.1.1")
    Call Stack (most recent call first):
      /env/lib/python3.8/site-packages/cmake/data/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
      cmake/FindNetCDF.cmake:135 (find_package_handle_standard_args)
      CMakeLists.txt:151 (find_package)

    -- Configuring incomplete, errors occurred!
    See also "/home/jovyan/Robbi/aviso-fes/build/temp.linux-x86_64-3.8/CMakeFiles/CMakeOutput.log".
    See also "/home/jovyan/Robbi/aviso-fes/build/temp.linux-x86_64-3.8/CMakeFiles/CMakeError.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/jovyan/Robbi/aviso-fes/setup.py", line 49, in <module>
        setup(
      File "/env/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/env/lib/python3.8/site-packages/setuptools/command/develop.py", line 34, in run
        self.install_for_development()
      File "/env/lib/python3.8/site-packages/setuptools/command/develop.py", line 114, in install_for_development
        self.run_command('build_ext')
      File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/env/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 79, in run
        _build_ext.run(self)
      File "/env/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
        _build_ext.build_ext.run(self)
      File "/usr/lib/python3.8/distutils/command/build_ext.py", line 340, in run
        self.build_extensions()
      File "/env/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
        _build_ext.build_ext.build_extensions(self)
      File "/usr/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions
        self._build_extensions_serial()
      File "/usr/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial
        self.build_extension(ext)
      File "/home/jovyan/Robbi/aviso-fes/setup.py", line 35, in build_extension
        check_call(
      File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', '-B', 'build/temp.linux-x86_64-3.8', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/jovyan/Robbi/aviso-fes/build/lib.linux-x86_64-3.8/', '-DBUILD_PYTHON=on', '-DPYTHON_EXECUTABLE=/env/bin/python', '-DCMAKE_BUILD_TYPE=Release', '-DBUILD_SHARED_LIBS=on']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /env/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/jovyan/Robbi/aviso-fes/setup.py'"'"'; __file__='"'"'/home/jovyan/Robbi/aviso-fes/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.
fbriol commented 2 years ago

I modified the "setup.py" script to configure the dependencies needed for the build. To build the package from pip

python -m pip install . -vv --global-option=build --global-option="--netcdf-root=<your path here>"