From caf99d2e185e309ade56d8875fd43cc377251108 Mon Sep 17 00:00:00 2001 From: Chris Lowder Date: Tue, 18 Mar 2025 15:17:23 -0600 Subject: [PATCH 01/22] renames linux install notes with sudo access --- doc/{install-linux.md => install-linux-sudo.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/{install-linux.md => install-linux-sudo.md} (100%) diff --git a/doc/install-linux.md b/doc/install-linux-sudo.md similarity index 100% rename from doc/install-linux.md rename to doc/install-linux-sudo.md From 08894188ff746c7ac6fd3aaa13d2e8e98f6f17c3 Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Tue, 18 Mar 2025 17:26:06 -0600 Subject: [PATCH 02/22] instantiate linux installation instructions --- doc/install-linux.md | 130 +++++++++++++++++++++++++++++++++++++++++++ doc/set_paths.sh | 57 +++++++++++++++++++ 2 files changed, 187 insertions(+) create mode 100644 doc/install-linux.md create mode 100644 doc/set_paths.sh diff --git a/doc/install-linux.md b/doc/install-linux.md new file mode 100644 index 0000000..606f563 --- /dev/null +++ b/doc/install-linux.md @@ -0,0 +1,130 @@ +# Linux Installation Instructions + +These instructions were created by installing FLUX on two different linux servers running AlmaLinux. Please let us know if anything breaks! + +## 1. Get Conda Environment Manager + +```sh +wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh +bash Miniconda3-latest-Linux-x86_64.sh +``` + +Follow the prompts: +- Hold down the arrow key and then accept terms. +- Accept Conda activation at startup. +- Exit and reconnect to the SSH session/ shell session. + +## 2. Create Conda Environment and Get Dependencies + +```sh +conda create -n fluxenv +conda activate fluxenv +conda install -c conda-forge gcc gxx binutils c-compiler gsl perl perl-app-cpanminus perl-extutils-makemaker make cmake automake autoconf libtool m4 patch libxcrypt gnuplot cairo pango qt pfsspy sqlite +``` + +Confirm installation by typing `y` when prompted. + +## 3. Install the Perl Data Language (PDL) + +```sh +cpanm Alien::Build::Plugin::Gather::Dino Capture::Tiny Chart::Gnuplot Config::IniFiles Devel::CheckLib File::HomeDir File::Map File::ShareDir File::ShareDir::Install File::Which Inline Inline::C Inline::Python List::MoreUtils Math::GSL Math::GSL::Alien Math::Interpolate Math::Interpolator Math::RungeKutta Moo::Role Net::SSLeay PDL PDL::GSL PDL::GSL::INTEG PDL::Graphics::Gnuplot PDL::Graphics::Simple Parallel::ForkManager Term::ReadKey Test::Builder Text::CSV local::lib +``` + +If the system struggles with `File::Map`, try: + +```sh +export LDFLAGS="" +export CFLAGS="-O2" +export PERL_LDFLAGS="" +export PERL_CFLAGS="-O2" +export LD=x86_64-conda-linux-gnu-gcc +export CC=x86_64-conda-linux-gnu-gcc +``` + +If `Inline::C` isn’t found, run: + +```sh +cpanm Inline::C +``` + +## 4. Get FLUX + +Set the prefixes for a conda installation: + +```sh +export PL_PREFIX="$CONDA_PREFIX/lib/perl5/site_perl" +export FL_PREFIX="$CONDA_PREFIX" +mkdir -p "$FL_PREFIX" +``` + +Clone and configure Flux: + +```sh +git clone https://github.com/lowderchris/fluxon-mhd.git +cd fluxon-mhd +make everything +``` + +If Flux isn't found at the end of the install, try: + +```sh +export PERL5LIB=$(dirname $(find $CONDA_PREFIX -name Flux.pm)) +make everything +``` +To set up the necessary environment variables and update the appropriate configuration files, please download or navigate to the provided script located at [fluxon-mhd/doc/set_paths.sh](https://github.com/lowderchris/fluxon-mhd/blob/documentation/doc/set_paths.sh). Run the script, which will automatically add the Perl autoloader and Flux installation paths to your conda environment configuration files. + +```sh +# Download the script +wget https://github.com/lowderchris/fluxon-mhd/raw/documentation/doc/set_paths.sh + +# Run the script +bash set_paths.sh +``` + +Confirm installation success: + +```sh +perl -e "use Flux;" +``` + +## 5. Get Fluxpype Wrapper (To run FLUX with) + +```sh +cd .. +git clone https://github.com/GillySpace27/fluxpype.git +cd fluxpype +git checkout pythonify +pip install -e . +``` + +If the GCC version is too old, fix it with: + +```sh +export CC=$(which gcc) +export CXX=$(which g++) +``` + +## 6. Configure the `config.ini` File + +```sh +nano fluxpype/config.ini +``` + +Set the code to do your desired run using the documentation (TBD) + +Run the configuration run script: + +```sh +python fluxpype/config_runner.py +``` +- For the paths to work out, the config file must be called from one directory above the file. + + +## FAQs & Troubleshooting +- If gnuplot is not detected correctly in PDL, try the following, and if it works, put this line into either the conda activation script or the bashrc file: + - ```export GNUPLOT_BINARY=$(realpath $(which gnuplot))``` + +- If GSL is not found, use + - ```conda install gsl``` + - ```cpanm --notest PDL::GSL``` + diff --git a/doc/set_paths.sh b/doc/set_paths.sh new file mode 100644 index 0000000..119b375 --- /dev/null +++ b/doc/set_paths.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# Required content for the ~/.perldlrc file +required_content=$(cat <<'EOF' +require(q|PDL/default.perldlrc|); +use PDL::AutoLoader; +$PDL::AutoLoader::Rescan=1; +1; +EOF +) + +# Path to the ~/.perldlrc file +perldlrc="$HOME/.perldlrc" + +# Check if the required content is already in the ~/.perldlrc file +if [ -e "$perldlrc" ]; then + if grep -Fxq "$required_content" "$perldlrc"; then + echo "Content already exists in ~/.perldlrc" + else + echo "$required_content" >> "$perldlrc" + echo "Appended required content to ~/.perldlrc" + fi +else + echo "$required_content" > "$perldlrc" + echo "Created ~/.perldlrc and added required content" +fi + +# Create activate.d directory if it doesn't exist +mkdir -p "$CONDA_PREFIX/etc/conda/activate.d" + +# Locate Flux.pm and set PERL5LIB +export PERL5LIB=$(dirname "$(find "$CONDA_PREFIX" -name Flux.pm)"):$PERL5LIB + +# Locate Flux module directory and set PDLLIB +export PDLLIB=$(find "$CONDA_PREFIX" -type d -name "Flux" | grep "/share/dist/" | head -n 1):$PDLLIB + +# Create the environment variable setup script +cat > "$CONDA_PREFIX/etc/conda/activate.d/env_vars.sh" < Date: Tue, 18 Mar 2025 17:29:32 -0600 Subject: [PATCH 03/22] iterate documentation clarity --- doc/install-linux.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/install-linux.md b/doc/install-linux.md index 606f563..60d22d5 100644 --- a/doc/install-linux.md +++ b/doc/install-linux.md @@ -65,10 +65,10 @@ cd fluxon-mhd make everything ``` -If Flux isn't found at the end of the install, try: +If Flux.pm isn't found at the end of the install, try: ```sh -export PERL5LIB=$(dirname $(find $CONDA_PREFIX -name Flux.pm)) +export PERL5LIB=$(dirname $(find $CONDA_PREFIX -name Flux.pm)):$PERL5LIB make everything ``` To set up the necessary environment variables and update the appropriate configuration files, please download or navigate to the provided script located at [fluxon-mhd/doc/set_paths.sh](https://github.com/lowderchris/fluxon-mhd/blob/documentation/doc/set_paths.sh). Run the script, which will automatically add the Perl autoloader and Flux installation paths to your conda environment configuration files. @@ -117,7 +117,7 @@ Run the configuration run script: ```sh python fluxpype/config_runner.py ``` -- For the paths to work out, the config file must be called from one directory above the file. +- For the paths to work out, the config runner must be called from one directory above the file. ## FAQs & Troubleshooting From 49248b856bf51c6bea8a60ae4fc3a089f5bae98a Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Tue, 18 Mar 2025 19:34:08 -0600 Subject: [PATCH 04/22] archive the older versions --- doc/{ => old}/install-linux-sudo.md | 0 doc/old/install-macos-condaless.md | 92 +++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) rename doc/{ => old}/install-linux-sudo.md (100%) create mode 100644 doc/old/install-macos-condaless.md diff --git a/doc/install-linux-sudo.md b/doc/old/install-linux-sudo.md similarity index 100% rename from doc/install-linux-sudo.md rename to doc/old/install-linux-sudo.md diff --git a/doc/old/install-macos-condaless.md b/doc/old/install-macos-condaless.md new file mode 100644 index 0000000..5d82aea --- /dev/null +++ b/doc/old/install-macos-condaless.md @@ -0,0 +1,92 @@ +# macOS Installation + +To install the fluxon-mhd modeling framework, there are three main requirements - a perl installation with libraries, the perl data language toolset, and finally compiling the fluxon-mhd software itself. + +Homebrew and the base perl installation will be installed as a user that has full system access, with further packages and flux itself installed locally. This provides both a buffer if the system perl is updated, and also allows regular access for users who do not have regular administrative privileges. Note that if you have an admin user account, you can also install everything within the homebrew perl library directory, updating paths below accordingly. + +## Perl installation + +First, install the homebrew package, which will require being logged in as an admin user. Follow through the installation process. +```shell +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +``` + +Make sure at the end of this to follow the instructions for adding homebrew to your path +```shell +(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users//.zprofile +eval "$(/opt/homebrew) +``` + +Next, use homebrew as an admin user to install perl. +```shell +brew install perl +``` + +If you plan on using homebrew for other packages, and would like to keep perl from updating alongside other packages, the installation can be frozen. +```shell +brew pin perl +``` + +Two more homebrew packages will be needed later, which can also be installed via an admin user. +```shell +brew install gnuplot +brew install fftw +``` + +The final suggested step as an admin user is to setup the cpanminus tool for installing perl packages. +```shell +brew install cpanminus +``` + +Set perl to install packages to a local library directory. Here we've chosen to use a perl5 directory inside the ~/Library folder, but this could be anywhere your user has permissions. This is then stored to automatically update in a .zprofile startup script for Zsh - modify if using a different shell. +```shell +PERL_MM_OPT="INSTALL_BASE=~/Library/perl5" cpanm --local-lib=~/Library/perl5 local::lib +echo 'eval `perl -I ~/Library/perl5/lib/perl5 -Mlocal::lib=~/Library/perl5`' >> ~/.zprofile +source ~/.zprofile +``` + +Write the following to ~/.perldlrc, making sure to reference the appropriate location local perl libraries will be installed to. +```shell +push(@INC, "/Users//Library/perl5/lib/perl5/5.38.2"); + +require('PDL/default.perldlrc'); + +use PDL::AutoLoader; +$PDL::AutoLoader::Rescan=1; + +1; + +``` + +## Perl Data Language (PDL) installation + +Using cpanm, install PDL and required depedencies. +```shell +cpanm PDL +``` + +A few other packages of note will be needed for the later fluxon-mhd install. +```shell +cpanm File::ShareDir +cpanm PDL::Graphics::Gnuplot +cpanm Math::RungeKutta +cpanm Term::ReadKey +``` + +## FLUX installation + +Finally, for the first install, and for future recompilations, set the perl and flux prefix paths. +```shell +export PL_PREFIX='/Users//Library/perl5' +export FL_PREFIX='/Users//Library/flux' +``` + +If you haven't already, clone the fluxon-mhd repository and then make everything from the base directory. +```shell +git clone https://github.com/lowderchris/fluxon-mhd.git +cd fluxon-mhd + +make everything +``` + +After this, make sure to follow the printed instructions for appending your PDLLIB path, and .perldlrc file. From 7ef558f047bd74a8be0f5d38807152000b9adc66 Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Tue, 18 Mar 2025 19:34:28 -0600 Subject: [PATCH 05/22] instantiate the new install docs --- doc/install-linux.md | 2 +- doc/install-macos.md | 185 ++++++++++++++++++++++++++++++------------- 2 files changed, 129 insertions(+), 58 deletions(-) diff --git a/doc/install-linux.md b/doc/install-linux.md index 60d22d5..8bc0e24 100644 --- a/doc/install-linux.md +++ b/doc/install-linux.md @@ -24,7 +24,7 @@ conda install -c conda-forge gcc gxx binutils c-compiler gsl perl perl-app-cpanm Confirm installation by typing `y` when prompted. -## 3. Install the Perl Data Language (PDL) +## 3. Install the Perl Data Language (PDL) and Dependencies ```sh cpanm Alien::Build::Plugin::Gather::Dino Capture::Tiny Chart::Gnuplot Config::IniFiles Devel::CheckLib File::HomeDir File::Map File::ShareDir File::ShareDir::Install File::Which Inline Inline::C Inline::Python List::MoreUtils Math::GSL Math::GSL::Alien Math::Interpolate Math::Interpolator Math::RungeKutta Moo::Role Net::SSLeay PDL PDL::GSL PDL::GSL::INTEG PDL::Graphics::Gnuplot PDL::Graphics::Simple Parallel::ForkManager Term::ReadKey Test::Builder Text::CSV local::lib diff --git a/doc/install-macos.md b/doc/install-macos.md index 5d82aea..df71945 100644 --- a/doc/install-macos.md +++ b/doc/install-macos.md @@ -1,92 +1,163 @@ -# macOS Installation +# Linux Installation Instructions -To install the fluxon-mhd modeling framework, there are three main requirements - a perl installation with libraries, the perl data language toolset, and finally compiling the fluxon-mhd software itself. +These instructions were created by adapting the linux conda install to macos. Please let us know if anything breaks! -Homebrew and the base perl installation will be installed as a user that has full system access, with further packages and flux itself installed locally. This provides both a buffer if the system perl is updated, and also allows regular access for users who do not have regular administrative privileges. Note that if you have an admin user account, you can also install everything within the homebrew perl library directory, updating paths below accordingly. +## 1. Get Conda Environment Manager +Depending on your mac's architechture, either get +```sh +curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh +bash ~/Miniconda3-latest-MacOSX-arm64.sh +``` -## Perl installation +or -First, install the homebrew package, which will require being logged in as an admin user. Follow through the installation process. -```shell -/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +``` sh +curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh +bash ~/Miniconda3-latest-MacOSX-x86_64.sh ``` -Make sure at the end of this to follow the instructions for adding homebrew to your path -```shell -(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users//.zprofile -eval "$(/opt/homebrew) +Follow the prompts: +- Hold down the arrow key and then accept terms. +- Accept Conda activation at startup. +- Exit and reconnect to the SSH session/ shell session. + +## 2. Create Conda Environment and Get Dependencies + +```sh +conda create -n fluxenv +conda activate fluxenv +conda install -c conda-forge c-compiler gsl perl perl-app-cpanminus perl-extutils-makemaker make cmake automake autoconf libtool m4 patch libxcrypt gnuplot cairo pango qt pfsspy sqlite ``` -Next, use homebrew as an admin user to install perl. -```shell -brew install perl +Confirm installation by typing `y` when prompted. + +## 3. Install the Perl Data Language (PDL) and Dependencies + +```sh +cpanm Alien::Build::Plugin::Gather::Dino Capture::Tiny Chart::Gnuplot Config::IniFiles Devel::CheckLib File::HomeDir File::Map File::ShareDir File::ShareDir::Install File::Which Inline Inline::C Inline::Python List::MoreUtils Math::GSL Math::GSL::Alien Math::Interpolate Math::Interpolator Math::RungeKutta Moo::Role Net::SSLeay PDL PDL::GSL PDL::GSL::INTEG PDL::Graphics::Gnuplot PDL::Graphics::Simple Parallel::ForkManager Term::ReadKey Test::Builder Text::CSV local::lib ``` -If you plan on using homebrew for other packages, and would like to keep perl from updating alongside other packages, the installation can be frozen. -```shell -brew pin perl +If the system struggles with `File::Map`, try: + +```sh +export LDFLAGS="" +export CFLAGS="-O2" +export PERL_LDFLAGS="" +export PERL_CFLAGS="-O2" +export LD=x86_64-conda-linux-gnu-gcc +export CC=x86_64-conda-linux-gnu-gcc ``` -Two more homebrew packages will be needed later, which can also be installed via an admin user. -```shell -brew install gnuplot -brew install fftw +If `Inline::C` isn’t found, run: + +```sh +cpanm Inline::C ``` -The final suggested step as an admin user is to setup the cpanminus tool for installing perl packages. -```shell -brew install cpanminus +## 4. Get FLUX + +Set the prefixes for a conda installation: + +```sh +export PL_PREFIX="$CONDA_PREFIX/lib/perl5/site_perl" +export FL_PREFIX="$CONDA_PREFIX" +mkdir -p "$FL_PREFIX" ``` -Set perl to install packages to a local library directory. Here we've chosen to use a perl5 directory inside the ~/Library folder, but this could be anywhere your user has permissions. This is then stored to automatically update in a .zprofile startup script for Zsh - modify if using a different shell. -```shell -PERL_MM_OPT="INSTALL_BASE=~/Library/perl5" cpanm --local-lib=~/Library/perl5 local::lib -echo 'eval `perl -I ~/Library/perl5/lib/perl5 -Mlocal::lib=~/Library/perl5`' >> ~/.zprofile -source ~/.zprofile +Clone and configure Flux: + +```sh +git clone https://github.com/lowderchris/fluxon-mhd.git +cd fluxon-mhd +make everything ``` -Write the following to ~/.perldlrc, making sure to reference the appropriate location local perl libraries will be installed to. -```shell -push(@INC, "/Users//Library/perl5/lib/perl5/5.38.2"); +If Flux.pm isn't found at the end of the install, try: + +```sh +export PERL5LIB=$(dirname $(find $CONDA_PREFIX -name Flux.pm)):$PERL5LIB +make everything +``` +To set up the necessary environment variables and update the appropriate configuration files, please download or navigate to the provided script located at [fluxon-mhd/doc/set_paths.sh](https://github.com/lowderchris/fluxon-mhd/blob/documentation/doc/set_paths.sh). Run the script, which will automatically add the Perl autoloader and Flux installation paths to your conda environment configuration files. -require('PDL/default.perldlrc'); +```sh +# Download the script +wget https://github.com/lowderchris/fluxon-mhd/raw/documentation/doc/set_paths.sh -use PDL::AutoLoader; -$PDL::AutoLoader::Rescan=1; +# Run the script +bash set_paths.sh +``` -1; +Confirm installation success: +```sh +perl -e "use Flux;" ``` -## Perl Data Language (PDL) installation +## 5. Get Fluxpype Wrapper (To run FLUX with) -Using cpanm, install PDL and required depedencies. -```shell -cpanm PDL +```sh +cd .. +git clone https://github.com/GillySpace27/fluxpype.git +cd fluxpype +git checkout pythonify +pip install -e . ``` -A few other packages of note will be needed for the later fluxon-mhd install. -```shell -cpanm File::ShareDir -cpanm PDL::Graphics::Gnuplot -cpanm Math::RungeKutta -cpanm Term::ReadKey +If the GCC version is too old, fix it with: + +```sh +export CC=$(which gcc) +export CXX=$(which g++) ``` -## FLUX installation +## 6. Configure the `config.ini` File -Finally, for the first install, and for future recompilations, set the perl and flux prefix paths. -```shell -export PL_PREFIX='/Users//Library/perl5' -export FL_PREFIX='/Users//Library/flux' +```sh +nano fluxpype/config.ini ``` -If you haven't already, clone the fluxon-mhd repository and then make everything from the base directory. -```shell -git clone https://github.com/lowderchris/fluxon-mhd.git -cd fluxon-mhd +Set the code to do your desired run using the documentation (TBD) -make everything +Run the configuration run script: + +```sh +python fluxpype/config_runner.py ``` +- For the paths to work out, the config runner must be called from one directory above the file. + + +## FAQs & Troubleshooting +- If an error says that a perl file cannot be found, make sure there isn't a syntax error somewhere in that file, because it will say it cannot find it when it means it cannot compile it. + +- If gnuplot is not detected correctly in PDL, try the following, and if it works, put this line into either the conda activation script or the bashrc file: + - ```export GNUPLOT_BINARY=$(realpath $(which gnuplot))``` + +- If GSL is not found, use + - ```conda install gsl``` + - ```cpanm --notest PDL::GSL``` + +- If net-SSLeay fails to install, try this + - ```conda install openssl=1.1.1``` + - ```cpanm PDL::Graphics::Gnuplot``` + +- If Math::GSL::Alien fails to install, try + - ```conda install gsl``` + - ```cpanm --notest PDL::GSL``` + + +- if the wrong cpanm is getting in the way, delete it using the wrong path as follows + - ```export PATH=$(echo "$PATH" | sed 's|/Users/cgilbert/perl5/perlbrew/bin:||')``` + - then try to use the huge cpanm installation command above + - then run the set_paths.sh file + - activate the environment + - make everything + +- if the paths seem completely wrong, try these in the fluxon-mhd directory + - ```make uninstall``` + - ```make clean``` + +- if the error is: Can't locate Alien/Gnuplot.pm in @INC + - ```cpanm Alien::Gnuplot``` -After this, make sure to follow the printed instructions for appending your PDLLIB path, and .perldlrc file. +- if fluxpype cannot find the run file, check the paths at the top of ```config.ini``` to make sure that the path is correct. \ No newline at end of file From 31d40b6ff8adfc2a196481aed93178e72067e6a6 Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Thu, 20 Mar 2025 15:34:52 -0600 Subject: [PATCH 06/22] Fix typo --- doc/install-linux.md | 2 +- doc/install-macos.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/install-linux.md b/doc/install-linux.md index 8bc0e24..757c936 100644 --- a/doc/install-linux.md +++ b/doc/install-linux.md @@ -1,6 +1,6 @@ # Linux Installation Instructions -These instructions were created by installing FLUX on two different linux servers running AlmaLinux. Please let us know if anything breaks! +These instructions were created by installing FLUX on two different linux servers running AlmaLinux. Please let us know if anything breaks! Extra troubleshooting steps are listed at the bottom. ## 1. Get Conda Environment Manager diff --git a/doc/install-macos.md b/doc/install-macos.md index df71945..7c78816 100644 --- a/doc/install-macos.md +++ b/doc/install-macos.md @@ -1,6 +1,7 @@ -# Linux Installation Instructions +# Macos Installation Instructions These instructions were created by adapting the linux conda install to macos. Please let us know if anything breaks! +Extra troubleshooting steps are listed at the bottom. ## 1. Get Conda Environment Manager Depending on your mac's architechture, either get From b2ba58a685cc9f60b8e1ea3b48724478f4b78a78 Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Thu, 20 Mar 2025 16:55:42 -0600 Subject: [PATCH 07/22] make path finding portable --- doc/set_paths.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/set_paths.sh b/doc/set_paths.sh index 119b375..31b555d 100644 --- a/doc/set_paths.sh +++ b/doc/set_paths.sh @@ -29,10 +29,10 @@ fi mkdir -p "$CONDA_PREFIX/etc/conda/activate.d" # Locate Flux.pm and set PERL5LIB -export PERL5LIB=$(dirname "$(find "$CONDA_PREFIX" -name Flux.pm)"):$PERL5LIB +export PERL5LIB=$(find "$CONDA_PREFIX" -name Flux.pm -exec dirname {} \; | tr '\n' ':')$PERL5LIB # Locate Flux module directory and set PDLLIB -export PDLLIB=$(find "$CONDA_PREFIX" -type d -name "Flux" | grep "/share/dist/" | head -n 1):$PDLLIB +export PDLLIB=$(find "$CONDA_PREFIX" -type d -name "Flux" 2>/dev/null | grep "/share/dist/" | awk 'NR==1'):$PDLLIB # Create the environment variable setup script cat > "$CONDA_PREFIX/etc/conda/activate.d/env_vars.sh" < Date: Thu, 20 Mar 2025 17:03:57 -0600 Subject: [PATCH 08/22] fixes typos --- doc/install-macos.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/install-macos.md b/doc/install-macos.md index 7c78816..2d2fcfa 100644 --- a/doc/install-macos.md +++ b/doc/install-macos.md @@ -1,10 +1,10 @@ -# Macos Installation Instructions +# macOS Installation Instructions -These instructions were created by adapting the linux conda install to macos. Please let us know if anything breaks! +These instructions were created by adapting the linux conda install to macOS. Please let us know if anything breaks! Extra troubleshooting steps are listed at the bottom. ## 1. Get Conda Environment Manager -Depending on your mac's architechture, either get +Depending on your mac's architecture, either get ```sh curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh bash ~/Miniconda3-latest-MacOSX-arm64.sh From ba4e9a010adc6c9bd9d8a3eb33932a4af897b486 Mon Sep 17 00:00:00 2001 From: Chris Lowder Date: Thu, 20 Mar 2025 17:06:17 -0600 Subject: [PATCH 09/22] renames old macOS install notes --- doc/old/{install-macos-condaless.md => install-macos-brew.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/old/{install-macos-condaless.md => install-macos-brew.md} (100%) diff --git a/doc/old/install-macos-condaless.md b/doc/old/install-macos-brew.md similarity index 100% rename from doc/old/install-macos-condaless.md rename to doc/old/install-macos-brew.md From f2300dbdc38a6a47248b15f97e565a237633bddc Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Tue, 25 Mar 2025 15:42:32 -0600 Subject: [PATCH 10/22] fix set_paths logic to incorporate the FL/PL Prefixes for conda --- doc/set_paths.sh | 57 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/doc/set_paths.sh b/doc/set_paths.sh index 31b555d..c457604 100644 --- a/doc/set_paths.sh +++ b/doc/set_paths.sh @@ -14,7 +14,8 @@ perldlrc="$HOME/.perldlrc" # Check if the required content is already in the ~/.perldlrc file if [ -e "$perldlrc" ]; then - if grep -Fxq "$required_content" "$perldlrc"; then + file_content=$(cat "$perldlrc") + if [[ "$file_content" == *"$required_content"* ]]; then echo "Content already exists in ~/.perldlrc" else echo "$required_content" >> "$perldlrc" @@ -25,33 +26,69 @@ else echo "Created ~/.perldlrc and added required content" fi +if [ -z "$CONDA_PREFIX" ]; then + echo "Error: \$CONDA_PREFIX is not set" >&2 + return 1 +fi + # Create activate.d directory if it doesn't exist mkdir -p "$CONDA_PREFIX/etc/conda/activate.d" # Locate Flux.pm and set PERL5LIB -export PERL5LIB=$(find "$CONDA_PREFIX" -name Flux.pm -exec dirname {} \; | tr '\n' ':')$PERL5LIB +export PERL5LIB_new=$(find "$CONDA_PREFIX" -name Flux.pm -exec dirname {} \; | tr '\n' ":") +echo Found perl5lib $PERL5LIB_new # Locate Flux module directory and set PDLLIB -export PDLLIB=$(find "$CONDA_PREFIX" -type d -name "Flux" 2>/dev/null | grep "/share/dist/" | awk 'NR==1'):$PDLLIB +export PDLLIB_new=+$(find "$CONDA_PREFIX" -type d -name "Flux" 2>/dev/null | grep "/share/dist/" | awk 'NR==1') +echo Found pdllib $PDLLIB_new -# Create the environment variable setup script +# Create the environment variable setup script (activation script) cat > "$CONDA_PREFIX/etc/conda/activate.d/env_vars.sh" < "$CONDA_PREFIX/etc/conda/deactivate.d/env_vars.sh" <<'EOL' +#!/bin/bash + +# Deactivation script for restoring original environment variables + + unset PERL5LIB + unset PDLLIB + unset PL_PREFIX + unset FL_PREFIX + +# Inform the user +echo "Deactivation: Environment variables have been unset." +EOL + +# Make the deactivation script executable +chmod +x "$CONDA_PREFIX/etc/conda/deactivate.d/env_vars.sh" + # Confirmation message -echo "Activation script created successfully. Environment variables will be set upon activating the conda environment." -conda activate fluxenv +echo "Activation and deactivation scripts created successfully. Environment variables will be managed upon conda activation/deactivation." From 581488053de5396ab73854595425748bccad90a9 Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Tue, 25 Mar 2025 17:59:57 -0600 Subject: [PATCH 11/22] upgrade condaFlux installation instructions and makefile --- Makefile | 18 +++++- doc/install-macos.md | 60 +++++++------------ .../set_condaFlux_paths.sh | 42 +++++++++---- lib/test_condaFlux.sh | 14 +++++ lib/uninstall_condaflux.sh | 36 +++++++++++ 5 files changed, 118 insertions(+), 52 deletions(-) rename doc/set_paths.sh => lib/set_condaFlux_paths.sh (67%) create mode 100755 lib/test_condaFlux.sh create mode 100755 lib/uninstall_condaflux.sh diff --git a/Makefile b/Makefile index 2f2eadd..5d191ce 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,19 @@ FL_PREFIX ?= /usr/local export FL_PREFIX + +condaflux: uninstall realclean condaenv everything condaenv condatest + +condatest: + @/bin/sh -c 'cd lib; source test_condaFlux.sh'; + +condaenv: + @/bin/sh -c 'cd lib; source set_condaFlux_paths.sh'; + +uninstallconda: uninstall + @/bin/sh -c 'cd lib; source uninstall_condaflux.sh'; + + everything: libbuild install install: libinstall pdlbuild pdltest pdlinstall @@ -45,6 +58,7 @@ realclean: clean uninstall: @echo "\nUninstalling FLUX..."; - @-rm -rf $(FL_PREFIX)/lib/libflux.a || true; - @-rm -rf $(FL_PREFIX)/include/flux || true; + @rm -rf $(FL_PREFIX)/lib/libflux.a + @rm -rf $(FL_PREFIX)/include/flux @echo "\tFlux uninstall complete.\n"; + diff --git a/doc/install-macos.md b/doc/install-macos.md index 2d2fcfa..5d90ce6 100644 --- a/doc/install-macos.md +++ b/doc/install-macos.md @@ -27,7 +27,7 @@ Follow the prompts: ```sh conda create -n fluxenv conda activate fluxenv -conda install -c conda-forge c-compiler gsl perl perl-app-cpanminus perl-extutils-makemaker make cmake automake autoconf libtool m4 patch libxcrypt gnuplot cairo pango qt pfsspy sqlite +conda install -c conda-forge c-compiler gsl perl perl-app-cpanminus perl-extutils-makemaker make cmake automake autoconf libtool m4 patch libxcrypt gnuplot cairo pango qt pfsspy sqlite rich timeout-decorator ``` Confirm installation by typing `y` when prompted. @@ -38,15 +38,13 @@ Confirm installation by typing `y` when prompted. cpanm Alien::Build::Plugin::Gather::Dino Capture::Tiny Chart::Gnuplot Config::IniFiles Devel::CheckLib File::HomeDir File::Map File::ShareDir File::ShareDir::Install File::Which Inline Inline::C Inline::Python List::MoreUtils Math::GSL Math::GSL::Alien Math::Interpolate Math::Interpolator Math::RungeKutta Moo::Role Net::SSLeay PDL PDL::GSL PDL::GSL::INTEG PDL::Graphics::Gnuplot PDL::Graphics::Simple Parallel::ForkManager Term::ReadKey Test::Builder Text::CSV local::lib ``` -If the system struggles with `File::Map`, try: +If the system struggles with `File`, try: ```sh export LDFLAGS="" export CFLAGS="-O2" export PERL_LDFLAGS="" export PERL_CFLAGS="-O2" -export LD=x86_64-conda-linux-gnu-gcc -export CC=x86_64-conda-linux-gnu-gcc ``` If `Inline::C` isn’t found, run: @@ -57,42 +55,12 @@ cpanm Inline::C ## 4. Get FLUX -Set the prefixes for a conda installation: - -```sh -export PL_PREFIX="$CONDA_PREFIX/lib/perl5/site_perl" -export FL_PREFIX="$CONDA_PREFIX" -mkdir -p "$FL_PREFIX" -``` - Clone and configure Flux: ```sh git clone https://github.com/lowderchris/fluxon-mhd.git cd fluxon-mhd -make everything -``` - -If Flux.pm isn't found at the end of the install, try: - -```sh -export PERL5LIB=$(dirname $(find $CONDA_PREFIX -name Flux.pm)):$PERL5LIB -make everything -``` -To set up the necessary environment variables and update the appropriate configuration files, please download or navigate to the provided script located at [fluxon-mhd/doc/set_paths.sh](https://github.com/lowderchris/fluxon-mhd/blob/documentation/doc/set_paths.sh). Run the script, which will automatically add the Perl autoloader and Flux installation paths to your conda environment configuration files. - -```sh -# Download the script -wget https://github.com/lowderchris/fluxon-mhd/raw/documentation/doc/set_paths.sh - -# Run the script -bash set_paths.sh -``` - -Confirm installation success: - -```sh -perl -e "use Flux;" +make condaflux ``` ## 5. Get Fluxpype Wrapper (To run FLUX with) @@ -101,7 +69,6 @@ perl -e "use Flux;" cd .. git clone https://github.com/GillySpace27/fluxpype.git cd fluxpype -git checkout pythonify pip install -e . ``` @@ -161,4 +128,23 @@ python fluxpype/config_runner.py - if the error is: Can't locate Alien/Gnuplot.pm in @INC - ```cpanm Alien::Gnuplot``` -- if fluxpype cannot find the run file, check the paths at the top of ```config.ini``` to make sure that the path is correct. \ No newline at end of file +- if fluxpype cannot find the run file, check the paths at the top of ```config.ini``` to make sure that the path is correct. + +- If Flux.pm isn't found at the end of the flux install, try: + +```sh +export PERL5LIB=$(dirname $(find $CONDA_PREFIX -name Flux.pm)):$PERL5LIB +make everything +``` + +- To manually set the prefixes for a conda installation before using the makefile: + +```sh +export PL_PREFIX="$CONDA_PREFIX/lib/perl5/site_perl" +export FL_PREFIX="$CONDA_PREFIX" +``` +- To confirm installation success: + +```sh +perl -e "use Flux;" +``` diff --git a/doc/set_paths.sh b/lib/set_condaFlux_paths.sh similarity index 67% rename from doc/set_paths.sh rename to lib/set_condaFlux_paths.sh index c457604..7a8c691 100644 --- a/doc/set_paths.sh +++ b/lib/set_condaFlux_paths.sh @@ -1,5 +1,11 @@ #!/bin/bash +# Source conda's initialization script to enable conda commands. +source "$(conda info --base)/etc/profile.d/conda.sh" + +# Activate the conda environment 'fluxenv' +conda activate fluxenv + # Required content for the ~/.perldlrc file required_content=$(cat <<'EOF' require(q|PDL/default.perldlrc|); @@ -35,36 +41,45 @@ fi mkdir -p "$CONDA_PREFIX/etc/conda/activate.d" # Locate Flux.pm and set PERL5LIB -export PERL5LIB_new=$(find "$CONDA_PREFIX" -name Flux.pm -exec dirname {} \; | tr '\n' ":") +export PERL5LIB_new=$(find "$CONDA_PREFIX" -name Flux.pm -exec dirname {} \; | head -n 1) echo Found perl5lib $PERL5LIB_new # Locate Flux module directory and set PDLLIB export PDLLIB_new=+$(find "$CONDA_PREFIX" -type d -name "Flux" 2>/dev/null | grep "/share/dist/" | awk 'NR==1') echo Found pdllib $PDLLIB_new +# Set the prefixes for the conda environment +export PL_PREFIX_new="$CONDA_PREFIX/lib/perl5/site_perl" +export FL_PREFIX_new="$CONDA_PREFIX" + + # Create the environment variable setup script (activation script) cat > "$CONDA_PREFIX/etc/conda/activate.d/env_vars.sh" </dev/null | grep "/share/dist/" | awk 'NR==1') +# echo "Found PDLLIB: \$PDLLIB" # Set the FLUX prefixes for future recompiling -export PL_PREFIX="$CONDA_PREFIX/lib/perl5/site_perl" -export FL_PREFIX="$CONDA_PREFIX" +export PL_PREFIX="\$CONDA_PREFIX/lib/perl5/site_perl" +export FL_PREFIX="\$CONDA_PREFIX" # Print the environment variables for verification -echo "PERL5LIB is set to: $PERL5LIB_new" -echo "PDLLIB is set to: $PDLLIB_new" -echo "FL_PREFIX is set to: $FL_PREFIX" -echo "PL_PREFIX is set to: $PL_PREFIX" +echo "PERL5LIB is set to: \$PERL5LIB" +echo "PDLLIB is set to: \$PDLLIB" +echo "FL_PREFIX is set to: \$FL_PREFIX" +echo "PL_PREFIX is set to: \$PL_PREFIX" EOL unset PDLLIB_new unset PERL5LIB_new +unset FL_PREFIX_new +unset PL_PREFIX_new # Make the activation script executable chmod +x "$CONDA_PREFIX/etc/conda/activate.d/env_vars.sh" @@ -84,11 +99,12 @@ cat > "$CONDA_PREFIX/etc/conda/deactivate.d/env_vars.sh" <<'EOL' unset FL_PREFIX # Inform the user -echo "Deactivation: Environment variables have been unset." +echo "Deactivation: Environment variables have been unset. \n" EOL # Make the deactivation script executable chmod +x "$CONDA_PREFIX/etc/conda/deactivate.d/env_vars.sh" + # Confirmation message -echo "Activation and deactivation scripts created successfully. Environment variables will be managed upon conda activation/deactivation." +echo "Activation and deactivation scripts created successfully. Environment variables will be managed upon conda activation/deactivation. \n" diff --git a/lib/test_condaFlux.sh b/lib/test_condaFlux.sh new file mode 100755 index 0000000..20c2baa --- /dev/null +++ b/lib/test_condaFlux.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Source conda's initialization script to enable conda commands. +source "$(conda info --base)/etc/profile.d/conda.sh" + +# Activate the conda environment 'fluxenv' +conda activate fluxenv + +# Test if Flux is installed by trying to load it with Perl. +if perl -e "use Flux;" ; then + echo "\nFlux is installed and working!\n" +else + echo "\nConda is NOT installed!\n" +fi \ No newline at end of file diff --git a/lib/uninstall_condaflux.sh b/lib/uninstall_condaflux.sh new file mode 100755 index 0000000..1f89c06 --- /dev/null +++ b/lib/uninstall_condaflux.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +echo "Uninstalling condaFLUX..." +# Source conda's initialization script to enable conda commands. +source "$(conda info --base)/etc/profile.d/conda.sh" + +# Activate the conda environment 'fluxenv' +conda activate fluxenv + +# Remove specific FLUX files and directories. +rm -rf "${FL_PREFIX}/lib/libflux.a" +rm -rf "${FL_PREFIX}/include/flux" + +# Remove the first directory in PDLLIB if it contains "flux". +d_pdllib=$(echo "$PDLLIB" | awk -F: '{print $1}') +if echo "$d_pdllib" | grep -qi flux; then + echo "Deleting $d_pdllib" + rm -rf "$d_pdllib" +else + echo "Skipping deletion of PDLLIB directory: $d_pdllib (does not contain 'flux')" +fi + +# Remove the first directory in PERL5LIB if it contains "flux". +d_perl5lib=$(echo "$PERL5LIB" | awk -F: '{print $1}') +if echo "$d_perl5lib" | grep -qi flux; then + rm -rf "$d_perl5lib" +else + echo "Skipping deletion of PERL5LIB directory: $d_perl5lib (does not contain 'flux')" +fi + +# Run test_conda.sh from the lib directory if it exists. +if [ -d "lib" ]; then + (cd lib && source test_conda.sh) +fi +conda activate fluxenv +echo "condaFlux uninstall complete. \n" \ No newline at end of file From 8c0173248225b8c7bd69b6d307470ef294468246 Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Tue, 25 Mar 2025 18:12:48 -0600 Subject: [PATCH 12/22] update the linux install script with lessons learned from mac --- doc/install-linux.md | 54 ++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 34 deletions(-) diff --git a/doc/install-linux.md b/doc/install-linux.md index 757c936..7fd089a 100644 --- a/doc/install-linux.md +++ b/doc/install-linux.md @@ -49,51 +49,19 @@ cpanm Inline::C ## 4. Get FLUX -Set the prefixes for a conda installation: - -```sh -export PL_PREFIX="$CONDA_PREFIX/lib/perl5/site_perl" -export FL_PREFIX="$CONDA_PREFIX" -mkdir -p "$FL_PREFIX" -``` - -Clone and configure Flux: +Clone and install Flux: ```sh git clone https://github.com/lowderchris/fluxon-mhd.git cd fluxon-mhd -make everything +make condaflux ``` - -If Flux.pm isn't found at the end of the install, try: - -```sh -export PERL5LIB=$(dirname $(find $CONDA_PREFIX -name Flux.pm)):$PERL5LIB -make everything -``` -To set up the necessary environment variables and update the appropriate configuration files, please download or navigate to the provided script located at [fluxon-mhd/doc/set_paths.sh](https://github.com/lowderchris/fluxon-mhd/blob/documentation/doc/set_paths.sh). Run the script, which will automatically add the Perl autoloader and Flux installation paths to your conda environment configuration files. - -```sh -# Download the script -wget https://github.com/lowderchris/fluxon-mhd/raw/documentation/doc/set_paths.sh - -# Run the script -bash set_paths.sh -``` - -Confirm installation success: - -```sh -perl -e "use Flux;" -``` - ## 5. Get Fluxpype Wrapper (To run FLUX with) ```sh cd .. git clone https://github.com/GillySpace27/fluxpype.git cd fluxpype -git checkout pythonify pip install -e . ``` @@ -128,3 +96,21 @@ python fluxpype/config_runner.py - ```conda install gsl``` - ```cpanm --notest PDL::GSL``` +- If Flux.pm isn't found at the end of the flux install, try: + +```sh +export PERL5LIB=$(dirname $(find $CONDA_PREFIX -name Flux.pm)):$PERL5LIB +make everything +``` + +- To manually set the prefixes for a conda installation before using the makefile: + +```sh +export PL_PREFIX="$CONDA_PREFIX/lib/perl5/site_perl" +export FL_PREFIX="$CONDA_PREFIX" +``` +- To confirm installation success: + +```sh +perl -e "use Flux;" +``` \ No newline at end of file From a963c2031fa6adf06e0c3b08ba842af663af30db Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Wed, 26 Mar 2025 11:57:01 -0600 Subject: [PATCH 13/22] fix typo --- doc/install-linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/install-linux.md b/doc/install-linux.md index 7fd089a..2d3a689 100644 --- a/doc/install-linux.md +++ b/doc/install-linux.md @@ -41,7 +41,7 @@ export LD=x86_64-conda-linux-gnu-gcc export CC=x86_64-conda-linux-gnu-gcc ``` -If `Inline::C` isn’t found, run: +If `Inline::C` isn't found, run: ```sh cpanm Inline::C From 340646954b5ec02c984ab1dcf7f390f1a88ca011 Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Wed, 26 Mar 2025 11:57:15 -0600 Subject: [PATCH 14/22] add macos compiler workaround --- doc/install-macos.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/install-macos.md b/doc/install-macos.md index 5d90ce6..c109a25 100644 --- a/doc/install-macos.md +++ b/doc/install-macos.md @@ -45,6 +45,8 @@ export LDFLAGS="" export CFLAGS="-O2" export PERL_LDFLAGS="" export PERL_CFLAGS="-O2" +export LD=clang +export CC=clang ``` If `Inline::C` isn’t found, run: From a683d043ad93a584fe5757dd58adb56e4429fda2 Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Wed, 26 Mar 2025 11:58:53 -0600 Subject: [PATCH 15/22] christen condaFlux --- lib/test_condaFlux.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/test_condaFlux.sh b/lib/test_condaFlux.sh index 20c2baa..4869a39 100755 --- a/lib/test_condaFlux.sh +++ b/lib/test_condaFlux.sh @@ -8,7 +8,7 @@ conda activate fluxenv # Test if Flux is installed by trying to load it with Perl. if perl -e "use Flux;" ; then - echo "\nFlux is installed and working!\n" + echo "\nCondaFlux is installed and working!\n" else - echo "\nConda is NOT installed!\n" + echo "\nCondaFlux is NOT installed!\n" fi \ No newline at end of file From 93215b07def58b00bd644504557c079bc97029cf Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Wed, 26 Mar 2025 12:30:55 -0600 Subject: [PATCH 16/22] remove vestigial code --- lib/set_condaFlux_paths.sh | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/lib/set_condaFlux_paths.sh b/lib/set_condaFlux_paths.sh index 7a8c691..1a43d99 100644 --- a/lib/set_condaFlux_paths.sh +++ b/lib/set_condaFlux_paths.sh @@ -40,19 +40,6 @@ fi # Create activate.d directory if it doesn't exist mkdir -p "$CONDA_PREFIX/etc/conda/activate.d" -# Locate Flux.pm and set PERL5LIB -export PERL5LIB_new=$(find "$CONDA_PREFIX" -name Flux.pm -exec dirname {} \; | head -n 1) -echo Found perl5lib $PERL5LIB_new - -# Locate Flux module directory and set PDLLIB -export PDLLIB_new=+$(find "$CONDA_PREFIX" -type d -name "Flux" 2>/dev/null | grep "/share/dist/" | awk 'NR==1') -echo Found pdllib $PDLLIB_new - -# Set the prefixes for the conda environment -export PL_PREFIX_new="$CONDA_PREFIX/lib/perl5/site_perl" -export FL_PREFIX_new="$CONDA_PREFIX" - - # Create the environment variable setup script (activation script) cat > "$CONDA_PREFIX/etc/conda/activate.d/env_vars.sh" < Date: Wed, 26 Mar 2025 12:31:14 -0600 Subject: [PATCH 17/22] ensure environment before reporting success --- lib/test_condaFlux.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/test_condaFlux.sh b/lib/test_condaFlux.sh index 4869a39..e249119 100755 --- a/lib/test_condaFlux.sh +++ b/lib/test_condaFlux.sh @@ -1,14 +1,15 @@ #!/bin/bash -# Source conda's initialization script to enable conda commands. -source "$(conda info --base)/etc/profile.d/conda.sh" - -# Activate the conda environment 'fluxenv' -conda activate fluxenv - # Test if Flux is installed by trying to load it with Perl. if perl -e "use Flux;" ; then echo "\nCondaFlux is installed and working!\n" else echo "\nCondaFlux is NOT installed!\n" +fi + +# Abort if the correct conda environment isn't active +if [[ "$CONDA_PREFIX" != "$FL_PREFIX" ]]; then + echo "Error: This script must be run from within the 'fluxenv' conda environment." >&2 + echo " Run 'conda activate fluxenv' and try again.\n" >&2 + exit 1 fi \ No newline at end of file From 2434eae34c91fefe7cde547e713d3b9b11074f0a Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Wed, 26 Mar 2025 13:06:25 -0600 Subject: [PATCH 18/22] reorder and move commands and files --- Makefile | 27 +++++++++++++++------------ lib/uninstall_condaflux.sh | 8 ++++---- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 5d191ce..0b110fa 100644 --- a/Makefile +++ b/Makefile @@ -7,18 +7,7 @@ FL_PREFIX ?= /usr/local export FL_PREFIX - -condaflux: uninstall realclean condaenv everything condaenv condatest - -condatest: - @/bin/sh -c 'cd lib; source test_condaFlux.sh'; - -condaenv: - @/bin/sh -c 'cd lib; source set_condaFlux_paths.sh'; - -uninstallconda: uninstall - @/bin/sh -c 'cd lib; source uninstall_condaflux.sh'; - +.PHONY: everything install libbuild libinstall pdlMakefile pdlbuild pdltest pdlinstall clean realclean uninstall condainstall condacompile condatest condaenv condauninstall everything: libbuild install @@ -62,3 +51,17 @@ uninstall: @rm -rf $(FL_PREFIX)/include/flux @echo "\tFlux uninstall complete.\n"; +# ------------ CONDA INSTALLATION ------------ # + +condainstall: condauninstall condaenv condacompile + +condacompile: everything condaenv condatest + +condatest: + @/bin/sh -c 'cd lib; source test_condaFlux.sh'; + +condaenv: + @/bin/sh -c 'cd lib; source set_condaFlux_paths.sh'; + +condauninstall: uninstall realclean + @/bin/sh -c 'cd lib; source uninstall_condaflux.sh' diff --git a/lib/uninstall_condaflux.sh b/lib/uninstall_condaflux.sh index 1f89c06..0b8f991 100755 --- a/lib/uninstall_condaflux.sh +++ b/lib/uninstall_condaflux.sh @@ -29,8 +29,8 @@ else fi # Run test_conda.sh from the lib directory if it exists. -if [ -d "lib" ]; then - (cd lib && source test_conda.sh) +if [ -e "test_condaFlux.sh" ]; then + (source test_condaFlux.sh) fi -conda activate fluxenv -echo "condaFlux uninstall complete. \n" \ No newline at end of file + +echo "\ncondaFlux uninstall complete. \n" \ No newline at end of file From 7ba35831b5eb09de06c2fc1d88d3fdb59e74e74d Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Wed, 26 Mar 2025 13:27:58 -0600 Subject: [PATCH 19/22] clarify a troubleshooting task --- doc/install-macos.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/install-macos.md b/doc/install-macos.md index c109a25..780c026 100644 --- a/doc/install-macos.md +++ b/doc/install-macos.md @@ -89,7 +89,7 @@ nano fluxpype/config.ini Set the code to do your desired run using the documentation (TBD) -Run the configuration run script: +Execute the configuration run script: ```sh python fluxpype/config_runner.py @@ -115,17 +115,15 @@ python fluxpype/config_runner.py - ```conda install gsl``` - ```cpanm --notest PDL::GSL``` - - if the wrong cpanm is getting in the way, delete it using the wrong path as follows - ```export PATH=$(echo "$PATH" | sed 's|/Users/cgilbert/perl5/perlbrew/bin:||')``` - then try to use the huge cpanm installation command above - then run the set_paths.sh file - activate the environment - - make everything + - make condainstall -- if the paths seem completely wrong, try these in the fluxon-mhd directory - - ```make uninstall``` - - ```make clean``` +- if the paths seem completely wrong, try this in the fluxon-mhd directory + - ```make condainstall``` - if the error is: Can't locate Alien/Gnuplot.pm in @INC - ```cpanm Alien::Gnuplot``` From 4059f52d17d2b550c23654379dc6f9c7c79ee2ea Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Wed, 26 Mar 2025 13:28:31 -0600 Subject: [PATCH 20/22] reorder printing of env vars --- lib/set_condaFlux_paths.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/set_condaFlux_paths.sh b/lib/set_condaFlux_paths.sh index 1a43d99..54f6af3 100644 --- a/lib/set_condaFlux_paths.sh +++ b/lib/set_condaFlux_paths.sh @@ -57,10 +57,10 @@ export PL_PREFIX="\$CONDA_PREFIX/lib/perl5/site_perl" export FL_PREFIX="\$CONDA_PREFIX" # Print the environment variables for verification -echo "PERL5LIB is set to: \$PERL5LIB" -echo "PDLLIB is set to: \$PDLLIB" echo "FL_PREFIX is set to: \$FL_PREFIX" echo "PL_PREFIX is set to: \$PL_PREFIX" +echo "PERL5LIB is set to: \$PERL5LIB" +echo "PDLLIB is set to: \$PDLLIB" EOL # Make the activation script executable From 13ab85faad943ad4d9f7a7527bd09c59afadaf71 Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Wed, 26 Mar 2025 13:32:51 -0600 Subject: [PATCH 21/22] linting --- lib/set_condaFlux_paths.sh | 2 +- lib/uninstall_condaflux.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/set_condaFlux_paths.sh b/lib/set_condaFlux_paths.sh index 54f6af3..7d1d400 100644 --- a/lib/set_condaFlux_paths.sh +++ b/lib/set_condaFlux_paths.sh @@ -60,7 +60,7 @@ export FL_PREFIX="\$CONDA_PREFIX" echo "FL_PREFIX is set to: \$FL_PREFIX" echo "PL_PREFIX is set to: \$PL_PREFIX" echo "PERL5LIB is set to: \$PERL5LIB" -echo "PDLLIB is set to: \$PDLLIB" +echo "PDLLIB is set to: \$PDLLIB" \n EOL # Make the activation script executable diff --git a/lib/uninstall_condaflux.sh b/lib/uninstall_condaflux.sh index 0b8f991..3d63e1f 100755 --- a/lib/uninstall_condaflux.sh +++ b/lib/uninstall_condaflux.sh @@ -25,7 +25,7 @@ d_perl5lib=$(echo "$PERL5LIB" | awk -F: '{print $1}') if echo "$d_perl5lib" | grep -qi flux; then rm -rf "$d_perl5lib" else - echo "Skipping deletion of PERL5LIB directory: $d_perl5lib (does not contain 'flux')" + echo "Skipping deletion of PERL5LIB directory: $d_perl5lib (does not contain 'flux')\n" fi # Run test_conda.sh from the lib directory if it exists. From 8941aaae4c52df2264ad165ff523a7e55117d130 Mon Sep 17 00:00:00 2001 From: gillyspace27 Date: Wed, 26 Mar 2025 13:33:24 -0600 Subject: [PATCH 22/22] mirrored the install command --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0b110fa..297bf2c 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ FL_PREFIX ?= /usr/local export FL_PREFIX -.PHONY: everything install libbuild libinstall pdlMakefile pdlbuild pdltest pdlinstall clean realclean uninstall condainstall condacompile condatest condaenv condauninstall +.PHONY: everything install libbuild libinstall pdlMakefile pdlbuild pdltest pdlinstall clean realclean uninstall condaflux condainstall condacompile condatest condaenv condauninstall everything: libbuild install @@ -53,6 +53,8 @@ uninstall: # ------------ CONDA INSTALLATION ------------ # +condaflux: condainstall + condainstall: condauninstall condaenv condacompile condacompile: everything condaenv condatest