Windows Long Path Error With Pure-Python Extension

Hi KNIMErs!

I built a pure-Python Extension with KAP 5.1 on Windows. When KAP attempts to create the conda environment upon its installation, it fails, however, with the following error: OS Error 2: No such file or directory.

Thankfully, the error message also contains a hint saying that Windows Long Path support is probably deactivated on my device, which is the case. After further investigation, I discovered that some of the automatically generated file paths during the installation contain indeed more characters than the Windows API’s default path length permits (260 chars).

So far, I have come up with two possible solutions to this, but would still like to pick the community’s brains in case there are more:

  1. Since I can neither influence KAP’s inner workings (and its sometimes long file/folder names) nor the guilty Python library’s deeply nested folder structure, my quick fix was to move KAP itself as close to my drive’s root directory as possible.

  2. The error message itself recommended enabling Windows Long Path support in the Registry Editor as explained here: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry.

While option 1 solved my problem this time, it also has its obvious limits. Option 2 may be more permanent, but I am in a corporate setting, and the users of my extension are not allowed to meddle with the registry keys…

If anyone has encountered a similar issue before, I am curious to hear how you overcame it.

Cheers!

Hi Marco @DerMaxdorfer,

I am sorry for the troubles!

Yes, we are aware of this unfortunate situation, see our troubleshoot section in the Python extension guide: KNIME Python Integration Guide

Let’s make @nemad aware of this, I am also not sure whether we can make the folder/file names within KAP shorter from our side.

Best regards
Steffen

2 Likes

Yes, there might be ways to shorten the paths somewhat and I bumped up the priority of the corresponding ticket.
Unfortunately, this remedy has the same limitations as your approach of moving the installation to a shorter prefix, namely that a Python package may contain arbitrarily long paths.
That being said, combining a shorter prefix with shorter paths in the KNIME installation should fix the issue in many cases.

4 Likes

You are absolutely right that this is not entirely in your hands. Thank you both for trying to make this edge case even more unlikely in the future!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.