From mboxrd@z Thu Jan 1 00:00:00 1970 From: Myles English Subject: uwsgi and Pyramid Date: Tue, 21 Jun 2016 00:16:04 +0100 Message-ID: <8760t3pi2z.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF8QS-0004ZR-Py for help-guix@gnu.org; Mon, 20 Jun 2016 19:16:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bF8QO-0006qu-LD for help-guix@gnu.org; Mon, 20 Jun 2016 19:16:15 -0400 Received: from mail-lb0-x229.google.com ([2a00:1450:4010:c04::229]:33838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF8QO-0006qq-8L for help-guix@gnu.org; Mon, 20 Jun 2016 19:16:12 -0400 Received: by mail-lb0-x229.google.com with SMTP id oe3so2677189lbb.1 for ; Mon, 20 Jun 2016 16:16:11 -0700 (PDT) Received: from localhost (193.6.115.87.dyn.plus.net. [87.115.6.193]) by smtp.googlemail.com with ESMTPSA id p6sm8299151wme.22.2016.06.20.16.16.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jun 2016 16:16:10 -0700 (PDT) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: help-guix Hello, I have defined some packages to install Pyramid (a Python web framework) here: https://gist.github.com/mylese/861b4765e9f533bafa2cb2b305974caa Now I am trying to get my python app (my_app), served by uwsgi but get the infamous "no app loaded" error from uwsgi: $ /gnu/store/y83n9b6zl76pq1v7qb0npl7p7gd0hgd7-profile/bin/uwsgi --need-app --ini production.ini [uWSGI] getting INI configuration from production.ini *** Starting uWSGI 2.0.12 (64bit) on [Mon Jun 20 22:45:02 2016] *** compiled with version: 4.9.3 on 20 June 2016 21:04:07 os: Linux-4.5.4-1-ARCH #1 SMP PREEMPT Wed May 11 22:21:28 CEST 2016 nodename: bill machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 2 current working directory: /home/myles/srv/my_app detected binary path: /gnu/store/q3s2v62vqp288pfkswggcxjxfx1qii38-uwsgi-dev-2.0.12/bin/uwsgi your processes number limit is 15779 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uwsgi socket 0 bound to UNIX address /tmp/uwsgi-my_app.sock fd 3 Python version: 3.4.3 (default, Jan 1 1970, 00:00:01) [GCC 4.9.3] *** Python threads support is disabled. You can enable it with --enable-threads *** Python main interpreter initialized at 0x16487d0 your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds mapped 145536 bytes (142 KB) for 1 cores *** Operational MODE: single process *** *** no app loaded. GAME OVER *** If started with strace it gives slightly more info, it seems to be looking for /home/myles/srv/my_app/uwsgi, but why?: $ strace /gnu/store/y83n9b6zl76pq1v7qb0npl7p7gd0hgd7-profile/bin/uwsgi --need-app --ini production.ini write(2, "*** Operational MODE: single pro"..., 41*** Operational MODE: single process *** ) = 41 readlink("uwsgi", 0x7ffc5954be10, 4096) = -1 ENOENT (No such file or directory) getcwd("/home/myles/srv/my_app", 4096) = 25 lstat("/home/myles/srv/my_app/uwsgi", 0x7ffc5954bd30) = -1 ENOENT (No such file or directory) fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 3), ...}) = 0 fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 3), ...}) = 0 ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0 fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 3), ...}) = 0 lseek(2, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0 lseek(2, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) write(2, "*** no app loaded. GAME OVER ***"..., 33*** no app loaded. GAME OVER *** ) = 33 exit_group(22) = ? +++ exited with 22 +++ I have been trying the above commands from an environment started like this: $ guix environment --ad-hoc my_app Where my_site.scm is: (define-module (my-local-packages mysite) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix build-system python) #:use-module (guix licenses) #:use-module (gnu packages python) #:use-module (gnu packages web) #:use-module (my-packages python-pyramid)) (define-public my_app (package (name "my_app") (version "0.0.1") (source (origin (method url-fetch) (uri (string-append "file:///home/myles/srv/my_app/dist/my_app-" version ".tar.gz")) (sha256 (base32 "0sfyk45qgl51gi0cq5idg07zgb8qq1bn7pf9pxj8na0hyw9k6by3")))) (build-system python-build-system) (inputs `(("python-setuptools" ,python-setuptools) ("python-pyramid" ,python-pyramid) ("python-pyramid-mako" ,python-pyramid-mako) ("python-pyramid-chameleon" ,python-pyramid-chameleon) ("python-pygments" ,python-pygments) ("python-pyramid-debugtoolbar" ,python-pyramid-debugtoolbar))) (propagated-inputs `(("uwsgi" ,uwsgi "python") ("uwsgi" ,uwsgi "out") ("python" ,python))) (arguments `(#:tests? #f)) ;; ImportError: cannot import name 'my_view' (home-page "http://my_app.com") (synopsis "Development of my site") (description "Development of my site") (license expat))) The above installs my_site from a Python tarball distribution made like this: my_app$ python3 setup.py sdist In setup.py in the list "install_requires", if I add 'uwsgi' it gives this error upon running the above "guix environment" command: Adding my_app 0.0.1 to easy-install.pth file Installed /gnu/store/bc38r7nrn4p20fpvb1p9v8w9zgqplpqf-my_app-0.0.1/lib/python3.4/site-packages/my_app-0.0.1-py3.4.egg Processing dependencies for my_app==0.0.1 Searching foAdding my_app 0.0.1 to easy-install.pth file Installed /gnu/store/bc38r7nrn4p20fpvb1p9v8w9zgqplpqf-my_app-0.0.1/lib/python3.4/site-packages/my_app-0.0.1-py3.4.egg Processing dependencies for my_app==0.0.1 Searching for uwsgi Reading https://pypi.python.org/simple/uwsgi/ Download error on https://pypi.python.org/simple/uwsgi/: [Errno -2] Name or service not known -- Some packages may not be found! Couldn't find index page for 'uwsgi' (maybe misspelled?) Scanning index of all packages (this may take a while) Reading https://pypi.python.org/simple/ Download error on https://pypi.python.org/simple/: [Errno -2] Name or service not known -- Some packages may not be found! No local packages or download links found for uwsgi error: Could not find suitable distribution for Requirement.parse('uwsgi') phase `install' failed after 2.9 seconds builder for `/gnu/store/cb22aarjscjl7bfq0lw72hirs2cx1yir-my_app-0.0.1.drv' failed with exit code 1 guix environment: error: build failed: build of `/gnu/store/cb22aarjscjl7bfq0lw72hirs2cx1yir-my_app-0.0.1.drv' failed guix environment --ad-hoc my_app 6.83s user 0.55s system 40% cpu 18.375 total Does anybody use uwsgi to serve a Python app successfully? Do I need to add 'uwsgi' to my setup.py? Why can't uwsgi find my app? What else can I try? Thanks, Myles