cog
cog copied to clipboard
Cog notebook feature broken
Hi all, great project!
Playing around this, hoping to get a notebook server running via cog. Looking at the docs, I should just be able to run cog run jupyter notebook
but I immediately run into trouble. It seems like jupyter
isn't in the PATH of the docker container?
cog.yaml
build:
gpu: true
python_version: "3.9"
system_packages:
- "git"
python_packages:
- "torch==2.0.0"
- "jupyterlab==3.3.4"
- "transformers"
predict: "predict.py:Predictor"
Output:
Running 'jupyter lab --allow-root --ip=0.0.0.0' in Docker with the current directory mounted as a volume...
[FATAL tini (7)] exec jupyter failed: No such file or directory
Running 'jupyter notebook --allow-root --ip=0.0.0.0' in Docker with the current directory mounted as a volume...
[FATAL tini (7)] exec jupyter failed: No such file or directory
Looking at the generated Dockerfile
via cog debug > Dockerfile
, I'd guess it's because pyenv isn't setup correctly?
...
ENV PATH="/root/.pyenv/shims:/root/.pyenv/bin:$PATH"
...
RUN curl -s -S -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash && \
git clone https://github.com/momo-lab/pyenv-install-latest.git "$(pyenv root)"/plugins/pyenv-install-latest && \
pyenv install-latest "3.9" && \
pyenv global $(pyenv install-latest --print "3.9") && \
pip install "wheel<1"
RUN --mount=type=cache,target=/var/cache/apt apt-get update -qq && apt-get install -qqy git && rm -rf /var/lib/apt/lists/*
RUN --mount=type=bind,from=deps,source=/dep,target=/dep cp -rf /dep/* $(pyenv prefix)/lib/python*/site-packages || true
WORKDIR /src
EXPOSE 5000
CMD ["python", "-m", "cog.server.http"]
COPY . /src
Hi @li-dennis. As you alluded to, the directory where Python libraries are installed isn't included in the PATH
. If you want to do cog run jupyter
, you'll need to install it another way, like in a run
step:
build:
run:
- pip install jupyterlab