However, other commands, which can be executed w/o issues directly in the terminal, like the following, cause an error to be thrown: “Execute failed: Cannot execute command”
nmap -v -F google.com
Does Knime has its own file which references executables? I checked the preferences but could not find anything, though.
I possibly posted this in the wrong forum section as I thought this is more a general question but it seems I was wrong. In search for a solution to instruct Knime respectively your bash Node to use the actual PATH pariable, I wonder if you could shed some light onto this?
Googling around to adjust the Eclipse Path variable I could not come to a solution (please see my prev. comment). Do you happen to have an idea?
I haven’t continue working on the awk issue but with the recently gained knowledge I might do that. Though, that project I worked on back then was closed (I switched employers). For the sake of interest – and to satisfy my German urge to do things right – I might come back to this in the future.
About the environment I printed the variables in a previous comment. When chekcing the env vars in terminal they differ from those available in Knime. Therefore, i suspect that Knime is using another configuration file.
However, I could not find anything. Even by declaring the PATH variable in the knime.ini it did not changed anything. The HOME and SHEEL Variables are identical, though. Therefore, I thought it’s using the same bash which I confirmed via
which bash true false
Setting the absolute directory for the command not found by first identifying the executable “/usr/local/bin” via (in terminal):
which nmap true false
Did not resolve the command not found issue.
Creating a .bash_profile and declaring the PATH variable, applying via source .bash_profile, didn’t resolve it either. I assume Eclipse / Knime is spun up in a separate user / config or so not utilizing the system nor my actual user configuration (to the full extend).
PS: I believe it is less related to your bash node but more to Knime in general. using a Java Snippet to retrieve the PATh variable I too get the same result.
out_path = System.getenv("PATH");
@ipazin you are always a great and knowledgeable source. Do you maybe have an idea?
Even the TMPDIR variable matches which I’d suspect getting randomly regenerated with each session. There is a higher level of alignment but for some reason if ignores or overwrites the PATH variable.
it appears that the $PATH declaration made by a user in either .bash_profile or .zshrc (the profile for zsh) has no effect on the PATH established by the Bash node.
for this reason, any executable residing outside of that path variable definition is not found.
for some reason, variables (which use the “$” character) are not recognized, so one is prevented from executing either a temporary addition to the path or a ‘permanent’ change to the profile
At this point, I’ve all but given up. My last effort will be to determine whether the conda environment that prevails when I try to use the Bash node might have some means of affecting the ability to temporarily (for the duration of the Bash node session) modify the $PATH variable.
This same issue appears in my attempts with Cmdwinput node and External Tool node. All of them put you in $PATH jail.
= RM
Just for completeness, I rebooted but it did not have any effect. I tried setting the PATH variable in Knime but it failed with Execute failed: Cannot execute command as well.
I think the only two options left at present are to:
Create a shell script, which could get done via Knime, and make it executable OR
With approach #2 I noticed a possible cause of the command not found. Using the Bash Node to get all env variables it gave back a PATH variable. However, using the Java Snipped the PATH variable was not found. Could it be that the PATH variable is not properly setup / defined and Knime respectively Eclipse falls back to a default?
I put all bits and pieces in this workflow together:
NOTE: There is a mistake with the Java Snippet which I noticed only after upload. Will update the workflow once resolved.
There are a few additional interesting findings as well. Using the whereis YOUR-CMD command to locate the executable the commands which do NOT work still could be found. The where YOUR-CMD (without “is”) command also works in the terminal but not in Knime.
Just for the record. Thanks to @carstenhaubold there is a Python based approach of executing bash commands.
Unfortunately, though, it has the same issue that some commands are not found. That pretty much makes it abundantly clear that the PATH variable difference between Knime / Eclipse and vs. user under which it runs is at fault.