replicate / cog

Containers for machine learning
https://cog.run
Apache License 2.0
8.08k stars 563 forks source link

Error when trying to run a notebook on a sample project #560

Closed iperdomo closed 2 years ago

iperdomo commented 2 years ago

Hi,

The documentation suggests that I should be able to run a jupyter notebook by issuing a cog run jupyter [...] command - See #488

I'm testing Cog version 0.3.0 and I'm getting the following error in a fresh sample project:

[...]
Running 'jupyter notebook --ip 0.0.0.0 --no-browser --port=8080 --allow-root' in Docker with the current directory mounted as a volume...
docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "jupyter": executable file not found in $PATH: unknown.
ⅹ exit status 127

Environment

Steps to reproduce

See attached video

https://user-images.githubusercontent.com/178474/164511281-1791c929-e498-44fc-b6ec-a5652b0aa964.mp4

zeke commented 2 years ago

Hey @iperdomo thanks for reporting this, and for include that helpful video to illustrate the problem. ⭐

In order to run the juptyer command, you'll need to add the jupyterlab dependency to your cog.yaml file, like so:

build:
  python_packages:
    - "jupyterlab==3.3.4"

You should then be able to cog build then run the notebook command above.

I will open a PR to update the documentation around this.

iperdomo commented 2 years ago

Hi @zeke thanks for the explanation, that was my guess. You have to install jupyter as part of the dependencies. Adding jupyter to the dependencies make the docker image even bigger, and you don't need jupyter in the production image, just for development.

It would be interesting to define the scope of the package, e.g. production vs development. Different ecosystems solve the issue in different ways, e.g. npm with devDependencies. I'm not sure if there is way to specify dev dependencies with pip

zeke commented 2 years ago

@all-contributors please add @iperdomo for bugs

allcontributors[bot] commented 2 years ago

@zeke

I've put up a pull request to add @iperdomo! :tada: