Cannot find module when executing Python code
I ran this command to install certain Python packages:
pip3 install langchain flask llama_index gradio openai pandas numpy glob2 datetime
As you can see, flask
is included.
I then ran my Python code:
python3 embeddings.py
However, I received the following error:
Traceback (most recent call last):
File "embeddings.py", line 3, in <module>
from flask import Flask, request, jsonify
ModuleNotFoundError: No module named 'flask'
I'm not sure why, but I went ahead and installed flask again, this time separately using:
pip3 install flask
Then it was missing the next package llama_index
. I repeated the same steps.
Essentially, when trying to install multiple Python packages in a single command line, it did not seem to have the desired effect.
So this did not work (in fact, it actually installed only the first package):
pip3 install langchain flask llama_index gradio openai pandas numpy glob2 datetime
And had to install them individual as shown:
pip3 install langchain
pip3 install langchain==0.0.27
pip3 install flask
pip3 install llama_index
pip3 install gradio
pip3 install openai
pip3 install pandas
pip3 install numpy
pip3 install glob2
pip3 install datetime