my gitlab-ci.yml
I install python-pandas but I can't use it from python.
$ cat .gitlab-ci.yml
image: python:2
test:
script:
- apt-get update -qy
- apt-get install -y python-pip python-pandas
- ls /usr/local/lib/python2.7/site-packages
- python -c 'import pandas'
The runner failed with this message::
$ python -c 'import pandas'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named pandas
ERROR: Build failed: exit code 1
I try to not install pandas with pip as requirement (old pandas lib is enought) And very much would like to understand why python packages are not exposed ? this look like an implicit virtualenv !?
If you are a Debian, Ubuntu, or other based distribution and you installed Python through the dpkg packages manager or one of its frontends like apt-get, apt or aptitude, the packages are stored in the /usr/lib/python<version> directory, as shown in the following image where 3.9 must be replaced with your actual Python ...
You should create a virtualvenv in before_script
:
before_script:
- apt-get -qq update && apt-get -qq install -y python
- apt-get -qq update
- apt-get -qq install -y python python-virtualenv python-pip
- virtualenv venv
- . venv/bin/activate
- python -V
- pip install pandas
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With