node-virtualenv icon indicating copy to clipboard operation
node-virtualenv copied to clipboard

Can't spawn child python process

Open viziblydiffrnt opened this issue 8 years ago • 5 comments

Hi,

I'm trying to follow your example but can't get the child process to spawn correctly. Here's my code:

var virtualenv = require("virtualenv"); var packagePath = require.resolve(__dirname + '/../../package.json'); var env = virtualenv(packagePath); var child = env.spawnPython(["../python/test.py"]);

and here's the error:

events.js:163 Uncaught Error: spawn /app/.node-virtualenv/bin/python ENOENT at exports._errnoException (util.js:1050) at Process.ChildProcess._handle.onexit (internal/child_process.js:193) at onErrorNT (internal/child_process.js:367) at _combinedTickCallback (internal/process/next_tick.js:80) at process._tickCallback (internal/process/next_tick.js:104)

Am I missing something obvious? My goal is to create a virtualenv when my app loads and then run all of my python code there so I don't have to worry about missing python modules. I'm running this on OS X with Python 2.7

Thanks

viziblydiffrnt avatar Sep 29 '17 17:09 viziblydiffrnt

@viziblydiffrnt This looks very similar to the error I was getting which is fixed by #13.

In my case, the issue was that the path to my node project was too long... you can easily test if that is the case by copying your project into /tmp or some other short directory, and trying to run it from there.

Or you can try out my fork, https://github.com/lucbelliveau/node-virtualenv

lucbelliveau avatar Oct 20 '17 18:10 lucbelliveau

I tried making this change locally but I'm still getting the same error.

viziblydiffrnt avatar Dec 18 '17 16:12 viziblydiffrnt

Using the fork?

lucbelliveau avatar Dec 18 '17 16:12 lucbelliveau

Yes, I manually applied the changes in your fork to the node module in my project. Do I need to reinstall the module?

viziblydiffrnt avatar Dec 18 '17 16:12 viziblydiffrnt

Try changing your virtualenv dependency  version in your package.json to use my fork instead and do a npm install..  that will ensure all the changes are applied.

Sent from my Samsung Galaxy smartphone. null

lucbelliveau avatar Dec 18 '17 16:12 lucbelliveau