PIP with Npm in Vercel
Unanswered
Seppala Siberian Sleddog posted this in #help-forum
Seppala Siberian SleddogOP
I have a python code that converts a text to speech and save it in a file, in my local environment i used pip to install some modules, how can i use npm to download the NodeJS modules and pip to install python modules in verce?
22 Replies
are u talking about Python Runtime of NextJS(Vercel)?
https://vercel.com/docs/functions/serverless-functions/runtimes/python
https://vercel.com/docs/functions/serverless-functions/runtimes/python
@tafutada777 are u talking about Python Runtime of NextJS(Vercel)?
https://vercel.com/docs/functions/serverless-functions/runtimes/python
Seppala Siberian SleddogOP
I have a project which uses node js, but i have a python file that excutes a function to get some data, the file imports an external libray i have added a perbuild command to install these libraries and i have added a postbuild command
pip list to see the packeges which i can see theey are downloaded, but when i run the python file i get an error says module not found.# main.py
import requests
print('hello world!')// package.json
"scripts": {
"prebuild": "pip install -r requirements.txt",
"postbuild": "python main.py",
}you mean you run it on Vercel build?
can u capture the screen of error?
btw are u familiar with Python?
@tafutada777 btw are u familiar with Python?
Seppala Siberian SleddogOP
I'm fimiler with coding in python not it's environment
i don't think Vercel build servers have Python runtime.
only for AWS lambda functions, which is still beta.
Seppala Siberian SleddogOP
i can run python on vercel
but i can't import packages
that's the post build command
for this fie
# main.py
import sys # preinstalled library with python
print(sys.argv[0],sys.argv[1], sys.argv[2], sys.argv[3])
print('welcome')i didn't know that Vercel build servers have Python runtime. interesting.
Seppala Siberian SleddogOP
the approcah works on my local machiene
i'm thinking to use docker to solve it
I have an API route that calls python files on shell that uses python-shell package it is working ob my device, I think the issue with python files path
Vercel build servers are different from Vercel servers itself, which are AWS Lambda or Cloudflare Worker. you need to use a Python runtime to work in AWS Lambda as i showed the above.
And rust
Errr sorry you referenced the build server, not runtimes. I misread.