I am trying to setup a docker environment for the development of a panel widget.
Here the Dockerfile:
FROM jupyter/scipy-notebook:python-3.11 as base
RUN pip install jupyter-black
WORKDIR /home/jovyan
FROM base as debug
RUN pip install debugpy
CMD ["python", "-m", "debugpy", "--listen", "0.0.0.0:8889", "--wait-for-client", "main.py"]
FROM base as prod
CMD ["jupyter", "lab", "--ip", "0.0.0.0"]
# CMD [ "sh", "entry_point.sh"]
and the docker-compose file:
services:
main-container:
ports:
- "${HOST_PORT}:${CONTAINER_PORT}"
- "${DEBUG_HOST_PORT}:8889"
volumes:
- "${NOTEBOOK_DIR}:/home/jovyan"
- "${PERMANENT_STORAGE}:/home/jovyan/permanent_storage/"
- "${PACKAGE_DIR}:/home/jovyan/package"
environment:
- 'JUPYTER_RUNTIME_DIR=/tmp'
- 'JUPYTER_ENABLE_LAB=yes'
- 'PMT_STG_PATH=/home/jovyan/permanent_storage/'
build:
context: .
dockerfile: ${dockerfile_src}
target: ${dockerfile_target}
image: "${registry}/${repositoryName}:${dockerfile_target}_${versionNumber}"
the entry_point.sh is as following:
#!/bin/bash
cd package
pip install -e .
cd ..
jupyter lab --ip 0.0.0.0
at the /home/jovyan/package I have a submodule cloned repo forked from the original one.
To try and error, I am first playing a bit without installing the package, to see what I really need in the entry_point.sh file, but I am unable to install the package in editable mode. I correctly run "conda install -c pyviz “pyctdev>0.5.0"”, which seems to have installed the needed packages. But then when I run doit develop_install -c pyviz/label/dev -c conda-forge -c bokeh -o build -o tests -o recommended I get the following exception:
jovyan@02123b861bd7:~/package$ doit develop_install -c pyviz/label/dev -c conda-forge -c bokeh -o build -o tests -o recommended
ERROR: Could not find dodo file '/home/jovyan/package/dodo.py'.
Please use '-f' to specify file name.
if I simply run pip install -e . I get the following:
jovyan@02123b861bd7:~/package$ pip install -e .
Obtaining file:///home/jovyan/package
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... done
Installing backend dependencies ... done
Preparing editable metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing editable metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [30 lines of output]
Traceback (most recent call last):
File "/opt/conda/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/opt/conda/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 176, in prepare_metadata_for_build_editable
whl_basename = build_hook(metadata_directory, config_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-c5d9p79s/overlay/lib/python3.11/site-packages/hatchling/build.py", line 83, in build_editable
return os.path.basename(next(builder.build(directory=wheel_directory, versions=['editable'])))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-c5d9p79s/overlay/lib/python3.11/site-packages/hatchling/builders/plugin/interface.py", line 90, in build
self.metadata.validate_fields()
File "/tmp/pip-build-env-c5d9p79s/overlay/lib/python3.11/site-packages/hatchling/metadata/core.py", line 265, in validate_fields
_ = self.version
^^^^^^^^^^^^
File "/tmp/pip-build-env-c5d9p79s/overlay/lib/python3.11/site-packages/hatchling/metadata/core.py", line 149, in version
self._version = self._get_version()
^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-c5d9p79s/overlay/lib/python3.11/site-packages/hatchling/metadata/core.py", line 248, in _get_version
version = self.hatch.version.cached
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-c5d9p79s/overlay/lib/python3.11/site-packages/hatchling/metadata/core.py", line 1466, in cached
raise type(e)(message) from None
LookupError: Error getting the version from source `vcs`: setuptools-scm was unable to detect version for /home/jovyan/package.
Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout without the .git folder) don't contain the necessary metadata and will not work.
For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Can anyone point me in what I am doing wrong? Shall I use another base image?