cog icon indicating copy to clipboard operation
cog copied to clipboard

Error while finding module specification for 'cog.server.http' (ModuleNotFoundError: No module named 'cog')

Open Aparna29T opened this issue 1 year ago • 4 comments

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

Aparna29T avatar Mar 22 '24 07:03 Aparna29T

@bfirsh @anotherjesse Any update here?

Aparna29T avatar Mar 28 '24 11:03 Aparna29T

same issue

CodeDetector avatar May 22 '24 11:05 CodeDetector

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

mattt avatar Jun 11 '24 12:06 mattt

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.

ColeDrain avatar Sep 06 '24 00:09 ColeDrain