serverless-python-requirements icon indicating copy to clipboard operation
serverless-python-requirements copied to clipboard

WSL Unknown path format

Open davegravy opened this issue 6 years ago • 10 comments

On WSL Ubuntu 18.04LTS I'm getting

Unknown path format

when I use dockerizePip=true

in node_modules/serverless-python-requirements/lib/docker.js, getBindPath is being called with servicePath=="/home/davidg/lambda-serverless-test/.serverless/requirements"

That function seems to require the servicePath point to somewhere on my windows filesystem (/mnt/c/...) Is there no support for projects located in my wsl home directory?

FWIW I followed the README instructions regarding running under WSL and did step 1 and 2.

davegravy avatar Jun 13 '19 00:06 davegravy

I upgraded to WSL2 on the insider preview and get the same issue when running inside of a point not in /c/ (changed mount path). Flipping the !isWsl check in the bellow code (line 103-107) function getBindPath(serverless, servicePath) { // Determine bind path if (process.platform !== 'win32' && isWsl) { return servicePath; } Will allow the plugin to skip the getBindPath function from inside WSL, but it should be totally valid to run the serverless plugin completely inside of the WSL filesystem (even more so since in WSL2 there is a significant slowdown when accessing windows files as the linux is now its own filesystem now).

If I'm running inside WSL, but running my python code from inside the linux side of the filesystem and not the /c/ or /mnt/c/ mount the code checks that I have to have one of the following formats: /'drive_letter'/ /mnt/c/ c:/ but will then fail as I don't throwing the error. If you bypass this entire function when it doesn't find a path format though it will succeed and run.

BerserkerGaruk avatar Sep 13 '19 21:09 BerserkerGaruk

Having this same issue as well.

jnguyen32 avatar Feb 24 '20 19:02 jnguyen32

This became an issue starting in 5.x, 4.3.0 works well.

blbradley avatar Mar 17 '20 22:03 blbradley

any solutions ?

Using WSL2 with Docker-Desktop

  Error: Unknown path format owleaf/.cache/serverless-python-requirements/2eebda49882e665cca2bf1e3a571b1c2f6ec0d2bac04ecf76484eb7dce7fd498_slspyc...
      at getBindPath (/mnt/d/Courses/TSAI-DeepVision-EVA4.0-Phase-2/01-Deploy-To-AWS/sls-flask-ml-test/node_modules/serverless-python-requirements/lib/docker.js:132:11)
 Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              14.5.0
     Framework Version:         1.74.1
     Plugin Version:            3.6.15
     SDK Version:               2.3.1
     Components Version:        2.31.12

satyajitghana avatar Jul 13 '20 00:07 satyajitghana

I had the same issue. After debugging a bit in node_modules/serverless-python-requirements/lib/docker.js I found that the correct path was being passed into the getBindPath function. However there is an if statement at the top

// Determine bind path
  if (process.platform !== 'win32' && !isWsl) {
    return servicePath;
  }

For me

  • process.platform = linux
  • isWsl = true

So it does NOT immediately return servicePath; but continues on to some code that falls over. To get it to work for me locally I put return servicePath; at the top of the function and it worked.

I am guessing this was added for the original WSL on windows and hasn't been updated for WSL2.

tyjenkins avatar Aug 04 '20 15:08 tyjenkins

Any update or fix for this bug?

juanmarin96 avatar Feb 09 '21 18:02 juanmarin96

I am also looking for an update or fix as this is still occurring...

eddylit avatar Aug 31 '21 04:08 eddylit

How is it not fixed yet ? WSL 2 has been out for a while now...

wbraik avatar Sep 18 '21 20:09 wbraik

Thanks so much @tyjenkins your solution worked for me.

ECallihan avatar Oct 22 '21 02:10 ECallihan