Skip to content

Installation of Unicon in Linux Alpine #209

@eddysanoli

Description

@eddysanoli

Hello. Recently I've been trying to optimizing my containerized Python application by switching from Python's buster base image, to a Python Alpine image. All of my dependencies are installed during build time by using Poetry. I have a pyproject.toml file that lists all of my dependencies and installs them when I use poetry install. One of my dependencies is the Meraki Dashboard API package. That one doesn't give me any problems, but unfortunately it depends on unicon, hence why Im here. Whenever Poetry runs into unicon, it spits out the following error:

#0 37.24   RuntimeError
#0 37.24
#0 37.24   Unable to find installation candidates for unicon (23.4)
#0 37.24
#0 37.24   at /usr/local/lib/python3.8/site-packages/poetry/installation/chooser.py:109 in choose_for
#0 37.26       105│
#0 37.26       106│             links.append(link)
#0 37.26       107│
#0 37.26       108│         if not links:
#0 37.26     → 109│             raise RuntimeError(f"Unable to find installation candidates for {package}")
#0 37.26       110│
#0 37.26       111│         # Get the best link
#0 37.26       112│         chosen = max(links, key=lambda link: self._sort_key(package, link))
#0 37.26       113│

I've checked that the version is correct, that the docker container has the correct dependencies, even that my connection to the internet is stable. No matter what I do, I cannot get my alpine base image to properly install unicon. Is there any specific way that I need to know about? I found in a stackoverflow post, that alpine is kind of unreliable when it comes to Python packages that serve as wrappers for C or C++ code, but no other package is giving me this error. Im pretty sure it was my move to alpine, but I would appreciate the help if anyone could provide some advice into how I could get the project up and going with an alpine image.

Here's my dockerfile code for reference:

FROM python:3.8-alpine3.18

RUN apk update && apk add --no-cache --no-progress \
    bash \
    gcc \
    build-base \
    python3-dev \
    py3-pip \
    libffi-dev \ 
    pkgconfig \
    # TO CONVERT CRLF TO LF
    dos2unix \
    xvfb \
    wget \
    openssl \
    libssl1.1 \
    py-cryptography

# Set the default shell to bash
RUN sed -i -e "s/bin\/ash/bin\/bash/" /etc/passwd

# Move back to the default working directory for the app
WORKDIR /opt/app

# Copy the 'pyproject.toml' file, install the dependencies and then "activate"
# the environment by doing "poetry shell"
COPY pyproject.toml poetry.lock ./
RUN pip3 install poetry && poetry lock 
RUN poetry add unicon
RUN poetry install

# Copy all project files
COPY . .

EXPOSE 8080

# Run the starting script inside the poetry environment
CMD ["poetry", "run", "sh", "entrypoint.sh"]

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions