I have got the following Docker file
FROM jupyter/scipy-notebook
COPY . ./work
RUN pip install -r ./work/requirements.txt
COPY setup.py /work
RUN pip install --upgrade pip && pip install -e .
COPY src /work/src
WORKDIR /work
and the following project structure:
almond_analysis:
notebooks:
data_exploration.ipynb
src:
__init__.py
plots.py
.gitignore
docker-compose.yml
Dockerfile
README.md
requirements.txt
setup.py
Inside the data_exploration.ipynb
notebook, I would like to import the module src
with the command import src as test
. However, despite me having typed RUN pip install -e .
in the Dockerfile, I get the error ModuleNotFoundError: No module named 'src'
. When I do to my container though, inside the work
directory, and run pip install -e .
the error goes away. I tried adding CMD pip install -e .
at the end of the Dockerfile without success. I read also what was suggested in this post (more specifically to add the lines RUN apt-get update
and
RUN apt-get install -y --no-install-recommends
but without success.
My setup.py
file looks like this:
from setuptools import find_packages, setup
import sys
import os
sys.path.insert(0, os.path.abspath( os.path.dirname(__file__)))
requirements_path="requirements.txt"
with open(requirements_path) as requirements_file:
requirements = requirements_file.read().splitlines()
setup(
name="almond_analysis",
version="0.0.1",
description = "Almond analysis",
long_description="Analysing yield with Python."
author= "George N",
packages=find_packages(),
install_requires=requirements,
classifiers=[
"Programming Language :: Python :: 3"
],
python_requires =">= 3.0.*",
)
Does someone have an idea on how to make the ModuleNotFoundError
go away?