Modify setup.js: In event WinOS error installing TF-modules provides user with detailed instructions on how to get their WinOS/nodejs dependencies installed correctly to facilitate installation of tfjs-node

This commit is contained in:
Philip Love committed 2021-09-01 00:58:51 -04:00
1 parent cca4066e4e
commit 0ef9969e55
2 files changed
+586 -211

No files matched your search

+30 -3
View File
@@ -2,6 +2,7 @@ const path = require("path");
const process = require("process");
const { exec } = require("child_process");
const systemCheck = require('./Launch-Scripts/system-check')
const platform = require('os').platform(); // Possible values are: 'aix', 'darwin', 'freebsd', 'linux', 'openbsd', 'sunos', and 'win32'.
// Check system is set up correctly
systemCheck();
@@ -33,11 +34,15 @@ let nodeModulesDirs = [
path.join( process.cwd(), "Projects", "Foundations", "TS", "Bot-Modules", "Trading-Bot", "Announcements"),
path.join( process.cwd(), "Projects", "Foundations", "TS", "Bot-Modules", "Trading-Bot", "Low-Frequency-Trading", "APIs"),
path.join( process.cwd(), "Projects", "Foundations", "TS", "Task-Modules"),
/* Aug-27-21 - TensorFlow dependency integration undergoing modifications. Should be resolved within a day or two:
path.join( process.cwd(), "Projects", "TensorFlow", "TS", "Bot-Modules", "Learning-Bot", "Low-Frequency-Learning")
*/
];
// Check if WinOS because extra dependencies may be required for tfjs:
var tfjsWinInstallFlag = false;
if (platform === 'win32') { // *Note: win32 == win32 || win64
tfjsWinInstallFlag = true;
}
console.log('');
console.log("Installing node dependencies at the following directories:");
console.log('');
@@ -57,9 +62,31 @@ for (let dir of nodeModulesDirs) {
console.log("There was an error installing some dependencies error: ");
console.log('');
console.log( error );
if (tfjsWinInstallFlag == true && dir == path.join(process.cwd(), "Projects", "TensorFlow", "TS", "Bot-Modules", "Learning-Bot", "Low-Frequency-Learning")) {
tfjsWinInstall();
}
return;
}
console.log('');
console.log( stdout );
});
};
};
/* If WinOS && error with tfjs installation:
* This is a well known and documented issue with @Tensorflow/tfjs-node installation on WinOS.
* npm's windows-build-tools via: `npm install --global --production windows-build-tools` &&
* `npm install -g node-gyp` can sometimes correct the issue but not always depending on the
* version and options the user defined when installing npm/nodejs.
* The best reliable way to correct that I (Pluvtech) have found to work on many versions of WinOS
* is to reinstall nodejs and select to install chocolatey during the installation configuration.
*/
function tfjsWinInstall() {
console.log("\n*** Note to Windows Users Regarding the Superalgos TensorFlow Project ***");
console.log("If you have no other errors with this setup script and do not wish to use the TensorFlow Project:\nThen all is successful with your Superalgos setup and you may proceed to use the software.");
console.log("\nIf you do wish to install the @Tensorflow/tfjs-node modules required for use with the Superalgos TensorFlow Project:");
console.log("In this case it is likely your system is missing some dependencies required to build the TensorFlow (tfjs-node) bindings and you will need to follow the below steps:");
console.log("\n1.) Reinstall node.js from https://nodejs.org/en/download/ @Version 14.17.5 or higher.\nDuring installation, when you arrive at the 'Tools for Native Modules' screen you need to select the box to:\n\t'Automatically install the necessary tools...Chocolatey...'");
console.log("Doing this will cause a pop-up script in a new window which will install many npm/node tools and dependencies for use within the WinOS ecosystem.");
console.log("2.) When the installations finally complete you need to navigate back to your Superalgos directory and run `node setup` again.\n");
}