Error while finding module specification for 'cog.server.http' (ModuleNotFoundError: No module named 'cog')
Error: Error while finding module specification for 'cog.server.http' (ModuleNotFoundError: No module named 'cog') Not able to use run command inside build section in cog.yaml
Below is my cog yaml.
build:
gpu: false
python_packages:
- "pandas==1.4.3"
- "scikit-learn==1.3.0"
- "numpy==1.23.2"
- "nltk==3.7"
- "gensim==4.2.0"
- "sentence-transformers==2.5.1"
- "joblib==1.2.0"
- "Flask==3.0.2"
- "torch==1.12.1"
python_version: "3.10.6"
run:
- command: "python -m pip install nltk && python -m nltk.downloader all"
predict: "predict.py:Predictor"
instead of
run:
- command: "python -m pip install nltk && python -m nltk.downloader all"
tried
build:
run:
- "python -m nltk.downloader stopwords && \
python -m nltk.downloader punkt && \
python -m nltk.downloader wordnet && \
python -m nltk.downloader omw-1.4"
If I try to run only cog build -t tagname
Error: Validating model schema... /usr/local/bin/python: Error while finding module specification for 'cog.command.openapi_schema' (ModuleNotFoundError: No module named 'cog')
Is RUN command not supported? If so how I can install below commands in cog.yaml
python -m nltk.downloader stopwords
python -m nltk.downloader punkt
python -m nltk.downloader wordnet
python -m nltk.downloader omw-1.4
@bfirsh @anotherjesse Any update here?
same issue
Hi, @Aparna29T.
Based on the error message you shared, it looks like the python command run in the GenerateOpenAPISchema function doesn't have a the Cog Python package installed.
Can you please try running the following command and trying again?
/usr/local/bin/python -m pip install cog
Hi @mattt is there a fix we can add to the GenerateOpenAPISchema function?
This should be automated I guess. I can work on it, if that makes sense.