English 中文(简体)
Gitlab管道没有安装管道
原标题:Gitlab pipeline does not have pip installed
I have a gitlab pipeline split in two jobs but unfortunately the second job complains /bin/sh: eval: pip: not found. Below is the .gitlab-ci.yml file. stages: - build - test default: image: docker:24.0 build_image: stage: build script: - docker build . test: stage: test script: - pip install .[dev] - pytest The build_image job is doing a build on my Dockerfile but despite that the next job does not find pip. The contents of the Dockerfile looks as follows: FROM python:3.12-slim WORKDIR /usr/src/template_repository COPY ./requirements.txt . RUN apt-get update RUN pip install --upgrade pip RUN pip install -r requirements.txt How can I get the test job to find pip and install all the requirements?
问题回答
This means that the base image you are using for running your jobs (the docker image) does not have pip installed. To use a different image in the test job, you should use the image directive, for example: test: stage: test image: python:3.12-slim script: - pip install .[dev] - pytest I don t know what you are doing, but I think you are confusing concepts, as far as I know, it is not possible/good practice to build an image and use it as a base for the next job. You could try to build an image, push it to the gitlab registry, and then use it in your jobs.




相关问题
Pip instalation for Python 3.11 in docker

I have Dockerfile to build image for Django project that uses Python 3.11 and runs in poetry environment (see content below). Problem is when I try to donwload get-pip.py file and run it using Python, ...

Python: "no module named pip"

I use Windows 7 32 bit and Python 3.7. I was trying to install a module with pip and this error came up: cd C:WindowsSystem32 pip install pyttsx3 Output: Traceback (most recent call last): File &...

ImportError: No module named pip

OS: Mac OS X 10.7.5 Python Ver: 2.7.5 I have installed setuptools 1.0 with ez_setup.py from https://pypi.python.org/pypi/setuptools Then I download pip.1.4.1 pkg from https://pypi.python.org/pypi/...

Pip + WSGI import errors

when i deploy my apps that worked fine using the django test server I usually get errors for every package I installed using pip install -e ....#egg=foo. I usually do this using virtualenv, which ...

热门标签