I was trying to execute a sample workflow from python and I have mentioned path to my workspace and workflow but while executing knime.Workflow I get an error FileNotFoundError: No such file or directory. I could notice that there was no workflow.svg file in my workflow project.
How do I get this file. I have saved my workflow and executed in knime before doing so using python but I don’t have this file in my location.
What version of KNIME AP are you using? In older versions you needed to have the SVG extension installed so that workflow svg files would be saved with the workflow:
Make sure you have that extension installed, then open, edit (moving around a node should be enough) and save that workflow. Then it should work.
I have only 2 workflow created just to check how to execute in python and both don’t have .svg file. Also I don’t find the extension to install. Please find below.
@gab1one I have installed the extension but still I don’t see .svg file and I don’t know something is happening with my environment. When ever my server restarts I don’t see my workflows in my workspace. They disappear all of a sudden. Can you tell me what is happening.
while executing knime.Workflow I get an error FileNotFoundError: No such file or directory
I would expect this sort of error to arise when either the path to the workflow on disk is incorrect or the path to the KNIME executable is incorrect for your local system.
If you have not set the location of the KNIME executable yourself, the default value is not always the right setting for everyone. Stolen from the first example at GitHub - knime/knimepy :
# Change the executable_path to point at a particular KNIME install.
# May alternatively be set via OS Environment Variable, 'KNIME_EXEC'.
knime.executable_path = r"C:\Program Files\KNIME\knime.exe"
The rest of the error message should help you know whether it is the executable path or the workflow path that is the source of the problem. I thought I should share the above snippet about the executable path because it may help others who come along later and read this forum post.
The SVG file is only accessed through knimepy when either explicitly asked for or when a Jupyter notebook attempts to render a KNIME Workflow in the notebook. Because you described an error that occurs during execution of the workflow, I do not expect the existence/absence of a workflow.svg file to be relevant to the error you describe.
If you are convinced that you have both the executable path and the workflow path set correctly, I will need to see the complete trackback from Python to help further.
Thanks for your reply. I have not set the KNIME executable location myself but cross checked with the team and the location specified is indeed correct. Below is the my code and error traceback.
Further to the above regarding location, I have changed my workspace location and I ran a workflow within KNIME and workflow.svg is created but I get the same error while executing it in python. Attached screenshot for your reference.
Regarding the workflows missing when my server restarts, I have sorted it with my team. But kindly help me to execute the flows in python.
Thank you for sharing your code snippet and traceback – both are very helpful.
It appears you are triggering the latter – your traceback indicates that a call was made to _repr_svg_() which is reasonably explained by your line of code, knime.Workflow(workflow_path = workflow, workspace_path = workspace), being rendered for the screen. If you modify this line of your code snippet to instead store the Workflow in a variable, the attempt to render it with an SVG will be eliminated and the FileNotFoundError will no longer occur. That is, change that line of code to read:
The question remains: why did it not find the SVG file in that location? You mention moving the workflow on disk to a new location and now you find an SVG file is indeed appearing in the workflow’s new directory. I also notice that your Python code references locations that begin "/mnt/C/..." which suggests that you might be using Windows Subsystem for Linux (WSL) or possibly Cygwin on your Windows system at least when running your Python scripts. I wonder if there is any difficulty with resolving paths correctly on your system when bouncing between using WSL and the native OS – that is not WSL’s fault, per se, but is something that must be thoughtfully guarded against when using native programs and WSL-dependent programs together. As a diagnostic tool, you might try modifying this example code to verify that you indeed have the full paths to things exactly right for your system, starting with the path to the executable and then verify the paths to your workflows:
Keep in mind that the full path to the workflow may be provided as a single argument to the knime.Workflow class during instantiation. Separating into two arguments, workflow and workspace paths, is supported and fine but can sometimes cause unnecessary confusion.
Hi @potts I may need your help again though it may not be completely related. Still I have not found a way to access the location as mentioned earlier.
To give you a full context, I have 2 servers (aws linux and windows server). AWS linux server is used to install software like anaconda, python etc. Windows server is used to access applications (end user applications) like KNIME, google chrome etc.
Jupyter notebooks is running on linux server and I open it in chrome (using the ip on windows server). Now KNIME is installed in windows C:\Program Files\ and all my workflows will be saved in this server either C or D drive. I am trying to access these workflows from jupyter notebook. Tried several ways as below to access but in vain.
Thus far, we have only discussed how to execute KNIME locally (that is, your Jupyter notebook and KNIME itself must be on the same system). Since your Jupyter notebook is running on the Linux server but KNIME AP is only installed on your Windows server, you should investigate the capability of knimepy to launch remote workflows via the KNIME Server. This example in the README for knimepy shows how to run remote workflows on a KNIME Server: https://github.com/knime/knimepy#knime-server-example-execute-a-knime-workflow-on-a-remote-knime-server
It sounds like you have at least these two options:
Get a KNIME Server (unless your organization already has one?), put your workflows on the KNIME Server, and then you can run those workflows remotely as in the example.
Put your Jupyter notebook on the same system as the KNIME AP (Analytics Platform). This means either installing Anaconda (including Jupyter) on that Windows server or installing KNIME AP on that Linux server. Then you can run workflows locally (on the same system).
Ultimately, a Linux-based Jupyter notebook can run other Linux-based programs like KNIME AP installed on Linux or a Windows-based notebook can run the Windows version of KNIME AP but a program on Linux can not run something on a separate Windows system without help – that is where the KNIME Server comes in to help.
Thanks for sharing more about your setup – I hope these suggestions help,
Thanks for your reply. I will consider your suggestions.
But generally speaking, keeping knime aside, atleast python (jupyter notebooks) should be able to locate path of windows server right? Or am I talking something illogical because while working on Linux subsystem, windows location can be accessed by mount mnt. Same thing can be applied here if mounted right? Any thoughts on this?
The Windows Subsystem for Linux (WSL) runs on a Windows system (your Windows server in particular) and thus can access files from most anywhere on your Windows system through paths that sometimes begin "/mnt/C/...". Just to make sure there is no confusion: your use of WSL on your Windows server and access to files there should not be confused with your use of your distinct Linux server and its files there – as separate machines, the one will not see the files of the other (Windows server versus Linux server).
Having data files, Jupyter notebooks, KNIME workflows, and other tools or supporting files scattered across multiple servers is a very common situation. Figuring out how an organization wants to manage these resources is an important discussion that has real impact for all involved. Sometimes organizations choose to adopt the use of a KNIME Server to create a shared space for all team members to store and share the workflows they create. I do not know if this will help your team in particular but it might help solve coordination headaches in the future for you or someone else.
Thanks @potts. I will try to install KNIME in linux machine.
BTW how do I install knime with linux commands? I tried wget knime.com/download-installer/6/64bit but didn’t work it seems. I suspect that is not the download link.
The video available in youtube shows installation from a GUI. Is it possible to do with commands?