From c5786dc39c3131a9f730d86aca50b807a31ea1fc Mon Sep 17 00:00:00 2001 From: Alvaro Cea Date: Tue, 30 May 2023 09:30:27 +0100 Subject: [PATCH 01/40] add pyproject.toml to download packages prior to build --- pyproject.toml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..c2948fb7c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = [ + "setuptools", + #"scikit-build>=0.13", + "cmake==3.14.3" + ] \ No newline at end of file From fb40764456ad25649d272ec3a7d5e23ee5b6f305 Mon Sep 17 00:00:00 2001 From: Alvaro Cea Date: Tue, 30 May 2023 09:31:52 +0100 Subject: [PATCH 02/40] minimal env (only for people without low level libraries in system) --- environment.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 environment.yml diff --git a/environment.yml b/environment.yml new file mode 100644 index 000000000..d731b72c9 --- /dev/null +++ b/environment.yml @@ -0,0 +1,10 @@ +name: sharpy +channels: + - conda-forge + - defaults +dependencies: + - python=3.10 + - blas + - lapack + - libgcc + - libgfortran \ No newline at end of file From 70b8b183da7ebd0719c47600540a1b621ac48a50 Mon Sep 17 00:00:00 2001 From: Alvaro Cea Date: Tue, 30 May 2023 09:34:11 +0100 Subject: [PATCH 03/40] less restricted cmake in the setup (>= added) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c2948fb7c..3f6f8a088 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,5 +2,5 @@ requires = [ "setuptools", #"scikit-build>=0.13", - "cmake==3.14.3" + "cmake>=3.14.3" ] \ No newline at end of file From 330ef4ea6314dc4eba82792d174e92d505f13ac9 Mon Sep 17 00:00:00 2001 From: Alvaro Cea Date: Tue, 30 May 2023 10:45:39 +0100 Subject: [PATCH 04/40] add functions to setup to build submodules --- setup.py | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 06207ffc3..ce8ea96b6 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,79 @@ -from setuptools import setup, find_packages +from setuptools import setup, find_packages, Extension, Command +#from skbuild import setup +from setuptools.command.build_ext import build_ext +import subprocess + import re import os -this_directory = os.path.abspath(os.path.dirname(__file__)) +class CMakeBuildExt(build_ext): + """Custom command to build Submodules packages during installation.""" + + def run(self): + + package_dir = os.path.dirname(os.path.abspath(__file__)) + build_dir = package_dir + "/build" + config_settings = getattr(self, 'config_settings', {}) + cmake_args = [] + if 'build_subm' in config_settings.keys() and config_settings['build_subm']=='no': + pass + else: + if not os.path.isdir(build_dir): + os.makedirs(build_dir) + subprocess.check_call( + ["cmake", ".."] + cmake_args, cwd=build_dir + ) + subprocess.check_call( + ["make", "install", "-j4"], cwd=build_dir + ) + + super().run() + +class BuildCommand(Command): + """Custom command to build Submodules packages without installation.""" + + description = 'Build Submodules in lib packages' + user_options = [ + ('cmake-args=', None, 'Additional CMake arguments'), + ] + + def initialize_options(self): + self.cmake_args = None + + def finalize_options(self): + pass + + def run(self): + # Run the CMake build step with additional cmake_args + package_dir = os.path.dirname(os.path.abspath(__file__)) + build_dir = package_dir + "/build" + if not os.path.isdir(build_dir): + os.makedirs(build_dir) + if self.cmake_args is not None: + subprocess.check_call( + ["cmake", f"{self.cmake_args}", ".."], cwd=build_dir + ) + else: + subprocess.check_call( + ["cmake", ".."], cwd=build_dir + ) + + subprocess.check_call( + ["make", "install", "-j4"], cwd=build_dir + ) + +ext_modules = [ + Extension('lib', []), + # Add more Extension instances for additional extension modules +] + + __version__ = re.findall( r"""__version__ = ["']+([0-9\.]*)["']+""", open(os.path.join(this_directory, "sharpy/version.py")).read(), )[0] +this_directory = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f: long_description = f.read() @@ -25,6 +91,9 @@ author_email="", url="https://github.com/ImperialCollegeLondon/sharpy", license="BSD 3-Clause License", + ext_modules=ext_modules, + cmdclass={"build_ext": CMakeBuildExt, + "build_subm": BuildCommand}, packages=find_packages( where='./', include=['sharpy*'], From 216bd5ba4be9b73a170bc625608638d2f83d90e8 Mon Sep 17 00:00:00 2001 From: Alvaro Cea Date: Tue, 30 May 2023 10:48:05 +0100 Subject: [PATCH 05/40] add required packages to pip install --- setup.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/setup.py b/setup.py index ce8ea96b6..f0032feac 100644 --- a/setup.py +++ b/setup.py @@ -99,8 +99,44 @@ def run(self): include=['sharpy*'], exclude=['tests'] ), + # data_files=[ + # ("./lib/UVLM/lib", ["libuvlm.so"]), + # ("./lib/xbeam/lib", ["libxbeam.so"]) + # ], + python_requires=">=3.8", install_requires=[ + "numpy", + "configobj", + "h5py", + "scipy", + "sympy", + "matplotlib", + "colorama", + "dill", + "jupyterlab", + "mayavi", #tvtk + "pandas", + "control", + # For pandas excel reader. + "openpyxl>=3.0.10", + "lxml>=4.4.1", + "PySocks", + "PyYAML" ], + extras_require={ + "docs": [ + "sphinx", + "recommonmark>=0.6.0", + "sphinx_rtd_theme>=0.4.3", + "nbsphinx>=0.4.3" + ], + "all": [ + "sphinx", + "recommonmark>=0.6.0", + "sphinx_rtd_theme>=0.4.3", + "nbsphinx>=0.4.3" + ], + }, classifiers=[ "Operating System :: Linux, Mac OS", "Programming Language :: Python, C++", From a9c319439c7f2ace8d7e888cc6b7d713bb3fa5bf Mon Sep 17 00:00:00 2001 From: Alvaro Cea Date: Wed, 31 May 2023 14:41:08 +0100 Subject: [PATCH 06/40] remove unnecessary environments (leaving newer for reference) --- utils/environment_linux.yml | 170 ---------------------------------- utils/environment_macos.yml | 103 -------------------- utils/environment_minimal.yml | 104 --------------------- 3 files changed, 377 deletions(-) delete mode 100644 utils/environment_linux.yml delete mode 100644 utils/environment_macos.yml delete mode 100644 utils/environment_minimal.yml diff --git a/utils/environment_linux.yml b/utils/environment_linux.yml deleted file mode 100644 index 0834869ce..000000000 --- a/utils/environment_linux.yml +++ /dev/null @@ -1,170 +0,0 @@ -name: sharpy_env -channels: - - conda-forge - - defaults -dependencies: - - _libgcc_mutex=0.1=main - - alabaster=0.7.12=py37_0 - - apptools=4.4.0=py37_1 - - asn1crypto=1.2.0=py37_0 - - attrs=19.3.0=py_0 - - babel=2.7.0=py_0 - - backcall=0.1.0=py37_0 - - bleach=3.1.0=py_0 - - bzip2=1.0.8=h7b6447c_0 - - ca-certificates=2020.12.5=ha878542_0 - - certifi=2020.12.5=py37h89c1867_1 - - cffi=1.13.1=py37h2e261b9_0 - - chardet=3.0.4=py37_1003 - - cmake=3.14.0=h52cb24c_0 - - colorama=0.4.1=py37_0 - - commonmark=0.9.0=py_0 - - configobj=5.0.6=py37_1 - - control=0.8.4=py37h89c1867_0 - - cryptography=2.8=py37h1ba5d50_0 - - curl=7.67.0=hbc83047_0 - - cycler=0.10.0=py37_0 - - dbus=1.13.12=h746ee38_0 - - decorator=4.4.1=py_0 - - defusedxml=0.6.0=py_0 - - dill=0.3.1.1=py37_0 - - docutils=0.15.2=py37_0 - - eigen=3.3.7=hfd86e86_0 - - entrypoints=0.3=py37_1000 - - envisage=4.8.0=py_0 - - expat=2.2.6=he6710b0_0 - - fontconfig=2.13.0=h9420a91_0 - - freetype=2.9.1=h8a8886c_1 - - future=0.18.2=py37_0 - - glib=2.63.1=h5a9c865_0 - - gst-plugins-base=1.14.0=hbbd80ab_1 - - gstreamer=1.14.0=hb453b48_1 - - h5py=2.9.0=nompi_py37hcafd542_1103 - - hdf4=4.2.13=h3ca952b_2 - - hdf5=1.10.4=hb1b8bf9_0 - - icu=58.2=h9c2bf20_1 - - idna=2.8=py37_0 - - imagesize=1.1.0=py37_0 - - importlib_metadata=0.23=py37_0 - - intel-openmp=2019.4=243 - - ipykernel=5.1.3=py37h39e3cac_0 - - ipython=7.10.1=py37h39e3cac_0 - - ipython_genutils=0.2.0=py_1 - - jedi=0.15.1=py37_0 - - jinja2=2.10.3=py_0 - - jpeg=9b=h024ee3a_2 - - json5=0.8.5=py_0 - - jsoncpp=1.8.4=hfd86e86_0 - - jsonschema=3.1.1=py37_0 - - jupyter_client=5.3.3=py37_1 - - jupyter_core=4.5.0=py_0 - - jupyterlab=1.2.3=py_0 - - jupyterlab_server=1.0.6=py_0 - - kiwisolver=1.1.0=py37he6710b0_0 - - krb5=1.16.1=h173b8e3_7 - - lapack=3.6.1=ha44fe06_2 - - libblas=3.8.0=14_openblas - - libcblas=3.8.0=14_openblas - - libcurl=7.67.0=h20c2e04_0 - - libedit=3.1.20181209=hc058e9b_0 - - libffi=3.2.1=hd88cf55_4 - - libgcc-ng=9.1.0=hdf63c60_0 - - libgfortran=3.0.0=1 - - libgfortran-ng=7.3.0=hdf63c60_0 - - liblapack=3.8.0=14_openblas - - libnetcdf=4.6.1=h11d0813_2 - - libogg=1.3.2=h7b6447c_0 - - libopenblas=0.3.7=h5ec1e0e_4 - - libpng=1.6.37=hbc83047_0 - - libsodium=1.0.16=h1bed415_0 - - libssh2=1.8.2=h1ba5d50_0 - - libstdcxx-ng=9.1.0=hdf63c60_0 - - libtheora=1.1.1=h5ab3b9f_1 - - libtiff=4.1.0=h2733197_0 - - libuuid=1.0.3=h1bed415_2 - - libvorbis=1.3.6=h7b6447c_0 - - libxcb=1.13=h1bed415_1 - - libxml2=2.9.9=hea5a465_1 - - libxslt=1.1.33=h7d1a2b0_0 - - lxml=4.4.1=py37hefd8a0e_0 - - lz4-c=1.8.1.2=h14c3975_0 - - markupsafe=1.1.1=py37h7b6447c_0 - - matplotlib=3.1.1=py37h5429711_0 - - matplotlib-base=3.1.3=py37hef1b27d_0 - - mayavi=4.7.1=py37h94891b3_2 - - mistune=0.8.4=py37h516909a_1000 - - more-itertools=7.2.0=py_0 - - nbconvert=5.6.1=py37_0 - - nbformat=4.4.0=py_1 - - nbsphinx=0.4.3=py_0 - - ncurses=6.1=he6710b0_1 - - notebook=6.0.1=py37_0 - - numpy=1.17.3=py37h95a1406_0 - - openssl=1.1.1i=h27cfd23_0 - - packaging=19.2=py_0 - - pandas=0.25.3=py37hb3f55d8_0 - - pandoc=2.7.3=0 - - pandocfilters=1.4.2=py_1 - - parso=0.5.1=py_0 - - pcre=8.43=he6710b0_0 - - pexpect=4.7.0=py37_0 - - pickleshare=0.7.5=py37_0 - - pip=19.3.1=py37_0 - - prometheus_client=0.7.1=py_0 - - prompt_toolkit=3.0.2=py_0 - - ptyprocess=0.6.0=py37_0 - - pycparser=2.19=py37_0 - - pyface=6.1.2=py37_0 - - pygments=2.4.2=py_0 - - pyopenssl=19.0.0=py37_0 - - pyparsing=2.4.4=py_0 - - pyqt=5.9.2=py37h05f1152_2 - - pyrsistent=0.15.5=py37h516909a_0 - - pysocks=1.7.1=py37_0 - - python=3.7.5=h0371630_0 - - python-dateutil=2.8.1=py_0 - - python_abi=3.7=1_cp37m - - pytz=2019.3=py_0 - - pyyaml=5.1.2=py37h7b6447c_0 - - pyzmq=18.1.0=py37he6710b0_0 - - qt=5.9.7=h5867ecd_1 - - readline=7.0=h7b6447c_5 - - recommonmark=0.6.0=py_0 - - requests=2.22.0=py37_0 - - rhash=1.3.8=h1ba5d50_0 - - scipy=1.3.2=py37h921218d_0 - - send2trash=1.5.0=py37_0 - - setuptools=41.6.0=py37_0 - - sip=4.19.8=py37hf484d3e_0 - - six=1.13.0=py37_0 - - snowballstemmer=2.0.0=py_0 - - sphinx=3.0.3=py_0 - - sphinx_rtd_theme=0.5.0=pyh9f0ad1d_0 - - sphinxcontrib-applehelp=1.0.1=py_0 - - sphinxcontrib-devhelp=1.0.1=py_0 - - sphinxcontrib-htmlhelp=1.0.2=py_0 - - sphinxcontrib-jsmath=1.0.1=py_0 - - sphinxcontrib-qthelp=1.0.2=py_0 - - sphinxcontrib-serializinghtml=1.1.3=py_0 - - sqlite=3.30.1=h7b6447c_0 - - tbb=2019.8=hfd86e86_0 - - terminado=0.8.3=py37_0 - - testpath=0.4.4=py_0 - - tk=8.6.8=hbc83047_0 - - tornado=6.0.3=py37h7b6447c_0 - - traitlets=4.3.3=py37_0 - - traits=5.2.0=py37h7b6447c_0 - - traitsui=6.1.3=py_0 - - urllib3=1.24.2=py37_0 - - vtk=8.2.0=py37haa4764d_200 - - wcwidth=0.1.7=py37_0 - - webencodings=0.5.1=py_1 - - wheel=0.33.6=py37_0 - - xlrd=1.2.0=py37_0 - - xz=5.2.4=h14c3975_4 - - yaml=0.1.7=had09818_2 - - zeromq=4.3.1=he6710b0_3 - - zipp=0.6.0=py_0 - - zlib=1.2.11=h7b6447c_3 - - zstd=1.3.7=h0b5b093_0 - - slycot=0.4.0.0=py37h27181d0_1 diff --git a/utils/environment_macos.yml b/utils/environment_macos.yml deleted file mode 100644 index 740bc301b..000000000 --- a/utils/environment_macos.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: sharpy_env -channels: - - conda-forge - - defaults -dependencies: - - _libgcc_mutex=0.1=main - - alabaster=0.7.12=py37_0 - - apptools=4.4.0=py37_1 - - blas=1.0=mkl - - bzip2=1.0.8=h01d97ff_1 - - ca-certificates=2020.10.14=0 - - certifi=2020.6.20=py37_0 - - cmake=3.14.0=haff7e42_0 - - colorama=0.4.1=py37_0 - - configobj=5.0.6=py37_1 - - control=0.8.4=py37hf985489_0 - - coverage=4.5.4=py37h1de35cc_0 - - curl=7.67.0=ha441bb4_0 - - cycler=0.10.0=py37_0 - - dbus=1.13.12=h90a0687_0 - - dill=0.3.1.1=py37_0 - - eigen=3.3.7=h04f5b5a_1000 - - envisage=4.8.0=py_0 - - expat=2.2.6=h0a44026_0 - - freetype=2.9.1=hb4e5f40_0 - - future=0.18.2=py37_0 - - gettext=0.19.8.1=h15daf44_3 - - glib=2.63.1=hd977a24_0 - - h5py=2.9.0=py37h3134771_0 - - hdf4=4.2.13=h39711bb_2 - - hdf5=1.10.4=hfa1e0ec_0 - - icu=58.2=h4b95b61_1 - - intel-openmp=2019.4=233 - - jpeg=9b=he5867d9_2 - - jsoncpp=1.8.4=h04f5b5a_0 - - kiwisolver=1.1.0=py37h0a44026_0 - - krb5=1.16.1=hddcf347_7 - - libcurl=7.67.0=h051b688_0 - - libcxx=4.0.1=hcfea43d_1 - - libcxxabi=4.0.1=hcfea43d_1 - - libedit=3.1.20181209=hb402a30_0 - - libffi=3.2.1=h475c297_4 - - libgfortran=3.0.1=h93005f0_2 - - libiconv=1.15=hdd342a3_7 - - libnetcdf=4.6.1=hd5207e6_2 - - libogg=1.3.2=h1de35cc_0 - - libopenblas=0.3.7=hd44dcd8_1 - - libpng=1.6.37=ha441bb4_0 - - libssh2=1.8.2=hcdc9a53_2 - - libtheora=1.1.1=hb4e5f40_1 - - libtiff=4.1.0=hcb84e12_0 - - libvorbis=1.3.6=h1de35cc_0 - - libxml2=2.9.9=hf6e021a_1 - - libxslt=1.1.33=h33a18ac_0 - - lxml=4.4.2=py37hef8c89e_0 - - lz4-c=1.8.1.2=h1de35cc_0 - - matplotlib=3.1.1=py37h54f8f79_0 - - matplotlib-base=3.1.1=py37h3a684a6_1 - - mayavi=4.6.2=py37hdde6e19_4 - - mkl=2019.4=233 - - mkl-include=2019.4=233 - - mkl-service=2.3.0=py37hfbe908c_0 - - mkl_fft=1.0.15=py37h5e564d8_0 - - mkl_random=1.1.0=py37ha771720_0 - - ncurses=6.1=h0a44026_1 - - numpy=1.17.4=py37h890c691_0 - - numpy-base=1.17.4=py37h6575580_0 - - openblas=0.3.7=hd44dcd8_1 - - openssl=1.1.1h=haf1e3a3_0 - - pandas=0.25.3=py37h0a44026_0 - - pcre=8.43=h0a44026_0 - - pip=19.3.1=py37_0 - - pyface=6.1.2=py37_0 - - pygments=2.5.2=py_0 - - pyparsing=2.4.5=py_0 - - pyqt=5.9.2=py37h655552a_2 - - python=3.7.5=h359304d_0 - - python-dateutil=2.8.1=py_0 - - python_abi=3.7=1_cp37m - - pytz=2019.3=py_0 - - pyyaml=5.3.1=py37haf1e3a3_1 - - qt=5.9.7=h468cd18_1 - - readline=7.0=h1de35cc_5 - - rhash=1.3.8=ha12b0ac_0 - - scipy=1.3.1=py37h1410ff5_0 - - setuptools=42.0.2=py37_0 - - sip=4.19.8=py37h0a44026_0 - - six=1.13.0=py37_0 - - slycot=0.3.5.0=py37h82d0005_0 - - sqlite=3.30.1=ha441bb4_0 - - tbb=2019.8=h04f5b5a_0 - - tk=8.6.8=ha441bb4_0 - - tornado=6.0.3=py37h1de35cc_0 - - traits=5.2.0=py37h1de35cc_0 - - traitsui=6.1.3=py_0 - - vtk=8.2.0=py37h9bafd54_200 - - wheel=0.33.6=py37_0 - - xlrd=1.2.0=py_0 - - xz=5.2.4=h1de35cc_4 - - yaml=0.2.5=haf1e3a3_0 - - zlib=1.2.11=h1de35cc_3 - - zstd=1.3.7=h5bba6e5_0 - diff --git a/utils/environment_minimal.yml b/utils/environment_minimal.yml deleted file mode 100644 index ea5841579..000000000 --- a/utils/environment_minimal.yml +++ /dev/null @@ -1,104 +0,0 @@ -name: sharpy_minimal -channels: - - conda-forge - - defaults -dependencies: - - _libgcc_mutex=0.1=main - - apptools=4.5.0=py_0 - - bzip2=1.0.8=h7b6447c_0 - - ca-certificates=2020.12.5=ha878542_0 - - certifi=2020.12.5=py37h89c1867_1 - - cmake=3.14.0=h52cb24c_0 - - colorama=0.4.1=py37_0 - - configobj=5.0.6=py_0 - - control=0.8.4=py37h89c1867_0 - - curl=7.67.0=hbc83047_0 - - cycler=0.10.0=py_2 - - dbus=1.13.6=he372182_0 - - dill=0.3.1.1=py37_0 - - eigen=3.3.7=hc9558a2_1001 - - envisage=4.8.0=py_0 - - expat=2.2.6=he6710b0_0 - - fontconfig=2.13.1=he4413a7_1000 - - freetype=2.10.0=he983fc9_1 - - future=0.18.2=py37_0 - - gettext=0.19.8.1=hc5be6a0_1002 - - glib=2.58.3=py37h6f030ca_1002 - - gst-plugins-base=1.14.5=h0935bb2_0 - - gstreamer=1.14.5=h36ae1b5_0 - - h5py=2.9.0=py37h7918eee_0 - - hdf4=4.2.13=h3ca952b_2 - - hdf5=1.10.4=hb1b8bf9_0 - - icu=58.2=hf484d3e_1000 - - jpeg=9c=h14c3975_1001 - - jsoncpp=1.8.4=hfd86e86_0 - - kiwisolver=1.1.0=py37hc9558a2_0 - - krb5=1.16.1=h173b8e3_7 - - lapack=3.6.1=ha44fe06_2 - - libblas=3.8.0=14_openblas - - libcblas=3.8.0=14_openblas - - libcurl=7.67.0=h20c2e04_0 - - libedit=3.1.20181209=hc058e9b_0 - - libffi=3.2.1=hd88cf55_4 - - libgcc-ng=9.1.0=hdf63c60_0 - - libgfortran=3.0.0=1 - - libgfortran-ng=7.3.0=hdf63c60_2 - - libiconv=1.15=h516909a_1005 - - liblapack=3.8.0=14_openblas - - libnetcdf=4.6.1=h11d0813_2 - - libogg=1.3.2=h7b6447c_0 - - libopenblas=0.3.7=h5ec1e0e_4 - - libpng=1.6.37=hed695b0_0 - - libssh2=1.8.2=h1ba5d50_0 - - libstdcxx-ng=9.1.0=hdf63c60_0 - - libtheora=1.1.1=h5ab3b9f_1 - - libtiff=4.1.0=h2733197_0 - - libuuid=2.32.1=h14c3975_1000 - - libvorbis=1.3.6=h7b6447c_0 - - libxcb=1.13=h14c3975_1002 - - libxml2=2.9.9=hea5a465_1 - - libxslt=1.1.33=h7d1a2b0_0 - - lxml=4.4.2=py37hefd8a0e_0 - - lz4-c=1.8.1.2=h14c3975_0 - - matplotlib=3.1.1=py37h5429711_0 - - matplotlib-base=3.1.3=py37hef1b27d_0 - - mayavi=4.7.1=py37h94891b3_2 - - ncurses=6.1=he6710b0_1 - - numpy=1.17.3=py37h95a1406_0 - - openssl=1.1.1i=h27cfd23_0 - - pandas=0.25.3=py37hb3f55d8_0 - - pcre=8.43=he1b5a44_0 - - pip=19.3.1=py37_0 - - pthread-stubs=0.4=h14c3975_1001 - - pyface=6.1.2=py37_0 - - pygments=2.5.2=py_0 - - pyparsing=2.4.5=py_0 - - pyqt=5.9.2=py37hcca6a23_4 - - python=3.7.5=h0371630_0 - - python-dateutil=2.8.1=py_0 - - python_abi=3.7=1_cp37m - - pytz=2019.3=py_0 - - pyyaml=5.1.2=py37h7b6447c_0 - - qt=5.9.7=h52cfd70_2 - - readline=7.0=h7b6447c_5 - - rhash=1.3.8=h1ba5d50_0 - - scipy=1.3.2=py37h921218d_0 - - setuptools=42.0.2=py37_0 - - sip=4.19.8=py37hf484d3e_0 - - six=1.13.0=py37_0 - - slycot=0.4.0.0=py37h27181d0_1 - - sqlite=3.30.1=h7b6447c_0 - - tbb=2019.8=hfd86e86_0 - - tk=8.6.8=hbc83047_0 - - tornado=6.0.3=py37h516909a_0 - - traits=5.2.0=py37h7b6447c_0 - - traitsui=6.1.3=py_0 - - vtk=8.2.0=py37haa4764d_200 - - wheel=0.33.6=py37_0 - - xlrd=1.2.0=py37_0 - - xorg-libxau=1.0.9=h14c3975_0 - - xorg-libxdmcp=1.1.3=h516909a_0 - - xz=5.2.4=h14c3975_4 - - yaml=0.1.7=had09818_2 - - zlib=1.2.11=h7b6447c_3 - - zstd=1.3.7=h0b5b093_0 From 85a4475b424c4b7ccf15e03ab6f3954429f34b25 Mon Sep 17 00:00:00 2001 From: Alvaro Cea Date: Tue, 30 May 2023 12:16:41 +0100 Subject: [PATCH 07/40] add option, via environment variable, to not build submodules --- setup.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index f0032feac..4fa3fef23 100644 --- a/setup.py +++ b/setup.py @@ -8,14 +8,22 @@ class CMakeBuildExt(build_ext): """Custom command to build Submodules packages during installation.""" + + # def copy_extensions_to_source(self): + # "Override the method to prevent copying package files" + # pass + def finalize_options(self): + super().finalize_options() + # Process and use os.environ['CUSTOM_CONFIG_SETTINGS'] as needed + self.pip_nobuild = os.environ.get('PIP_NOBUILD') + def run(self): - + package_dir = os.path.dirname(os.path.abspath(__file__)) build_dir = package_dir + "/build" - config_settings = getattr(self, 'config_settings', {}) cmake_args = [] - if 'build_subm' in config_settings.keys() and config_settings['build_subm']=='no': + if self.pip_nobuild=="yes": pass else: if not os.path.isdir(build_dir): From d0ee1195f77540e10355f7e928c21f4d20e32a62 Mon Sep 17 00:00:00 2001 From: Alvaro Cea Date: Wed, 31 May 2023 07:36:56 +0100 Subject: [PATCH 08/40] fix to env for Ubuntu --- environment.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/environment.yml b/environment.yml index d731b72c9..70ee5a035 100644 --- a/environment.yml +++ b/environment.yml @@ -3,8 +3,13 @@ channels: - conda-forge - defaults dependencies: + - eigen + - libopenblas + - libblas + - libcblas + - liblapack + - libgomp + - libgfortran + - libgcc-ng + - libgfortran-ng - python=3.10 - - blas - - lapack - - libgcc - - libgfortran \ No newline at end of file From 780714b76c4f067ae51da8a1a930bcc162c4ea59 Mon Sep 17 00:00:00 2001 From: Alvaro Cea Date: Wed, 31 May 2023 14:55:00 +0100 Subject: [PATCH 09/40] fix wrong location of variable this_directory in merging conflicts --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 4fa3fef23..43c371cf6 100644 --- a/setup.py +++ b/setup.py @@ -75,13 +75,12 @@ def run(self): # Add more Extension instances for additional extension modules ] - +this_directory = os.path.abspath(os.path.dirname(__file__)) __version__ = re.findall( r"""__version__ = ["']+([0-9\.]*)["']+""", open(os.path.join(this_directory, "sharpy/version.py")).read(), )[0] -this_directory = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f: long_description = f.read() From a8d588471d8dbe4516bcb51beef67dbd2ea86ac3 Mon Sep 17 00:00:00 2001 From: Alvaro Cea Date: Wed, 21 Jun 2023 07:53:52 +0100 Subject: [PATCH 10/40] simple compilation from run() method --- setup.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 43c371cf6..d8e2d5763 100644 --- a/setup.py +++ b/setup.py @@ -37,6 +37,24 @@ def run(self): super().run() +def run(): + + pip_nobuild = os.environ.get('PIP_NOBUILD') + package_dir = os.path.dirname(os.path.abspath(__file__)) + build_dir = package_dir + "/build" + cmake_args = [] + if pip_nobuild=="yes": + pass + else: + if not os.path.isdir(build_dir): + os.makedirs(build_dir) + subprocess.check_call( + ["cmake", ".."] + cmake_args, cwd=build_dir + ) + subprocess.check_call( + ["make", "install", "-j4"], cwd=build_dir + ) + class BuildCommand(Command): """Custom command to build Submodules packages without installation.""" @@ -83,7 +101,7 @@ def run(self): with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f: long_description = f.read() - +run() setup( name="sharpy", version=__version__, @@ -98,8 +116,8 @@ def run(self): author_email="", url="https://github.com/ImperialCollegeLondon/sharpy", license="BSD 3-Clause License", - ext_modules=ext_modules, - cmdclass={"build_ext": CMakeBuildExt, + #ext_modules=ext_modules, + cmdclass={#"build_ext": CMakeBuildExt, "build_subm": BuildCommand}, packages=find_packages( where='./', From 1b0f8afd50a0f90d0c4926b9e2985f3d19afaf5f Mon Sep 17 00:00:00 2001 From: Alvaro Cea Date: Wed, 28 Jun 2023 10:03:06 +0100 Subject: [PATCH 11/40] minor environment compatibility for macos --- environment.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index 70ee5a035..97bcf0db6 100644 --- a/environment.yml +++ b/environment.yml @@ -8,8 +8,7 @@ dependencies: - libblas - libcblas - liblapack - - libgomp - libgfortran - - libgcc-ng + - libgcc - libgfortran-ng - python=3.10 From 6529a2659887cf8b1abee5823d8e47806d0f295b Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Fri, 26 Jan 2024 10:07:07 +0000 Subject: [PATCH 12/40] Added documentation for pip install Also fixed an issue with SHARPy not running due to a package import error. --- docs/source/content/installation.md | 90 +++++++++++++++++++++-------- sharpy/generators/floatingforces.py | 3 +- 2 files changed, 67 insertions(+), 26 deletions(-) diff --git a/docs/source/content/installation.md b/docs/source/content/installation.md index 72912462c..0128ac81b 100644 --- a/docs/source/content/installation.md +++ b/docs/source/content/installation.md @@ -1,7 +1,7 @@ -# SHARPy v2.0 Installation Guide -__Last revision 9 October 2023__ +# SHARPy v2.2 Installation Guide +__Last revision 26 January 2024__ -The following step by step tutorial will guide you through the installation process of SHARPy. This is the updated process valid from v2.0. +The following step by step tutorial will guide you through the installation process of SHARPy. This is the updated process valid from v2.2. ## Requirements @@ -54,9 +54,58 @@ once you initialise SHARPy you will also automatically clone the relevant versio 2. We will now set up the SHARPy environment that will install other required distributions. -### Setting up the Python Environment +### Setting up the Python Environment (Standalone) -SHARPy uses the Anaconda package manager to provide the necessary Python packages. +SHARPy can be installed as a standalone package, without the use of a package manager. If you wish to install using the Anaconda package manager, please use the following tutorial [HERE](#setting-up-the-python-environment-anaconda), or make a custom installation with a develop build or modified compilation settings [HERE](#custom-installation). + +1. Check that your Python version is 3.10. Higher versions may be incompatible with the required modules. + ```bash + python --version + ``` + +### Quick install +The quick install is geared towards getting the release build of SHARPy running as quickly and simply as possible. +1. Move into the cloned repository: + ```bash + cd sharpy + ``` + +2. Create a directory `build` that will be used during CMake's building process and `cd` into it. + Ensure it is located in the main ./sharpy folder otherwise the following steps won't work: + ```bash + mkdir build + cd build + ``` + +3. Prepare UVLM and xbeam for compilation using `gfortran` and `g++` in their release builds running. If you'd like to + change compilers see the Custom Installation. + ```bash + cmake .. + ``` + +4. Compile the libraries. + ```bash + make install -j 4 + ``` + where the number after the `-j` flag will specify how many cores to use during installation. + This should take approximately 2 minutes (Tested on MacOS Sonoma). + +7. Finally, leave the build directory and install SHARPy: + ```bash + cd .. + pip install . + ``` + +8. You can check the version of SHARPy you are running with: + ```bash + sharpy --version + ``` + +__You are ready to run SHARPy__. Continue reading the [Running SHARPy](#running-sharpy) section. + +### Setting up the Python Environment (Anaconda) + +SHARPy can use the Anaconda package manager to provide the necessary Python packages. These are specified in an Anaconda environment that shall be activated prior to compiling the xbeam and UVLM libraries or running any SHARPy cases. @@ -90,8 +139,7 @@ or running any SHARPy cases. ### Quick install -The quick install is geared towards getting the release build of SHARPy running as quickly and simply as possible. If -you would like to install a develop build or modify the compilation settings of the libraries skip to the next section. +The quick install is geared towards getting the release build of SHARPy running as quickly and simply as possible. 1. Move into the cloned repository: ```bash cd sharpy @@ -125,7 +173,7 @@ you would like to install a develop build or modify the compilation settings of make install -j 4 ``` where the number after the `-j` flag will specify how many cores to use during installation. - This should take approximately 5 minutes (Tested on Ubuntu 22.04.1). + This should take approximately 2 minutes (Tested on MacOS Sonoma). 7. Finally, leave the build directory and install SHARPy: ```bash @@ -138,12 +186,17 @@ you would like to install a develop build or modify the compilation settings of sharpy --version ``` +If running SHARPy from Anaconda, you need to load the conda environment. Therefore, __before you run any SHARPy case or test__, activate the SHARPy conda environment: +```bash +conda activate sharpy +``` + __You are ready to run SHARPy__. Continue reading the [Running SHARPy](#running-sharpy) section. ### Custom installation These steps will show you how to compile the xbeam and UVLM libraries such that you can modify the compilation settings -to your taste. +to your taste. This is compatible with both standalone and Anaconda installations. 1. If you want to use SHARPy's latest release, skip this step. If you would like to use the latest development work, you will need to checkout the `develop` branch. For more info on how we structure our development and what branches @@ -154,14 +207,13 @@ to your taste. ``` This command will check out the `develop` branch and set it to track the remote origin. It will also set the submodules (xbeam and UVLM) to the right commit. -2. Create the conda environment that SHARPy will use: +2. If using Anaconda, create the conda environment that SHARPy will use and activate the environment: ```bash cd sharpy/utils conda env create -f environment.yml cd ../.. ``` -3. Activate the `sharpy` conda environment: ```bash conda activate sharpy ``` @@ -276,18 +328,8 @@ python -m unittest **Enjoy!** - ## Running SHARPy -In order to run SHARPy, you need to load the conda environment. Therefore, __before you run any SHARPy case__: - -1. Activate the SHARPy conda environment - ```bash - conda activate sharpy - ``` - -You are now ready to run SHARPy cases from the terminal. - ### Automated tests SHARPy uses unittests to verify the integrity of the code. @@ -341,12 +383,12 @@ SHARPy cases are therefore usually ran in the following way: 2. Run it to produce the `.h5` files and the `.sharpy` files. ```bash - (sharpy_env) python generate_case.py + python generate_case.py ``` 3. Run SHARPy (ensure the environment is activated). ```bash - (sharpy_env) sharpy case.sharpy + sharpy case.sharpy ``` #### Output @@ -381,7 +423,6 @@ is stored in [HDF5](https://support.hdfgroup.org/HDF5/) format, which is compres The `sharpy` call is: ```bash - # Make sure that the sharpy_env conda environment is active sharpy ``` @@ -409,7 +450,6 @@ is stored in [HDF5](https://support.hdfgroup.org/HDF5/) format, which is compres You are now ready to run the case again: ```bash - # Make sure that the sharpy_env conda environment is active sharpy ``` diff --git a/sharpy/generators/floatingforces.py b/sharpy/generators/floatingforces.py index c296d97f7..fa3a6735b 100644 --- a/sharpy/generators/floatingforces.py +++ b/sharpy/generators/floatingforces.py @@ -2,7 +2,8 @@ import h5py as h5 import ctypes as ct import os -from scipy import fft, ifft +from scipy import fft +from scipy.fftpack import ifft from scipy.interpolate import interp1d from control import forced_response, TransferFunction From f390ea04dcf8f0bb54f6b82c2c857653fead45a6 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Fri, 26 Jan 2024 10:18:30 +0000 Subject: [PATCH 13/40] Remove conda/mambda from Github workflow --- .github/workflows/sharpy_tests.yaml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/workflows/sharpy_tests.yaml b/.github/workflows/sharpy_tests.yaml index 5b8b1d546..543f39f48 100644 --- a/.github/workflows/sharpy_tests.yaml +++ b/.github/workflows/sharpy_tests.yaml @@ -31,26 +31,11 @@ jobs: with: version: 10 platform: x64 - #Swapped from Conda to Mamba due to Github runner memory constraint - - name: Setup Mamba - uses: mamba-org/setup-micromamba@v1 - name: Pre-Install dependencies run: | gfortran --version - wget --no-check-certificate https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh -O mamba.sh - bash mamba.sh -b -p $HOME/mamba - export PATH="$HOME/mamba/bin:$PATH" - hash -r - mamba config --set always_yes yes --set changeps1 no - mamba update --name base mamba - mamba list --name base mamba - mamba init bash - hash -r export QT_QPA_PLATFORM='offscreen' sudo apt install libeigen3-dev - mamba env create -f utils/environment.yml - mamba init bash - source activate sharpy git submodule init git submodule update git fetch --tags -f From 4514deaa91015d34d0357f21d79fe3fc611d8673 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Fri, 26 Jan 2024 10:28:07 +0000 Subject: [PATCH 14/40] Update dockerfile to remove mamba/conda dependency --- Dockerfile | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index e6ca1d9df..23982c96c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,6 @@ FROM centos:8 ENV PYTHONDONTWRITEBYTECODE=true ENV BASH_ENV ~/.bashrc SHELL ["/bin/bash", "-c"] -ENV PATH=${PATH}:/mamba/bin # CENTOS 8 has reached end of life - Not yet an updated Docker base for CentOS stream # Point to the CentOS 8 vault in order to download dependencies @@ -17,32 +16,12 @@ RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux && \ yum clean all -# Install Mamba -# Swapped from Conda to Mamba due to Github runner memory constraint -RUN wget --no-check-certificate https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh -O /mamba.sh && \ - chmod +x /mamba.sh && \ - /mamba.sh -b -p /mamba/ && \ - rm /mamba.sh && hash -r - ADD / /sharpy_dir/ -# Update mamba and make it run with no user interaction -# Cleanup mamba installation -RUN mamba init bash -RUN mamba config --set always_yes yes --set changeps1 no -RUN mamba update -q conda -RUN mamba config --set auto_activate_base false -RUN mamba env create -f /sharpy_dir/utils/environment.yml && mamba clean -afy && \ - - find /mamba/ -follow -type f -name '*.a' -delete && \ - find /mamba/ -follow -type f -name '*.pyc' -delete && \ - find /mamba/ -follow -type f -name '*.js.map' -delete - #COPY /utils/docker/* /root/ RUN ln -s /sharpy_dir/utils/docker/* /root/ RUN cd sharpy_dir && \ - mamba activate sharpy && \ git submodule update --init --recursive && \ mkdir build && \ cd build && \ From 52a282e7be5492a4abf628e2e42cffca1609d0c7 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Fri, 26 Jan 2024 10:34:13 +0000 Subject: [PATCH 15/40] Added CMake install to Dockerfile --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 23982c96c..872503f05 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,7 @@ RUN cd /etc/yum.repos.d/ && \ RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux && \ yum clean all +RUN apt-get update && apt-get -y install cmake ADD / /sharpy_dir/ From fccaf87b37f5f76d9a951c1b8892468851c0415b Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Fri, 26 Jan 2024 10:37:31 +0000 Subject: [PATCH 16/40] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 872503f05..7178de850 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN cd /etc/yum.repos.d/ && \ RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux && \ yum clean all -RUN apt-get update && apt-get -y install cmake +RUN yum update && yum -y install cmake ADD / /sharpy_dir/ From de8c9ec712989cf41b1161eef0e2ef476c4acedd Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Fri, 26 Jan 2024 10:40:26 +0000 Subject: [PATCH 17/40] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7178de850..e52ab8993 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN cd /etc/yum.repos.d/ && \ RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux && \ yum clean all -RUN yum update && yum -y install cmake +RUN yum -y update && yum -y install cmake ADD / /sharpy_dir/ From 4b853cf03b3f6c9e23c92ff09d7c3f9ffb422c4b Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Fri, 26 Jan 2024 10:43:15 +0000 Subject: [PATCH 18/40] Update Dockerfile --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index e52ab8993..b0cd4bbf2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,7 @@ RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux && \ yum clean all RUN yum -y update && yum -y install cmake +RUN yum install lapack ADD / /sharpy_dir/ From fa2814a417b23b3488f28ea93bcf5ad007b92821 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Fri, 26 Jan 2024 10:46:29 +0000 Subject: [PATCH 19/40] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b0cd4bbf2..f11b096a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux && \ yum clean all RUN yum -y update && yum -y install cmake -RUN yum install lapack +RUN yum install libblas-dev libblas3 ADD / /sharpy_dir/ From 75e3060dacb791bd6bae9464e6b85589f455a2b2 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Fri, 26 Jan 2024 10:50:21 +0000 Subject: [PATCH 20/40] Update Dockerfile --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f11b096a0..496207299 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,8 +15,9 @@ RUN cd /etc/yum.repos.d/ && \ RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux && \ yum clean all + RUN yum -y update && yum -y install cmake -RUN yum install libblas-dev libblas3 +RUN yum install blas ADD / /sharpy_dir/ From 64e1e68e6d7c1fffd70d0e37a428b1ec95bfecf1 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Tue, 30 Jan 2024 16:31:06 +0000 Subject: [PATCH 21/40] Update Dockerfile --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 496207299..3ce372ed8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,6 @@ RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ yum clean all RUN yum -y update && yum -y install cmake -RUN yum install blas ADD / /sharpy_dir/ @@ -33,5 +32,4 @@ RUN cd sharpy_dir && \ pip install . && \ rm -rf build -ENTRYPOINT ["/bin/bash", "--init-file", "/root/bashrc"] - +ENTRYPOINT ["/bin/bash", "--init-file", "/root/bashrc"] \ No newline at end of file From c986f46b9b835788478132ebfaf97ae546f748ce Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Tue, 30 Jan 2024 16:34:24 +0000 Subject: [PATCH 22/40] Update Dockerfile --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 3ce372ed8..145074270 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,7 @@ RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux && \ yum clean all +RUN yum install libopenblas RUN yum -y update && yum -y install cmake ADD / /sharpy_dir/ From b32b3a48b23e74647376b7eb29be025db870bec8 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Tue, 30 Jan 2024 16:38:12 +0000 Subject: [PATCH 23/40] Update Dockerfile --- Dockerfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 145074270..d951fcee0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,12 +13,9 @@ RUN cd /etc/yum.repos.d/ && \ # Development tools including compilers RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ - yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux && \ + yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack blas vim tmux cmake && \ yum clean all -RUN yum install libopenblas -RUN yum -y update && yum -y install cmake - ADD / /sharpy_dir/ #COPY /utils/docker/* /root/ From c1bbc79f17f5d3d3102d1bc900ef946de644185e Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Tue, 30 Jan 2024 16:43:04 +0000 Subject: [PATCH 24/40] Update Dockerfile --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d951fcee0..550a6d657 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,9 +13,12 @@ RUN cd /etc/yum.repos.d/ && \ # Development tools including compilers RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ - yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack blas vim tmux cmake && \ + yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux cmake && \ yum clean all +RUN yum localinstall 'https://centos.pkgs.org/7/centos-x86_64/blas-3.4.2-8.el7.x86_64.rpm' + + ADD / /sharpy_dir/ #COPY /utils/docker/* /root/ From 00ceec2a8c7e2aa459a159429cc0b1a2be0d7ca1 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Tue, 30 Jan 2024 16:46:42 +0000 Subject: [PATCH 25/40] Update Dockerfile --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 550a6d657..95e889998 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,8 +16,7 @@ RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux cmake && \ yum clean all -RUN yum localinstall 'https://centos.pkgs.org/7/centos-x86_64/blas-3.4.2-8.el7.x86_64.rpm' - +RUN yum install openblas-devel.x86_64 -y ADD / /sharpy_dir/ From 3f922bc57087834995d44c4b577d4136a0ed0e72 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Tue, 30 Jan 2024 16:49:59 +0000 Subject: [PATCH 26/40] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 95e889998..9d3c876f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux cmake && \ yum clean all -RUN yum install openblas-devel.x86_64 -y +RUN yum install openblas.x86_64 -y ADD / /sharpy_dir/ From 47cd9798c002e7fdda617a1815555c85abd3c869 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Tue, 30 Jan 2024 16:56:58 +0000 Subject: [PATCH 27/40] Update Dockerfile --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9d3c876f5..4f21337d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,8 @@ RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux cmake && \ yum clean all -RUN yum install openblas.x86_64 -y +RUN yum-config-manager --add-repo https://yum.repos.intel.com/mkl/setup/intel-mkl.repo && \ + yum install intel-mkl-2020.0-088 ADD / /sharpy_dir/ From da725cec8460e3594b5bb322fdea4caea945cca3 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Tue, 30 Jan 2024 17:01:53 +0000 Subject: [PATCH 28/40] Update Dockerfile --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4f21337d3..5d5c0963c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,8 +16,10 @@ RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux cmake && \ yum clean all -RUN yum-config-manager --add-repo https://yum.repos.intel.com/mkl/setup/intel-mkl.repo && \ - yum install intel-mkl-2020.0-088 +RUN yum install yum-utils + +RUN yum config-manager --add-repo https://yum.repos.intel.com/mkl/setup/intel-mkl.repo +RUN yum install intel-mkl-2020.0-088 ADD / /sharpy_dir/ From 03a4d0f1c7505c3b718679842c315e5345052d8a Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Tue, 30 Jan 2024 17:03:43 +0000 Subject: [PATCH 29/40] Update Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5d5c0963c..ae5be5e42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,10 +16,10 @@ RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux cmake && \ yum clean all -RUN yum install yum-utils +RUN yum install -y yum-utils RUN yum config-manager --add-repo https://yum.repos.intel.com/mkl/setup/intel-mkl.repo -RUN yum install intel-mkl-2020.0-088 +RUN yum install -y intel-mkl-2020.0-088 ADD / /sharpy_dir/ From 226a6b730576b623d549250c49503a5efb796d72 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Thu, 8 Feb 2024 13:59:33 +0000 Subject: [PATCH 30/40] Return Dockerfile to using conda/mamba --- Dockerfile | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index ae5be5e42..2b65297bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ FROM centos:8 ENV PYTHONDONTWRITEBYTECODE=true ENV BASH_ENV ~/.bashrc SHELL ["/bin/bash", "-c"] +ENV PATH=${PATH}:/mamba/bin # CENTOS 8 has reached end of life - Not yet an updated Docker base for CentOS stream # Point to the CentOS 8 vault in order to download dependencies @@ -13,20 +14,35 @@ RUN cd /etc/yum.repos.d/ && \ # Development tools including compilers RUN yum groupinstall "Development Tools" -y --nogpgcheck && \ - yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux cmake && \ + yum install -y --nogpgcheck mesa-libGL libXt libXt-devel wget gcc-gfortran lapack vim tmux && \ yum clean all -RUN yum install -y yum-utils - -RUN yum config-manager --add-repo https://yum.repos.intel.com/mkl/setup/intel-mkl.repo -RUN yum install -y intel-mkl-2020.0-088 +# Install Mamba +# Swapped from Conda to Mamba due to Github runner memory constraint +RUN wget --no-check-certificate https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh -O /mamba.sh && \ + chmod +x /mamba.sh && \ + /mamba.sh -b -p /mamba/ && \ + rm /mamba.sh && hash -r ADD / /sharpy_dir/ +# Update mamba and make it run with no user interaction +# Cleanup mamba installation +RUN mamba init bash +RUN mamba config --set always_yes yes --set changeps1 no +RUN mamba update -q conda +RUN mamba config --set auto_activate_base false +RUN mamba env create -f /sharpy_dir/utils/environment.yml && mamba clean -afy && \ + + find /mamba/ -follow -type f -name '*.a' -delete && \ + find /mamba/ -follow -type f -name '*.pyc' -delete && \ + find /mamba/ -follow -type f -name '*.js.map' -delete + #COPY /utils/docker/* /root/ RUN ln -s /sharpy_dir/utils/docker/* /root/ RUN cd sharpy_dir && \ + mamba activate sharpy && \ git submodule update --init --recursive && \ mkdir build && \ cd build && \ From eb32df50a0d378277b0e3c13e25b84ae4c2bda67 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Thu, 8 Feb 2024 14:10:19 +0000 Subject: [PATCH 31/40] Update installation.md --- docs/source/content/installation.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/content/installation.md b/docs/source/content/installation.md index 0128ac81b..053b2f39e 100644 --- a/docs/source/content/installation.md +++ b/docs/source/content/installation.md @@ -18,7 +18,7 @@ Windows users can also run it by first installing the Windows Subsystem for Linu __Required Distributions__ -* Anaconda Python 3.10 +* Python 3.10 (compatility with other versions is not guaranteed) * GCC 6.0 or higher (recommended). C++ and Fortran. __Recommended Software__ @@ -63,7 +63,7 @@ SHARPy can be installed as a standalone package, without the use of a package ma python --version ``` -### Quick install +### Quick install (Standalone) The quick install is geared towards getting the release build of SHARPy running as quickly and simply as possible. 1. Move into the cloned repository: ```bash @@ -138,7 +138,7 @@ or running any SHARPy cases. some dependencies are included in the conda environment. You should now see ```(sharpy)``` on your command line. -### Quick install +### Quick install (Anaconda) The quick install is geared towards getting the release build of SHARPy running as quickly and simply as possible. 1. Move into the cloned repository: ```bash From ce51ac74cd98783ae24c60aa902a3011f1d0a75f Mon Sep 17 00:00:00 2001 From: Ben Preston <144227999+ben-l-p@users.noreply.github.com> Date: Sun, 11 Feb 2024 12:53:45 +0000 Subject: [PATCH 32/40] Added note about different pip install options --- docs/source/content/installation.md | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/docs/source/content/installation.md b/docs/source/content/installation.md index 053b2f39e..7abef6626 100644 --- a/docs/source/content/installation.md +++ b/docs/source/content/installation.md @@ -54,49 +54,48 @@ once you initialise SHARPy you will also automatically clone the relevant versio 2. We will now set up the SHARPy environment that will install other required distributions. -### Setting up the Python Environment (Standalone) +### Quick install (Standalone) -SHARPy can be installed as a standalone package, without the use of a package manager. If you wish to install using the Anaconda package manager, please use the following tutorial [HERE](#setting-up-the-python-environment-anaconda), or make a custom installation with a develop build or modified compilation settings [HERE](#custom-installation). +SHARPy can be installed as a standalone package, without the use of a package manager. If you wish to install using the Anaconda package manager, please use the following tutorial [HERE](#setting-up-the-python-environment-anaconda), or make a custom installation with a develop build or modified compilation settings [HERE](#custom-installation). The quick install is geared towards getting the release build of SHARPy running as quickly and simply as possible. -1. Check that your Python version is 3.10. Higher versions may be incompatible with the required modules. +1. Check that your Python version is 3.10. Other versions may be incompatible with the required modules. ```bash python --version ``` - -### Quick install (Standalone) -The quick install is geared towards getting the release build of SHARPy running as quickly and simply as possible. -1. Move into the cloned repository: + +2. Move into the cloned repository: ```bash cd sharpy ``` -2. Create a directory `build` that will be used during CMake's building process and `cd` into it. +3. Create a directory `build` that will be used during CMake's building process and `cd` into it. Ensure it is located in the main ./sharpy folder otherwise the following steps won't work: ```bash mkdir build cd build ``` -3. Prepare UVLM and xbeam for compilation using `gfortran` and `g++` in their release builds running. If you'd like to +4. Prepare UVLM and xbeam for compilation using `gfortran` and `g++` in their release builds running. If you'd like to change compilers see the Custom Installation. ```bash cmake .. ``` -4. Compile the libraries. +5. Compile the libraries. ```bash make install -j 4 ``` where the number after the `-j` flag will specify how many cores to use during installation. This should take approximately 2 minutes (Tested on MacOS Sonoma). -7. Finally, leave the build directory and install SHARPy: +6. Finally, leave the build directory and install SHARPy: ```bash cd .. pip install . ``` + There are options for what to install if required. For instance, to install the basic package with documentation, just do ```bash pip install .[docs]```. For the whole lot, ```bash pip install .[all]```. -8. You can check the version of SHARPy you are running with: +7. You can check the version of SHARPy you are running with: ```bash sharpy --version ``` From e33d2cc4029a13c8f19d64dad18737e2216d5cd1 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Tue, 20 Feb 2024 19:44:05 +0000 Subject: [PATCH 33/40] Use latest mayavi from Github No longer using "pip install mayavi" as this had build errors depending on python version (known bug) --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index d8e2d5763..2dd39ab92 100644 --- a/setup.py +++ b/setup.py @@ -139,10 +139,9 @@ def run(self): "colorama", "dill", "jupyterlab", - "mayavi", #tvtk + "mayavi @ git+https://github.com/enthought/mayavi.git", #Used for TVTK. Bug in pip install, hence git clone "pandas", "control", - # For pandas excel reader. "openpyxl>=3.0.10", "lxml>=4.4.1", "PySocks", From 654017409bd3923a2c95b62d6c640ff97e4d69f7 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Tue, 20 Feb 2024 21:44:45 +0000 Subject: [PATCH 34/40] Changed docs to include auto built, added ARM64 Conda environment --- docs/source/content/installation.md | 52 +++++++++++++---------------- environment_arm64.yml | 12 +++++++ 2 files changed, 35 insertions(+), 29 deletions(-) create mode 100644 environment_arm64.yml diff --git a/docs/source/content/installation.md b/docs/source/content/installation.md index 7abef6626..f5411f2da 100644 --- a/docs/source/content/installation.md +++ b/docs/source/content/installation.md @@ -1,5 +1,5 @@ # SHARPy v2.2 Installation Guide -__Last revision 26 January 2024__ +__Last revision 20 February 2024__ The following step by step tutorial will guide you through the installation process of SHARPy. This is the updated process valid from v2.2. @@ -9,7 +9,7 @@ __Operating System Requirements__ SHARPy is being developed and tested on the following operating systems: * CentOS 7 and CentOS 8 -* Ubuntu 18.04 LTS +* Ubuntu 22.04 LTS * Debian 10 * MacOS Mojave and Catalina (Intel) * MacOS Sonoma (Apple Silicon M2) @@ -18,8 +18,9 @@ Windows users can also run it by first installing the Windows Subsystem for Linu __Required Distributions__ -* Python 3.10 (compatility with other versions is not guaranteed) +* Python 3.10 or higher * GCC 6.0 or higher (recommended). C++ and Fortran. +* Eigen3, BLAS, MKL/LAPACK (all included in Anaconda) __Recommended Software__ @@ -58,44 +59,36 @@ once you initialise SHARPy you will also automatically clone the relevant versio SHARPy can be installed as a standalone package, without the use of a package manager. If you wish to install using the Anaconda package manager, please use the following tutorial [HERE](#setting-up-the-python-environment-anaconda), or make a custom installation with a develop build or modified compilation settings [HERE](#custom-installation). The quick install is geared towards getting the release build of SHARPy running as quickly and simply as possible. -1. Check that your Python version is 3.10. Other versions may be incompatible with the required modules. +1. If the prerequisite algebra packages are not installed, they can be installed as following (with a Homebrew equivelent for Mac installs): + ```bash + sudo apt install -y libblas-dev liblapack-dev libeigen3-dev + ``` + +2. Check that your Python version is 3.10 or higher. Other versions may be incompatible with the required modules. ```bash python --version ``` -2. Move into the cloned repository: +3. Move into the cloned repository: ```bash cd sharpy ``` -3. Create a directory `build` that will be used during CMake's building process and `cd` into it. - Ensure it is located in the main ./sharpy folder otherwise the following steps won't work: +4. Install SHARPy: ```bash - mkdir build - cd build - ``` - -4. Prepare UVLM and xbeam for compilation using `gfortran` and `g++` in their release builds running. If you'd like to - change compilers see the Custom Installation. - ```bash - cmake .. + pip install . ``` + This will install any required Python packages as well as building the xbeam and UVLM libraries. This may take a few minutes. + + There are options for what to install if required. For instance, to install the basic package with documentation, just do ```bash pip install .[docs]```. For the whole lot, ```bash pip install .[all]```. -5. Compile the libraries. - ```bash - make install -j 4 - ``` - where the number after the `-j` flag will specify how many cores to use during installation. - This should take approximately 2 minutes (Tested on MacOS Sonoma). + In systems without root access, you may not have permission to install using this method. In that case, to complete a local install: -6. Finally, leave the build directory and install SHARPy: ```bash - cd .. - pip install . + python setup.py --user ``` - There are options for what to install if required. For instance, to install the basic package with documentation, just do ```bash pip install .[docs]```. For the whole lot, ```bash pip install .[all]```. -7. You can check the version of SHARPy you are running with: +4. You can check the version of SHARPy you are running with: ```bash sharpy --version ``` @@ -105,8 +98,7 @@ __You are ready to run SHARPy__. Continue reading the [Running SHARPy](#running- ### Setting up the Python Environment (Anaconda) SHARPy can use the Anaconda package manager to provide the necessary Python packages. -These are specified in an Anaconda environment that shall be activated prior to compiling the xbeam and UVLM libraries -or running any SHARPy cases. +These are specified in an Anaconda environment that shall be activated prior to compiling the xbeam and UVLM libraries or running any SHARPy cases. Please note that this install method does 1. If you still do not have it in your system, install the [Anaconda](https://conda.io/docs/) Python 3 distribution. @@ -127,7 +119,9 @@ or running any SHARPy cases. conda env create -f environment.yml cd ../.. ``` - This should take approximately 15 minutes to complete (Tested on Ubuntu 22.04.1). + This should take approximately 15 minutes to complete (Tested on Ubuntu 22.04.1). + + For installation on Apple Silicon, use ```environment_arm64.yml```. This requires GCC and GFortran to be installed prior. 5. Activate the `sharpy` conda environment: ```bash diff --git a/environment_arm64.yml b/environment_arm64.yml new file mode 100644 index 000000000..2b5246d0c --- /dev/null +++ b/environment_arm64.yml @@ -0,0 +1,12 @@ +name: sharpy +channels: + - conda-forge + - defaults +dependencies: + - eigen + - libopenblas + - libblas + - libcblas + - liblapack + - libgfortran + - python=3.10 \ No newline at end of file From 03928aa13fd76cf992ea77dbee906cb381795a5f Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Wed, 21 Feb 2024 08:55:59 +0000 Subject: [PATCH 35/40] Small documentation update --- docs/source/content/installation.md | 39 ++++++++--------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/docs/source/content/installation.md b/docs/source/content/installation.md index f5411f2da..acad2a7ab 100644 --- a/docs/source/content/installation.md +++ b/docs/source/content/installation.md @@ -59,7 +59,7 @@ once you initialise SHARPy you will also automatically clone the relevant versio SHARPy can be installed as a standalone package, without the use of a package manager. If you wish to install using the Anaconda package manager, please use the following tutorial [HERE](#setting-up-the-python-environment-anaconda), or make a custom installation with a develop build or modified compilation settings [HERE](#custom-installation). The quick install is geared towards getting the release build of SHARPy running as quickly and simply as possible. -1. If the prerequisite algebra packages are not installed, they can be installed as following (with a Homebrew equivelent for Mac installs): +1. If the prerequisite algebra packages are not installed, they can be installed as following (with a Homebrew equivelent available for Mac installs): ```bash sudo apt install -y libblas-dev liblapack-dev libeigen3-dev ``` @@ -98,7 +98,7 @@ __You are ready to run SHARPy__. Continue reading the [Running SHARPy](#running- ### Setting up the Python Environment (Anaconda) SHARPy can use the Anaconda package manager to provide the necessary Python packages. -These are specified in an Anaconda environment that shall be activated prior to compiling the xbeam and UVLM libraries or running any SHARPy cases. Please note that this install method does +These are specified in an Anaconda environment that shall be activated prior to compiling the xbeam and UVLM libraries or running any SHARPy cases. 1. If you still do not have it in your system, install the [Anaconda](https://conda.io/docs/) Python 3 distribution. @@ -127,7 +127,7 @@ These are specified in an Anaconda environment that shall be activated prior to ```bash conda activate sharpy ``` - you need to do this before you compile the `xbeam` and `uvlm` libraries, as + This must be done before you compile the `xbeam` and `uvlm` libraries, as some dependencies are included in the conda environment. You should now see ```(sharpy)``` on your command line. @@ -143,38 +143,21 @@ The quick install is geared towards getting the release build of SHARPy running (sharpy) [usr@host] $ ``` - If this is not the case, activate the environment otherwise xbeam and UVLM will not compile. +3. Install SHARPy: ```bash - conda activate sharpy - ``` - -3. Create a directory `build` that will be used during CMake's building process and `cd` into it. - Ensure it is located in the main ./sharpy folder otherwise the following steps won't work: - ```bash - mkdir build - cd build - ``` - -4. Prepare UVLM and xbeam for compilation using `gfortran` and `g++` in their release builds running. If you'd like to - change compilers see the Custom Installation. - ```bash - cmake .. + pip install . ``` + This will install any required Python packages as well as building the xbeam and UVLM libraries. This may take a few minutes. + + There are options for what to install if required. For instance, to install the basic package with documentation, just do ```bash pip install .[docs]```. For the whole lot, ```bash pip install .[all]```. -5. Compile the libraries. - ```bash - make install -j 4 - ``` - where the number after the `-j` flag will specify how many cores to use during installation. - This should take approximately 2 minutes (Tested on MacOS Sonoma). + In systems without root access, you may not have permission to install using this method. In that case, to complete a local install: -7. Finally, leave the build directory and install SHARPy: ```bash - cd .. - pip install . + python setup.py --user ``` -8. You can check the version of SHARPy you are running with: +4. You can check the version of SHARPy you are running with: ```bash sharpy --version ``` From 4e1e22a288f204f1a1d4c3785c2d28ffb5c8ad4c Mon Sep 17 00:00:00 2001 From: Ben Preston <144227999+ben-l-p@users.noreply.github.com> Date: Mon, 26 Feb 2024 09:27:59 +0000 Subject: [PATCH 36/40] Changed docs to use --user flag as default for installation --- docs/source/content/installation.md | 32 +++++++++-------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/docs/source/content/installation.md b/docs/source/content/installation.md index acad2a7ab..848936b06 100644 --- a/docs/source/content/installation.md +++ b/docs/source/content/installation.md @@ -74,19 +74,13 @@ SHARPy can be installed as a standalone package, without the use of a package ma cd sharpy ``` -4. Install SHARPy: +4. Install SHARPy. This will install any required Python packages as well as building the xbeam and UVLM libraries, and may take a few minutes. ```bash - pip install . - ``` - This will install any required Python packages as well as building the xbeam and UVLM libraries. This may take a few minutes. - - There are options for what to install if required. For instance, to install the basic package with documentation, just do ```bash pip install .[docs]```. For the whole lot, ```bash pip install .[all]```. - - In systems without root access, you may not have permission to install using this method. In that case, to complete a local install: - - ```bash - python setup.py --user + pip install --user . ``` + The ```--user``` flag is included for systems without root access (often Linux) as the install will fail otherwise. This flag can be removed when a global install is required, and your machine allows it (works on Mac). + + There are options for what to install if required. For instance, to install the basic package with documentation, just do ```bash pip install --user .[docs]```. For the whole lot, ```bash pip install --user .[all]```. 4. You can check the version of SHARPy you are running with: ```bash @@ -143,19 +137,13 @@ The quick install is geared towards getting the release build of SHARPy running (sharpy) [usr@host] $ ``` -3. Install SHARPy: +3. Install SHARPy. This will install any required Python packages as well as building the xbeam and UVLM libraries, and may take a few minutes. ```bash - pip install . - ``` - This will install any required Python packages as well as building the xbeam and UVLM libraries. This may take a few minutes. - - There are options for what to install if required. For instance, to install the basic package with documentation, just do ```bash pip install .[docs]```. For the whole lot, ```bash pip install .[all]```. - - In systems without root access, you may not have permission to install using this method. In that case, to complete a local install: - - ```bash - python setup.py --user + pip install --user . ``` + The ```--user``` flag is included for systems without root access (often Linux) as the install will fail otherwise. This flag can be removed when a global install is required, and your machine allows it (works on Mac). + + There are options for what to install if required. For instance, to install the basic package with documentation, just do ```bash pip install --user .[docs]```. For the whole lot, ```bash pip install --user .[all]```. 4. You can check the version of SHARPy you are running with: ```bash From 2441ee197cbf3bace5fcce5287260cbc0b192272 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Mon, 26 Feb 2024 11:45:34 +0000 Subject: [PATCH 37/40] Added a few more install dependencies to the docs --- docs/source/content/installation.md | 47 ++++++++++++----------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/docs/source/content/installation.md b/docs/source/content/installation.md index 848936b06..baa97c2f3 100644 --- a/docs/source/content/installation.md +++ b/docs/source/content/installation.md @@ -1,5 +1,5 @@ # SHARPy v2.2 Installation Guide -__Last revision 20 February 2024__ +__Last revision 26 February 2024__ The following step by step tutorial will guide you through the installation process of SHARPy. This is the updated process valid from v2.2. @@ -19,9 +19,15 @@ Windows users can also run it by first installing the Windows Subsystem for Linu __Required Distributions__ * Python 3.10 or higher -* GCC 6.0 or higher (recommended). C++ and Fortran. +* CMake +* GCC 6.0 or higher, G++, GFortran (all included in Anaconda) * Eigen3, BLAS, MKL/LAPACK (all included in Anaconda) +If the prerequisite packages are not installed and you are not using Anaconda, they can be installed as following on Linux (with a Homebrew equivelent available for Mac installs): +```bash +sudo apt install -y cmake g++ gfortran libblas-dev liblapack-dev libeigen3-dev +``` + __Recommended Software__ You may find the applications below useful, we recommend you use them but cannot provide any direct support. @@ -46,35 +52,29 @@ once you initialise SHARPy you will also automatically clone the relevant versio ### Set up the folder structure -1. Clone `sharpy` in your desired location, if you agree with the license in `license.txt`. - ```bash - git clone --recursive http://github.com/ImperialCollegeLondon/sharpy - ``` - The `--recursive` flag will also initialise and update the submodules SHARPy depends on, - [xbeam](http://github.com/imperialcollegelondon/xbeam) and [UVLM](http://github.com/imperialcollegelondon/UVLM). +Clone `sharpy` in your desired location, if you agree with the license in `license.txt`. +```bash +git clone --recursive http://github.com/ImperialCollegeLondon/sharpy +``` +The `--recursive` flag will also initialise and update the submodules SHARPy depends on, +[xbeam](http://github.com/imperialcollegelondon/xbeam) and [UVLM](http://github.com/imperialcollegelondon/UVLM). -2. We will now set up the SHARPy environment that will install other required distributions. ### Quick install (Standalone) SHARPy can be installed as a standalone package, without the use of a package manager. If you wish to install using the Anaconda package manager, please use the following tutorial [HERE](#setting-up-the-python-environment-anaconda), or make a custom installation with a develop build or modified compilation settings [HERE](#custom-installation). The quick install is geared towards getting the release build of SHARPy running as quickly and simply as possible. -1. If the prerequisite algebra packages are not installed, they can be installed as following (with a Homebrew equivelent available for Mac installs): - ```bash - sudo apt install -y libblas-dev liblapack-dev libeigen3-dev - ``` - -2. Check that your Python version is 3.10 or higher. Other versions may be incompatible with the required modules. +1. Check that your Python version is 3.10 or higher. Other versions may be incompatible with the required modules. ```bash python --version ``` -3. Move into the cloned repository: +2. Move into the cloned repository: ```bash cd sharpy ``` -4. Install SHARPy. This will install any required Python packages as well as building the xbeam and UVLM libraries, and may take a few minutes. +3. Install SHARPy. This will install any required Python packages as well as building the xbeam and UVLM libraries, and may take a few minutes. ```bash pip install --user . ``` @@ -100,7 +100,7 @@ These are specified in an Anaconda environment that shall be activated prior to ```bash python --version ``` -3. If python 3.10 is needed, use: +3. If a specific python version is required, for example 3.10, use: ```bash conda install python=3.10 @@ -109,20 +109,15 @@ These are specified in an Anaconda environment that shall be activated prior to 4. Create the conda environment that SHARPy will use: ```bash - cd sharpy/utils conda env create -f environment.yml - cd ../.. ``` - This should take approximately 15 minutes to complete (Tested on Ubuntu 22.04.1). - - For installation on Apple Silicon, use ```environment_arm64.yml```. This requires GCC and GFortran to be installed prior. + This should take approximately 5 minutes to complete (Tested on Ubuntu 22.04.1). For installation on Apple Silicon, use ```environment_arm64.yml```; this requires GCC and GFortran to be installed prior. 5. Activate the `sharpy` conda environment: ```bash conda activate sharpy ``` - This must be done before you compile the `xbeam` and `uvlm` libraries, as - some dependencies are included in the conda environment. You should now see ```(sharpy)``` on your command line. + You should now see ```(sharpy)``` on your command line. ### Quick install (Anaconda) @@ -173,9 +168,7 @@ to your taste. This is compatible with both standalone and Anaconda installation 2. If using Anaconda, create the conda environment that SHARPy will use and activate the environment: ```bash - cd sharpy/utils conda env create -f environment.yml - cd ../.. ``` ```bash From 719dcfa946a8f836dcdb7137832b8a3fff786195 Mon Sep 17 00:00:00 2001 From: Rafa Palacios Date: Mon, 26 Feb 2024 16:53:53 +0000 Subject: [PATCH 38/40] Update installation.md Working like a charm on Debian 12, so I've updated the version in the docs. --- docs/source/content/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/content/installation.md b/docs/source/content/installation.md index baa97c2f3..0d47ed47c 100644 --- a/docs/source/content/installation.md +++ b/docs/source/content/installation.md @@ -10,7 +10,7 @@ __Operating System Requirements__ SHARPy is being developed and tested on the following operating systems: * CentOS 7 and CentOS 8 * Ubuntu 22.04 LTS -* Debian 10 +* Debian 12 * MacOS Mojave and Catalina (Intel) * MacOS Sonoma (Apple Silicon M2) From 646e5f09292b87efc5a208071aac2e10b9f2233d Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Mon, 26 Feb 2024 18:38:15 +0000 Subject: [PATCH 39/40] Removed SciPy FFT fix - will add to another pull request --- sharpy/generators/floatingforces.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sharpy/generators/floatingforces.py b/sharpy/generators/floatingforces.py index fa3a6735b..c296d97f7 100644 --- a/sharpy/generators/floatingforces.py +++ b/sharpy/generators/floatingforces.py @@ -2,8 +2,7 @@ import h5py as h5 import ctypes as ct import os -from scipy import fft -from scipy.fftpack import ifft +from scipy import fft, ifft from scipy.interpolate import interp1d from control import forced_response, TransferFunction From 906a56613cf1880ee6018d67d26b27ca19959c30 Mon Sep 17 00:00:00 2001 From: Ben Preston Date: Mon, 26 Feb 2024 18:49:33 +0000 Subject: [PATCH 40/40] Readded SciPy FFT changes --- sharpy/generators/floatingforces.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sharpy/generators/floatingforces.py b/sharpy/generators/floatingforces.py index c296d97f7..832833321 100644 --- a/sharpy/generators/floatingforces.py +++ b/sharpy/generators/floatingforces.py @@ -2,7 +2,7 @@ import h5py as h5 import ctypes as ct import os -from scipy import fft, ifft +from scipy.fft import fft, ifft from scipy.interpolate import interp1d from control import forced_response, TransferFunction