How can I install lxml in docker
I want to deploy my python project in docker, I wrote lxml>=3.5.0
in the requirments.txt as the project needs lxml. Here is my dockfile:
FROM gliderlabs/alpine:3.3
RUN set -x
&& buildDeps='
python-dev
py-pip
build-base
'
&& apk --update add python py-lxml $buildDeps
&& rm -rf /var/cache/apk/*
&& mkdir -p /app
ENV INSTALL_PATH /app
WORKDIR $INSTALL_PATH
COPY requirements-docker.txt ./
RUN pip install -r requirements.txt
COPY . .
RUN apk del --purge $buildDeps
ENTRYPOINT ["celery", "-A", "tasks", "worker", "-l", "info", "-B"]
I got this when I deploy it to docker:
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command 'gcc' failed with exit status 1
----------------------------------------
Rolling back uninstall of lxml
I though it was because 'python-dev' and 'python-lxml', then I edited the dockfile like this:
WORKDIR $INSTALL_PATH
COPY requirements-docker.txt ./
RUN apt-get build-dev python-lxml
RUN pip install -r requirements.txt
It did not work, and I got another error:
---> Running in 73201a0dcd59
/bin/sh: apt-get: not found
How can I install lxml correctly in docker? Thanks
python docker lxml dockerfile
add a comment |
I want to deploy my python project in docker, I wrote lxml>=3.5.0
in the requirments.txt as the project needs lxml. Here is my dockfile:
FROM gliderlabs/alpine:3.3
RUN set -x
&& buildDeps='
python-dev
py-pip
build-base
'
&& apk --update add python py-lxml $buildDeps
&& rm -rf /var/cache/apk/*
&& mkdir -p /app
ENV INSTALL_PATH /app
WORKDIR $INSTALL_PATH
COPY requirements-docker.txt ./
RUN pip install -r requirements.txt
COPY . .
RUN apk del --purge $buildDeps
ENTRYPOINT ["celery", "-A", "tasks", "worker", "-l", "info", "-B"]
I got this when I deploy it to docker:
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command 'gcc' failed with exit status 1
----------------------------------------
Rolling back uninstall of lxml
I though it was because 'python-dev' and 'python-lxml', then I edited the dockfile like this:
WORKDIR $INSTALL_PATH
COPY requirements-docker.txt ./
RUN apt-get build-dev python-lxml
RUN pip install -r requirements.txt
It did not work, and I got another error:
---> Running in 73201a0dcd59
/bin/sh: apt-get: not found
How can I install lxml correctly in docker? Thanks
python docker lxml dockerfile
3
You use alpine, so it may beapk add
but notapt-get
– user2915097
Mar 11 '16 at 5:06
@user2915097 Thanks! I changed it toapk add python-dev py-lxml
, it returned the error:error: command 'gcc' failed with exit status 1
. I don't know how to install lxml
– thiiiiiking
Mar 11 '16 at 9:20
the package name is correct pkgs.alpinelinux.org/package/main/x86/py-lxml
– user2915097
Mar 11 '16 at 9:24
1
seems to install lxml fine in this Dockerfile pkgs.alpinelinux.org/package/main/x86/py-lxml or hub.docker.com/r/ryanfox1985/docker-couchpotato/builds/… or hub.docker.com/r/trcook/docker-scrapy/builds/…
– user2915097
Mar 11 '16 at 9:26
add a comment |
I want to deploy my python project in docker, I wrote lxml>=3.5.0
in the requirments.txt as the project needs lxml. Here is my dockfile:
FROM gliderlabs/alpine:3.3
RUN set -x
&& buildDeps='
python-dev
py-pip
build-base
'
&& apk --update add python py-lxml $buildDeps
&& rm -rf /var/cache/apk/*
&& mkdir -p /app
ENV INSTALL_PATH /app
WORKDIR $INSTALL_PATH
COPY requirements-docker.txt ./
RUN pip install -r requirements.txt
COPY . .
RUN apk del --purge $buildDeps
ENTRYPOINT ["celery", "-A", "tasks", "worker", "-l", "info", "-B"]
I got this when I deploy it to docker:
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command 'gcc' failed with exit status 1
----------------------------------------
Rolling back uninstall of lxml
I though it was because 'python-dev' and 'python-lxml', then I edited the dockfile like this:
WORKDIR $INSTALL_PATH
COPY requirements-docker.txt ./
RUN apt-get build-dev python-lxml
RUN pip install -r requirements.txt
It did not work, and I got another error:
---> Running in 73201a0dcd59
/bin/sh: apt-get: not found
How can I install lxml correctly in docker? Thanks
python docker lxml dockerfile
I want to deploy my python project in docker, I wrote lxml>=3.5.0
in the requirments.txt as the project needs lxml. Here is my dockfile:
FROM gliderlabs/alpine:3.3
RUN set -x
&& buildDeps='
python-dev
py-pip
build-base
'
&& apk --update add python py-lxml $buildDeps
&& rm -rf /var/cache/apk/*
&& mkdir -p /app
ENV INSTALL_PATH /app
WORKDIR $INSTALL_PATH
COPY requirements-docker.txt ./
RUN pip install -r requirements.txt
COPY . .
RUN apk del --purge $buildDeps
ENTRYPOINT ["celery", "-A", "tasks", "worker", "-l", "info", "-B"]
I got this when I deploy it to docker:
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command 'gcc' failed with exit status 1
----------------------------------------
Rolling back uninstall of lxml
I though it was because 'python-dev' and 'python-lxml', then I edited the dockfile like this:
WORKDIR $INSTALL_PATH
COPY requirements-docker.txt ./
RUN apt-get build-dev python-lxml
RUN pip install -r requirements.txt
It did not work, and I got another error:
---> Running in 73201a0dcd59
/bin/sh: apt-get: not found
How can I install lxml correctly in docker? Thanks
python docker lxml dockerfile
python docker lxml dockerfile
asked Mar 11 '16 at 3:19
thiiiiiking
4031615
4031615
3
You use alpine, so it may beapk add
but notapt-get
– user2915097
Mar 11 '16 at 5:06
@user2915097 Thanks! I changed it toapk add python-dev py-lxml
, it returned the error:error: command 'gcc' failed with exit status 1
. I don't know how to install lxml
– thiiiiiking
Mar 11 '16 at 9:20
the package name is correct pkgs.alpinelinux.org/package/main/x86/py-lxml
– user2915097
Mar 11 '16 at 9:24
1
seems to install lxml fine in this Dockerfile pkgs.alpinelinux.org/package/main/x86/py-lxml or hub.docker.com/r/ryanfox1985/docker-couchpotato/builds/… or hub.docker.com/r/trcook/docker-scrapy/builds/…
– user2915097
Mar 11 '16 at 9:26
add a comment |
3
You use alpine, so it may beapk add
but notapt-get
– user2915097
Mar 11 '16 at 5:06
@user2915097 Thanks! I changed it toapk add python-dev py-lxml
, it returned the error:error: command 'gcc' failed with exit status 1
. I don't know how to install lxml
– thiiiiiking
Mar 11 '16 at 9:20
the package name is correct pkgs.alpinelinux.org/package/main/x86/py-lxml
– user2915097
Mar 11 '16 at 9:24
1
seems to install lxml fine in this Dockerfile pkgs.alpinelinux.org/package/main/x86/py-lxml or hub.docker.com/r/ryanfox1985/docker-couchpotato/builds/… or hub.docker.com/r/trcook/docker-scrapy/builds/…
– user2915097
Mar 11 '16 at 9:26
3
3
You use alpine, so it may be
apk add
but not apt-get
– user2915097
Mar 11 '16 at 5:06
You use alpine, so it may be
apk add
but not apt-get
– user2915097
Mar 11 '16 at 5:06
@user2915097 Thanks! I changed it to
apk add python-dev py-lxml
, it returned the error: error: command 'gcc' failed with exit status 1
. I don't know how to install lxml– thiiiiiking
Mar 11 '16 at 9:20
@user2915097 Thanks! I changed it to
apk add python-dev py-lxml
, it returned the error: error: command 'gcc' failed with exit status 1
. I don't know how to install lxml– thiiiiiking
Mar 11 '16 at 9:20
the package name is correct pkgs.alpinelinux.org/package/main/x86/py-lxml
– user2915097
Mar 11 '16 at 9:24
the package name is correct pkgs.alpinelinux.org/package/main/x86/py-lxml
– user2915097
Mar 11 '16 at 9:24
1
1
seems to install lxml fine in this Dockerfile pkgs.alpinelinux.org/package/main/x86/py-lxml or hub.docker.com/r/ryanfox1985/docker-couchpotato/builds/… or hub.docker.com/r/trcook/docker-scrapy/builds/…
– user2915097
Mar 11 '16 at 9:26
seems to install lxml fine in this Dockerfile pkgs.alpinelinux.org/package/main/x86/py-lxml or hub.docker.com/r/ryanfox1985/docker-couchpotato/builds/… or hub.docker.com/r/trcook/docker-scrapy/builds/…
– user2915097
Mar 11 '16 at 9:26
add a comment |
3 Answers
3
active
oldest
votes
I added RUN apk add --update --no-cache g++ gcc libxslt-dev==1.1.29-r0
before RUN pip install -r requirements.txt
and it worked.
8
Just wanted to add that the release version of libxslt-dev is not necessary, you can dolibxslt-dev
.
– Kazanz
May 17 '17 at 19:59
2
I don't think that g++ is required for building libxml2 so I think that you can replace g++ with libc-dev which results in a smaller container for me.
– Russell Gallop
May 15 at 10:36
add a comment |
Actually, it's just
RUN apt-get install -y libxslt1-dev
add a comment |
Do as in
https://hub.docker.com/r/ryanfox1985/docker-couchpotato/builds/boinrrs9dbhnutwjxjw2l8m/
Download the apk and install it
RUN wget http://nl.alpinelinux.org/alpine/edge/main/x86_64/py-lxml-3.4.0-r0.apk -O /var/cache/apk/py-lxml.apk
RUN apk add --allow-untrusted /var/cache/apk/py-lxml.apk
5
Just out of curiosity why was this downvoted so hard?
– digitaldavenyc
Dec 30 '16 at 4:19
1
@digitaldavenyc I didn't downvote; however, downloading an unauthenticated package and installing that as part of the build process does sound horrible to me.
– marcelm
Jul 25 at 15:24
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f35931579%2fhow-can-i-install-lxml-in-docker%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I added RUN apk add --update --no-cache g++ gcc libxslt-dev==1.1.29-r0
before RUN pip install -r requirements.txt
and it worked.
8
Just wanted to add that the release version of libxslt-dev is not necessary, you can dolibxslt-dev
.
– Kazanz
May 17 '17 at 19:59
2
I don't think that g++ is required for building libxml2 so I think that you can replace g++ with libc-dev which results in a smaller container for me.
– Russell Gallop
May 15 at 10:36
add a comment |
I added RUN apk add --update --no-cache g++ gcc libxslt-dev==1.1.29-r0
before RUN pip install -r requirements.txt
and it worked.
8
Just wanted to add that the release version of libxslt-dev is not necessary, you can dolibxslt-dev
.
– Kazanz
May 17 '17 at 19:59
2
I don't think that g++ is required for building libxml2 so I think that you can replace g++ with libc-dev which results in a smaller container for me.
– Russell Gallop
May 15 at 10:36
add a comment |
I added RUN apk add --update --no-cache g++ gcc libxslt-dev==1.1.29-r0
before RUN pip install -r requirements.txt
and it worked.
I added RUN apk add --update --no-cache g++ gcc libxslt-dev==1.1.29-r0
before RUN pip install -r requirements.txt
and it worked.
answered Jan 27 '17 at 21:03
Cintia Sestelo
27933
27933
8
Just wanted to add that the release version of libxslt-dev is not necessary, you can dolibxslt-dev
.
– Kazanz
May 17 '17 at 19:59
2
I don't think that g++ is required for building libxml2 so I think that you can replace g++ with libc-dev which results in a smaller container for me.
– Russell Gallop
May 15 at 10:36
add a comment |
8
Just wanted to add that the release version of libxslt-dev is not necessary, you can dolibxslt-dev
.
– Kazanz
May 17 '17 at 19:59
2
I don't think that g++ is required for building libxml2 so I think that you can replace g++ with libc-dev which results in a smaller container for me.
– Russell Gallop
May 15 at 10:36
8
8
Just wanted to add that the release version of libxslt-dev is not necessary, you can do
libxslt-dev
.– Kazanz
May 17 '17 at 19:59
Just wanted to add that the release version of libxslt-dev is not necessary, you can do
libxslt-dev
.– Kazanz
May 17 '17 at 19:59
2
2
I don't think that g++ is required for building libxml2 so I think that you can replace g++ with libc-dev which results in a smaller container for me.
– Russell Gallop
May 15 at 10:36
I don't think that g++ is required for building libxml2 so I think that you can replace g++ with libc-dev which results in a smaller container for me.
– Russell Gallop
May 15 at 10:36
add a comment |
Actually, it's just
RUN apt-get install -y libxslt1-dev
add a comment |
Actually, it's just
RUN apt-get install -y libxslt1-dev
add a comment |
Actually, it's just
RUN apt-get install -y libxslt1-dev
Actually, it's just
RUN apt-get install -y libxslt1-dev
answered Nov 21 at 2:23
Pablo Morales
457412
457412
add a comment |
add a comment |
Do as in
https://hub.docker.com/r/ryanfox1985/docker-couchpotato/builds/boinrrs9dbhnutwjxjw2l8m/
Download the apk and install it
RUN wget http://nl.alpinelinux.org/alpine/edge/main/x86_64/py-lxml-3.4.0-r0.apk -O /var/cache/apk/py-lxml.apk
RUN apk add --allow-untrusted /var/cache/apk/py-lxml.apk
5
Just out of curiosity why was this downvoted so hard?
– digitaldavenyc
Dec 30 '16 at 4:19
1
@digitaldavenyc I didn't downvote; however, downloading an unauthenticated package and installing that as part of the build process does sound horrible to me.
– marcelm
Jul 25 at 15:24
add a comment |
Do as in
https://hub.docker.com/r/ryanfox1985/docker-couchpotato/builds/boinrrs9dbhnutwjxjw2l8m/
Download the apk and install it
RUN wget http://nl.alpinelinux.org/alpine/edge/main/x86_64/py-lxml-3.4.0-r0.apk -O /var/cache/apk/py-lxml.apk
RUN apk add --allow-untrusted /var/cache/apk/py-lxml.apk
5
Just out of curiosity why was this downvoted so hard?
– digitaldavenyc
Dec 30 '16 at 4:19
1
@digitaldavenyc I didn't downvote; however, downloading an unauthenticated package and installing that as part of the build process does sound horrible to me.
– marcelm
Jul 25 at 15:24
add a comment |
Do as in
https://hub.docker.com/r/ryanfox1985/docker-couchpotato/builds/boinrrs9dbhnutwjxjw2l8m/
Download the apk and install it
RUN wget http://nl.alpinelinux.org/alpine/edge/main/x86_64/py-lxml-3.4.0-r0.apk -O /var/cache/apk/py-lxml.apk
RUN apk add --allow-untrusted /var/cache/apk/py-lxml.apk
Do as in
https://hub.docker.com/r/ryanfox1985/docker-couchpotato/builds/boinrrs9dbhnutwjxjw2l8m/
Download the apk and install it
RUN wget http://nl.alpinelinux.org/alpine/edge/main/x86_64/py-lxml-3.4.0-r0.apk -O /var/cache/apk/py-lxml.apk
RUN apk add --allow-untrusted /var/cache/apk/py-lxml.apk
answered Mar 11 '16 at 9:52
user2915097
12.6k32839
12.6k32839
5
Just out of curiosity why was this downvoted so hard?
– digitaldavenyc
Dec 30 '16 at 4:19
1
@digitaldavenyc I didn't downvote; however, downloading an unauthenticated package and installing that as part of the build process does sound horrible to me.
– marcelm
Jul 25 at 15:24
add a comment |
5
Just out of curiosity why was this downvoted so hard?
– digitaldavenyc
Dec 30 '16 at 4:19
1
@digitaldavenyc I didn't downvote; however, downloading an unauthenticated package and installing that as part of the build process does sound horrible to me.
– marcelm
Jul 25 at 15:24
5
5
Just out of curiosity why was this downvoted so hard?
– digitaldavenyc
Dec 30 '16 at 4:19
Just out of curiosity why was this downvoted so hard?
– digitaldavenyc
Dec 30 '16 at 4:19
1
1
@digitaldavenyc I didn't downvote; however, downloading an unauthenticated package and installing that as part of the build process does sound horrible to me.
– marcelm
Jul 25 at 15:24
@digitaldavenyc I didn't downvote; however, downloading an unauthenticated package and installing that as part of the build process does sound horrible to me.
– marcelm
Jul 25 at 15:24
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f35931579%2fhow-can-i-install-lxml-in-docker%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
You use alpine, so it may be
apk add
but notapt-get
– user2915097
Mar 11 '16 at 5:06
@user2915097 Thanks! I changed it to
apk add python-dev py-lxml
, it returned the error:error: command 'gcc' failed with exit status 1
. I don't know how to install lxml– thiiiiiking
Mar 11 '16 at 9:20
the package name is correct pkgs.alpinelinux.org/package/main/x86/py-lxml
– user2915097
Mar 11 '16 at 9:24
1
seems to install lxml fine in this Dockerfile pkgs.alpinelinux.org/package/main/x86/py-lxml or hub.docker.com/r/ryanfox1985/docker-couchpotato/builds/… or hub.docker.com/r/trcook/docker-scrapy/builds/…
– user2915097
Mar 11 '16 at 9:26