Sunday, March 31, 2024

Pip Install OS Error Python package installation System Does not have Windows Long Path Support Enabled

 I have been trying to install the Transformer to work on deep learning project. I used the command, which I used many times before and it works perfectly.

But this time, I got the error Could not install packages due to an OSError: [WinError 2] The system cannot find the file specified

pip install transformers --users


 

ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: ‘C:\\Users\\me\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python312\\site-packages\\transformers\\models\\deprecated\\trajectory_transformer\\convert_trajectory_transformer_original_pytorch_checkpoint_to_pytorch.py’
HINT: This error might have occurred since this system does not have Windows Long Path support enabled. You can find information on how to enable this at https://pip.pypa.io/warnings/enable-long-paths

In order to fix the OSError, we need to make Windows 10 Accept File Paths Over 260 Characters.

So here the steps to follow in order to fix the error and be able to install the transformers package.

Step 1: Open Registry Editor

To do so, use the “Windows + R” and write “regedit”

Open Registry Editor with Shortcut Windows R

Another option is to search for Registry Editor

Step 2:

In the registry editor, use the left sidebar and navigate to “CurrentControlSet\Control\FileSystem”

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem

Step 3:

On the right, find a value named “LongPathEnabled” and double-click it. If you don't see the value listed, you'll need to create it by right-clicking the “FileSystem” key, choosing New > DWORD (32-bit) Value, and then naming the new value “LongPathEnabled”.

Change the value from 0 to 1 and save your changes.

You can now close the registry and restart the computer. For my side, I just restarted my Visual Studio and was able to install successfully the transformer.

🎉Perfect, hope this helps you also and don’t forget to:

  • Like the post 👏
  • Follow me for more Tips

No comments :

Post a Comment

Articles les plus consultés