Skip to content

Error loading shared library libopenblas.so.3: No such file or directory #218

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

Closed
sgr-smile2015 opened this issue Aug 7, 2017 · 6 comments

Comments

@sgr-smile2015
Copy link

sgr-smile2015 commented Aug 7, 2017

my dockerfile :

FROM python:3.5-alpine
RUN echo "https://mirror.tuna.tsinghua.edu.cn/alpine/edge/community" >> /etc/apk/repositories
RUN apk add --update --no-cache \
	ca-certificates \	
RUN apk --no-cache  add --virtual .build-deps \
	gcc \
	g++ \
	openblas-dev \
        && ln -s /usr/include/locale.h /usr/include/xlocale.h \
        && pip3 install --no-cache-dir --disable-pip-version-check \
	numpy==1.11.0 \
	pandas==0.18.0 \ 
	scipy==0.13.3 \
	&& apk del .build-deps

in step 2: RUN apk add --update openblas-dev build sucessful,but image have 500MB,
Because alpine does not support dynamic libraries? how can i reduce image size, thank l lot!!

@yosifkit
Copy link
Member

yosifkit commented Aug 7, 2017

I didn't change much on your Dockerfile, and the resulting image is about 303 MB:

FROM python:3.5-alpine
RUN echo "https://mirror.tuna.tsinghua.edu.cn/alpine/edge/community" >> /etc/apk/repositories
RUN apk add --no-cache \
	ca-certificates \
	openblas

RUN apk add --no-cache --virtual .build-deps \
		gcc \
		g++ \
		openblas-dev \
	&& ln -s /usr/include/locale.h /usr/include/xlocale.h \
	&& pip3 install --no-cache-dir --disable-pip-version-check \
		numpy==1.11.0 \
		pandas==0.18.0 \
		scipy==0.13.3 \
	&& apk del .build-deps

@sgr-smile2015
Copy link
Author

it's work! thanks..

@gargayush341
Copy link

gargayush341 commented Apr 22, 2019

I am getting the same error ImportError: Error loading shared library libopenblas.so.3: No such file or directory (needed by /usr/local/lib/python3.5/site-packages/numpy/core/multiarray.cpython-35m-x86_64-linux-gnu.so)
when running docker-compose up
python packages are installed in /home/user/.local/lib/python3.5/site-packages not in /usr/local/lib but tried by creating the symlink of ~/.local/lib in /usr/local/lib

ubuntu: 16.04
docker-compose: 1.18.0

my dockerfile is like below:

FROM python:3.5-alpine
RUN apk --update add --virtual scipy-runtime python3 py3-pip
&& apk add --virtual scipy-build
build-base python3-dev openblas-dev freetype-dev pkgconfig gfortran
&& ln -s /usr/include/locale.h /usr/include/xlocale.h
&& pip3 install --no-cache-dir numpy
&& pip3 install --no-cache-dir matplotlib
&& pip3 install --no-cache-dir scipy
&& apk del scipy-build
&& apk add --virtual scipy-runtime
freetype libgfortran libgcc libpng libstdc++ musl openblas tcl tk
&& rm -rf /var/cache/apk/*

COPY ./requirements.txt /app/requirements.txt
WORKDIR /app/
RUN pip3 --version
&& apk --no-cache --update add --virtual scipy-build
build-base python3-dev openblas-dev freetype-dev pkgconfig gfortran
&& apk --no-cache --update add mariadb-dev jpeg-dev
&& pip3 install --no-cache-dir -r requirements.txt
&& apk del scipy-build
&& rm -rf /var/cache/apk/*
RUN apk --update add --virtual openssh-client

COPY ./webapp /app/webapp
COPY ./midi_match /app/midi_match
COPY ./run.py /app/run.py
COPY ./temp /app/temp
EXPOSE 5000

ENTRYPOINT ["python3"]
CMD ["run.py"]

please suggest something have been stuck for a long time

@sgr-smile2015
Copy link
Author

Because alpine does not support dynamic libraries, i suggest use FROM python:3.5 as base image

@gargayush341
Copy link

gargayush341 commented Apr 22, 2019

I have tried the above method but it's saying
/bin/sh: 1: apk: not found
and also If I use FROM python:3.5 as base image this will result in a large size image to reduce the size I used alpine
One more thing the above docker file is working fine on ubuntu 14 but throwing error on 16

@tianon
Copy link
Member

tianon commented Apr 22, 2019

These sorts of questions/requests would be more appropriately posted to the Docker Community Forums, the Docker Community Slack, or Stack Overflow.

@docker-library docker-library locked as resolved and limited conversation to collaborators Apr 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants