2

I'm using pipenv in my local development and integrating Gitlab CI/CD to deploy and testing.

I do not want to generated requirements.py file every time I install a new package. Therefore I want to use pipenv with Gitlab runner too.

My gitlab-ci.yml file contains

stages:
  - test
  - deploy

test:
  stage: test
  script:
  - apt-get update -qy
  - apt-get install -y ruby-dev
  - apt-get install -y python-dev python-pip
  - pip install pipenv
  - pipenv install
  - pipenv run py.test src/


...

But pipeline is failing with error

$ pipenv install
Warning: the environment variable LANG is not set!
We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.
Warning: Python 3.6 was not found on your system…
You can specify specific versions of Python with:
  $ pipenv --python path/to/python
/usr/local/lib/python2.7/dist-packages/pipenv/_compat.py:86: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/pipenv-fmGiYD-requirements'>
  warnings.warn(warn_message, ResourceWarning)

I even tried with --python 3.6 flag but same error.

My Pipfile contents are

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
django = "*"
...
pytest = "*"
pytest-django = "*"
pytest-cov = "*"
pdbpp = "*"
mixer = "*"

[dev-packages]

[requires]
python_version = "3.6"

Update 2

replacing python-dev python-pip with python3-dev python3-pip is installing python version 3.5 and while running the command pipenv install giving following error

RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult http://click.pocoo.org/python3/for mitigation steps.

This system supports the C.UTF-8 locale which is recommended.
You might be able to resolve your issue by exporting the
following environment variables:

export LC_ALL=C.UTF-8
export LANG=C.UTF-8
ERROR: Job failed: exit code 1

1 Answer 1

1

To add environment variables to your gitlab-ci.yml file: https://docs.gitlab.com/ce/ci/variables/#gitlab-ci-yml-defined-variables

Also use a python docker image instead of installing python: https://docs.gitlab.com/ce/ci/docker/using_docker_images.html#define-image-and-services-from-gitlab-ci-yml

image: python:3.6
test:
    stage: test
    variables:
        LC_ALL=C.UTF-8
        LANG=C.UTF-8
Sign up to request clarification or add additional context in comments.

12 Comments

I replaced python-dev python-pip with python3-dev python3-pip but now it is giving error. I have updated question with error.
did you try adding the environment variables as the error message suggests?
also if you really need 3.6 'apt-get install python3.6'
Yes, I tried adding but not as variables instead added as a command. That error was gone but still Warning: Python 3.6 was not found on your system… error
apt install 3.6 explicitly
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.