Python Dependencies Installed via pip in Node.js App Not Found in Render.com

I’m currently developing a Node.js application on Render.com that utilizes a Python child process. This Python process has its own set of dependencies, which I’ve listed in a requirements.txt file.

In the build process, I’ve included the command pip install -r requirements.txt to install these Python dependencies. According to the logs, the installation appears to be successful. However, when the Node.js script reaches the part where it needs to use these Python libraries (e.g., regex), it throws an error indicating that it can’t find the installed libraries.

I initially suspected this might be a PATH issue. To address this, I tried adding export PATH=$PATH:/path/to/python/packages to the build command, replacing /path/to/python/packages with the actual installation location. Unfortunately, this didn’t solve the problem.

I’ve also tried using Poetry, as following the Django tutorial, however, it seems that the node environmnet does not have Poetry pre-installed.

I’m at a loss for how to proceed and would appreciate any guidance or suggestions. How can I ensure that my Python dependencies are correctly found and utilized in my Node.js application?

Hi,

I’ve replied to the ticket you also opened, I’ll repeat the response here:

If you want to use both Python & Node in the same environment, you’ll need to use the Python Native Runtime, which also has Node available.

Your Build Command could install dependencies with something like:

pip install -r requirements.txt && npm install

Alan

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