Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Alpine Image : Could not find a version that satisfies the requirement kaleido (from versions: none) #34

Closed
JaredOzzy opened this issue Aug 16, 2020 · 13 comments

Comments

@JaredOzzy
Copy link

JaredOzzy commented Aug 16, 2020

ERROR: Could not find a version that satisfies the requirement kaleido (from versions: none)
ERROR: No matching distribution found for kaleido
ERROR: Service 'django' failed to build: The command '/bin/sh -c pip install kaleido' returned a non-zero code: 1

my dockerfile does the following thats relevent:

FROM python:3.7.4-alpine
RUN pip install kaleido
RUN pip install -r requirements.txt

i get the same issue when i added kaleido the the requirements.txt and remove the RUN pip install kaleido command.

I have also tried adding versions, i get the same issues.

Also Tried running the command RUN install https://github.com/plotly/Kaleido/releases/download/v0.0.3/kaleido-0.0.3-py2.py3-none-manylinux2014_x86_64.whl

Step 8/13 : RUN install https://github.com/plotly/Kaleido/releases/download/v0.0.3/kaleido-0.0.3-py2.py3-none-manylinux2014_x86_64.whl
 ---> Running in 528ab1a4e2e8
BusyBox v1.30.1 (2019-06-12 17:51:55 UTC) multi-call binary.

Usage: install [-cdDsp] [-o USER] [-g GRP] [-m MODE] [-t DIR] [SOURCE]... DEST

Copy files and set attributes

	-c	Just copy (default)
	-d	Create directories
	-D	Create leading target directories
	-s	Strip symbol table
	-p	Preserve date
	-o USER	Set ownership
	-g GRP	Set group ownership
	-m MODE	Set permissions
	-t DIR	Install to DIR
ERROR: Service 'django' failed to build: The command '/bin/sh -c install https://github.com/plotly/Kaleido/releases/download/v0.0.3/kaleido-0.0.3-py2.py3-none-manylinux2014_x86_64.whl' returned a non-zero code: 1
make: *** [build] Error 1

all i want is to be able to save a plotly graph to a file but orca is crazy mission with docker, was hoping the recommended kaleido would be less of a mission to install and get working

@jonmmease
Copy link
Collaborator

Hi @JaredOzzy, the first easy thing to try is updating pip before installing kaleido.

FROM python:3.7.4-alpine
RUN pip install -U pip
RUN pip install kaleido
RUN pip install -r requirements.txt

If you want to try to install from a pip file directly, I think you're missing pip in the RUN install https://... command. I think you would want this to be RUN pip install https://.... But if the issue is an old version of pip, then this command would fail as well.

@JaredOzzy
Copy link
Author

JaredOzzy commented Aug 16, 2020

Will give that a shot, I was using the latest pip version too, i still get the following.

ERROR: Could not find a version that satisfies the requirement kaleido (from versions: none)
ERROR: No matching distribution found for kaleido

I've added the RUN pip install https:// and have received the following error
ERROR: kaleido-0.0.3-py2.py3-none-manylinux2014_x86_64.whl is not a supported wheel on this platform

so yeah not available on alpine?

@jonmmease
Copy link
Collaborator

I was using the latest pip version too.

Ok, well it's worth double checking. But I did just find an interesting note at the end of the platform-compatibility-tag specification: https://packaging.python.org/specifications/platform-compatibility-tags/

Platform tags for other *nix platforms

The scheme defined in PEP 425 is not generally sufficient for public distribution of wheel files to other *nix platforms. Efforts are > currently (albeit intermittently) under way to define improved compatibility tagging schemes for AIX and for Alpine Linux.

I'm not familiar enough with Alpine linux to understand why it wouldn't be included in the standard linux platform tag specification, but maybe something is going on here. Could you add the output of in your container?

import platform
print(platform.machine())
print(platform.architecture())
print(platform.platform())

Can you install numpy alright? If so, I'm wondering which of these files pip chooses (https://pypi.org/project/numpy/#files).

@jonmmease
Copy link
Collaborator

Oh, Alpine supports a bunch of architectures: https://alpinelinux.org/downloads/

Screenshot_20200816_132826

Right now, I'd only expect Kaleido to work with the x86_64 architecture.

@JaredOzzy
Copy link
Author

JaredOzzy commented Aug 16, 2020

Just went through a massive mission to get numpy installed, took ages for my containers to build too.
in the logs i see it building the following numpy version.

Collecting numpy>=1.9.3
  Downloading https://files.pythonhosted.org/packages/2c/2f/7b4d0b639a42636362827e611cfeba67975ec875ae036dd846d459d52652/numpy-1.19.1.zip

i had to add many deps in the dockerfile for the image to install

RUN pip install --upgrade setuptools
# Run cython deps and other things
RUN apk add --no-cache --virtual .build-deps musl-dev \
    && pip install cython \
    && apk del .build-deps

Here is the platform results

>>> import platform
>>> print(platform.machine())
x86_64
>>> print(platform.architecture())
('64bit', 'ELF')
>>> print(platform.platform())
Linux-4.19.76-linuxkit-x86_64-with
>>> 

@jonmmease
Copy link
Collaborator

Ok, thanks for that info. The reason your numpy install took so long is that pip pulled in the numpy source bundle (numpy-1.19.1.zip) and compiled it from source. This means that pip rejected all of the platforms that numpy is pre-compiled for.

A little searching turned up a helpful article that matches what you're seeing: https://pythonspeed.com/articles/alpine-docker-python/

If you look at the Debian-based build above, you’ll see it’s downloading matplotlib-3.1.2-cp38-cp38-manylinux1_x86_64.whl. This is a pre-compiled binary wheel. Alpine, in contrast, downloads the source code (matplotlib-3.1.2.tar.gz), because standard Linux wheels don’t work on Alpine Linux.

Why? Most Linux distributions use the GNU version (glibc) of the standard C library that is required by pretty much every C program, including Python. But Alpine Linux uses musl, those binary wheels are compiled against glibc, and therefore Alpine disabled Linux wheel support.

FWIW, the article's conclusion is "Don’t use Alpine Linux for Python images". Is changing the image base an option for you?

@JaredOzzy
Copy link
Author

Ok, thanks for that info. The reason your numpy install took so long is that pip pulled in the numpy source bundle (numpy-1.19.1.zip) and compiled it from source. This means that pip rejected all of the platforms that numpy is pre-compiled for.

A little searching turned up a helpful article that matches what you're seeing: https://pythonspeed.com/articles/alpine-docker-python/

If you look at the Debian-based build above, you’ll see it’s downloading matplotlib-3.1.2-cp38-cp38-manylinux1_x86_64.whl. This is a pre-compiled binary wheel. Alpine, in contrast, downloads the source code (matplotlib-3.1.2.tar.gz), because standard Linux wheels don’t work on Alpine Linux.
Why? Most Linux distributions use the GNU version (glibc) of the standard C library that is required by pretty much every C program, including Python. But Alpine Linux uses musl, those binary wheels are compiled against glibc, and therefore Alpine disabled Linux wheel support.

FWIW, the article's conclusion is "Don’t use Alpine Linux for Python images". Is changing the image base an option for you?

it is an option, but damn i don't think its worth it at this moment, ill just go with matplotlib for now instead as the image is easy to save . still have to install numpy and go through all the issues though but yeah, alpine hasn't really been an issue for me at the moment.

ill try to convert it perhaps...

@jmoore87jr
Copy link

It must be an Alpine thing.

FROM python:3 works fine.

@namitha109tech
Copy link

namitha109tech commented Aug 9, 2021

image

I have been in the issue for 3 days , please give me a solution to do the build success

joshhighet added a commit to joshhighet/ransomwatch that referenced this issue Sep 9, 2021
@awoodevpub
Copy link

Greetings,

is there any update on this? I need to provide kaleido to my alpine docker image :(

@awoodevpub
Copy link

I've figured it out, just install miniconda3/miniforge within alpine dockerfile and then you can install kaleido from anaconda

Note: do not use forge as channel, I installed miniforge and just do $ RUN conda install -y python-kaleido; It's a lot of effort for just one package but until now I couldn't figure out an easier solution. Maybe an APK should be published for kaleido in order to avoid all this mess

Regards!

@ishita2326
Copy link

Hey, any solution? I'm facing a similar issue while installing dash

@gvwilson
Copy link
Collaborator

Thanks for your interest in Kaleido. We are currently working on an overhaul that might address your issue - we hope to have news in a few weeks and will post an update then. Thanks - @gvwilson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants