Is it possible to disable the PEP 440 checks? #6367
-
|
I'm having a hell of a time trying to get poetry 1.2.0 running on Ubuntu, both on all our servers and in our Docker containers for CI. I'm currently trying to get it working in our base Docker image so I'll focus on the issues with that here for now. Having lost yesterday trying to install it with the new official installer on a server, I thought I'd try pipx in docker. I ended up having to add So, I returned to the official installer, added I've completely run out of ideas at this point, and I'd love to know what the official advice / position is. Can I turn off the PEP440 checks? My Note that the
which doesn't mention what those locations are or what's standard about them (I've always thought Any help with this would be hugely appreciated, I've spent two days on it now and gotten nowhere and we're really going to need the CI back up soon. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
|
Hi @drcongo -- the solution here is to use a virtual environment. Poetry needs to be able to reason about and manage the environment your project is installed into. One of the reasons for this is what you've run into -- distro packaging may result in packages that are invalid according to the rules of the Python ecosystem that Poetry adheres to (and Poetry needs to understand what packages and versions are in your environment in order to install/upgrade/uninstall to meet your project's needs). Similarly, there may be conflicts between your project's dep tree and the Python deps present in the system (say you Virtual environments are a powerful tool and an expected part of using Python, even in a container. I'm sorry that what was working before no longer works -- however it was only ever a happy coincidence that it did, and not an intended behavior. We're working on better documentation/resources for this (there was a user who wanted to spearhead documentation and guidance for containers, but they seem to have disappeared) -- if you would like to participate you would certainly be welcome. |
Beta Was this translation helpful? Give feedback.
-
|
OK, thanks @neersighted, I'll try adding a |
Beta Was this translation helpful? Give feedback.
-
|
Update: This is what happens if I use a venv in the container... |
Beta Was this translation helpful? Give feedback.
-
|
So close, but now I have one of the problems I had yesterday in that poetry creates a "Minimal" Docker file here: This is the base image that a lot of our application images build on. |
Beta Was this translation helpful? Give feedback.
-
|
I'm not sure what FROM ubuntu:20.04 as base
# set noninteractive installation
RUN mkdir -p /etc/ssl/certs/java/ && \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
tzdata \
language-pack-en && \
ln -fs /usr/share/zoneinfo/Europe/London /etc/localtime && \
dpkg-reconfigure --frontend noninteractive tzdata && \
update-locale LANG=en_GB.UTF-8 LC_MESSAGES=POSIX
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
autojump \
automake \
bash \
build-essential \
bzip2 \
ca-certificates \
checkinstall \
curl \
default-jre \
fish \
g++ \
gcc \
gettext \
git \
libbz2-dev \
libc-dev \
libc6-dev \
libcairo2 \
libcairo2-dev \
libcurl4 \
libcurl4-openssl-dev \
libevent-2.1-7 \
libevent-dev \
libffi-dev \
libfreetype6 \
libfreetype6-dev \
libgdbm-dev \
libgdk-pixbuf2.0-0 \
libjpeg-dev \
libjpeg8 \
libjpeg8-dev \
liblzma-dev \
libncurses5-dev \
libncursesw5-dev \
libpango1.0-0 \
libpcre3-dev \
libpng-dev \
libpq-dev \
libreadline-dev \
libsass-dev \
libsass1 \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
libxslt1-dev \
llvm \
make \
nano \
nodejs \
openssh-server \
postgresql-12 \
python-openssl \
python-sqlite \
python3-dev \
python3-libsass \
python3-mysqldb \
python3-pil \
python3-psycopg2 \
python3-pycurl \
python3-setuptools \
python3.8-venv \
rsync \
software-properties-common \
sqlite \
sudo \
tk-dev \
wget \
xz-utils \
zlib1g-dev \
zsh \
&& rm -rf /root/.cache && \
rm -rf /var/lib/apt/lists/*
ENV SHELL /bin/zsh
FROM base AS app
ENV POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=1
# Install poetry
RUN curl -sSL https://install.python-poetry.org | python3 - --version 1.2.0 && \
ln -s $POETRY_HOME/bin/poetry /usr/local/bin/poetry
# Other setup
RUN ln -s /usr/bin/python3 /usr/bin/python && \
mkdir -p /usr/srv/app/
WORKDIR /usr/srv/app/
CMD "sleep 99999999"Note some key differences:
For a clean start, I would suggest something like this: ENV POETRY_HOME="/opt/poetry"
RUN python3 -m venv $POETRY_HOME && \
$POETRY_HOME/bin/pip install poetry==1.2.0
RUN git clone <repo> /usr/srv/app
WORKDIR /usr/srv/app
ENV VIRTUAL_ENV=/usr/srv/app-env \
PATH="/usr/srv/app-env/bin:${POETRY_HOME}/bin:${PATH}"
RUN python3 -m venv $VIRTUAL_ENV && \
poetry install
CMD "python -m <myapp>" # or
CMD "<my script entrypoint>" # etc |
Beta Was this translation helpful? Give feedback.
I'm not sure what
python -m venv .venvis supposed to accomplish with its present placement -- anyway, try the following: