Preprended python path in embed env/ Path trouble
raisou opened this issue · comments
Hello,
I'm using dh-virtualenv (version 0.11.1) from months to build my django app in a deb that install 3 differents systemd services. (Env Ubuntu Xenial)
This was running fine until recently. I started getting errors like
/usr/lib/app/bin/gunicorn: 2: exec: /home/user/project/app/debian/app/usr/lib/app/bin/python
.
Actually my gunicorn and others bin in virtualenv are preprended by an unexpected line and i can't figure why.
Example for gunicorn
#!/bin/sh '''exec' /home/user/project/app/debian/app/usr/lib/app/bin/python "$0" "$@" ' '''
In previous deb this part was totally absent. And if i remove it, it looks ok.
Moreover i noticed in the same time, some new lines when adding these files.
Example:
The scripts gunicorn and gunicorn_paster are installed in '/home/user/project/app/debian/app/usr/lib/app/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
My debian/rules.
`
#!/usr/bin/make -f
export DH_VERBOSE=1
export DH_VIRTUALENV_INSTALL_ROOT=/usr/lib/
DH_VENV_ARGS=--with python-virtualenv,systemd
VERSION=$(shell python setup.py --version)
SDIST_DIR=debian/app-$(VERSION)
clean:
test ! -d dist || rm -rf dist
test ! debian/app/ || rm -rf debian/app/
test ! -d
dh $@ $(DH_VENV_ARGS)
build-arch:
python3 setup.py sdist --formats tar
mkdir -p $(SDIST_DIR)
tar -x -C $(SDIST_DIR) --strip-components=1 --exclude '.egg-info' -f dist/.tar
dh
%:
dh
override_dh_installdirs:
# some cp files
dh_installdirs
override_dh_virtualenv:
dh_virtualenv --no-test --python /usr/bin/python3.6
override_dh_installinit:
dh_installinit --name=app
dh_installinit --name=app_celery_global
dh_installinit --name=app_celery_indexation
override_dh_systemd_enable:
dh_systemd_enable --name=app
dh_systemd_enable --name=app_celery_global
dh_systemd_enable --name=app_celery_indexation
override_dh_strip:
dh_strip --exclude=lxml --exclude=_cffi_backend --exclude=PIL
override_dh_shlibdeps:
dh_shlibdeps --exclude=lxml --exclude=_cffi_backend --exclude=PIL
`
My requirements.txt:
Django==1.11.10 PyYAML==3.12 psycopg2==2.7.4 lxml==4.1.1 celery==4.1.0 paramiko==2.4.0 raven==6.6.0 gunicorn==19.7.1 msgpack-python==0.5.5 elasticsearch==5.5.0 argon2-cffi==18.1.0 pylibmc==1.5.2 Pillow==5.0.0 pytz==2018.3 python-dateutil==2.6.1 django-storage-swift==1.2.18 django-webpack-loader==0.6.0 django-dotenv==1.4.2 django-ipware==2.0.1 django-recaptcha==1.4.0 ua-parser==0.7.3 Wand==0.4.4 https://github.com/raisou/sickle/archive/master.zip PyJWT==1.6.0
I'll update if i find why but i'm quite stuck right now.
Thank you for your time.
The first thing you should try is using v1.0+ – 0.11 is quite old.
See https://github.com/1and1/debianized-sentry for a working Django app / systemd package (uWSGI though).
Just tried to use v1.0-1 and the results looks the same.
Anyway thank you for your answer , i will take an attentive look to your build.
It looks like my bug is related to this one pypa/virtualenv#1157
I'm able to build without these warning and unexpected codes.
I validate that tomorrow.
Thanks
I ended doing
dh_virtualenv --no-test --python /usr/bin/python3.6 --preinstall "pip==9.0.3"
Which remove unexpected beta pip version bring at virtualenv initialisation.
Problem solved. Thank you for your time.