'Travis-ci installs packages from requirements.txt file automatically
I have Django application based on docker-compose file. Somehow travis autoinstalls packages from requirements.txt in project repo and its failing my build cause I don't have gcc package. I want to run all actions (tests, linters) in docker container not directly in project repo.
Here is my travis-ci.yml file:
---
dist: xenial
services:
- docker
language: python
python:
- "3.7"
script:
- docker compose up --build
- docker exec web flake8
- docker exec web mypy my_project
- docker exec web safety check -r requirements.txt
- docker exec web python -m pytest --cov my_project -vvv -s
And begin of travis log:
$ git checkout -qf bab09dee57a707a5cd0a353d6f50bb66fd90a095
0.01s$ source ~/virtualenv/python3.7/bin/activate
$ python --version
Python 3.7.1
$ pip --version
pip 19.0.3 from /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/pip (python 3.7)
$ pip install -r requirements.txt
...
py_GeoIP.c:23:19: fatal error: GeoIP.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
...
Do you have any idea why travis behaves like this?
Solution 1:[1]
According to https://docs.travis-ci.com/user/languages/python/#dependency-management travisci automatically install requirements.txt dependencies.
To ommit this behaviour I had to add following line to travis.yml to overwrite it:
install: pip --version
Solution 2:[2]
you can also use: install: skip
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | kedod |
Solution 2 | Mario Alvarado |