Installing CATMAID issue

108 views
Skip to first unread message

John Roche

unread,
Jul 24, 2019, 5:20:25 AM7/24/19
to CATMAID
Hi, 

I’m In the process of installing catmaid but I hit a brick wall since Friday

 

Running the manage script I am getting issues migrating auth

Any help would be great

John

 

 

./manage.py migrate auth


INFO 2019-07-23 14:10:20,065 CATMAID version 2019.06.20-31-g1d04e4ff9

WARNING 2019-07-23 14:10:20,702 NeuroML module could not be loaded.

INFO 2019-07-23 14:10:21,081 History tracking enabled

INFO 2019-07-23 14:10:21,107 Spatial update events disabled

Operations to perform:

  Apply all migrations: auth

Running migrations:

  Applying auth.0010_alter_group_name_max_length...Traceback (most recent call last):

  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/utils.py", line 84, in _execute

    return self.cursor.execute(sql, params)

psycopg2.errors.FeatureNotSupported: cannot alter type of a column used by a view or rule

DETAIL:  rule _RETURN on view auth_group__with_history depends on column "name"

Tom Kazimiers

unread,
Jul 28, 2019, 9:21:30 PM7/28/19
to cat...@googlegroups.com
Hi John,

On Wed, Jul 24, 2019 at 02:20:24AM -0700, John Roche wrote:
>I’m In the process of installing catmaid but I hit a brick wall since
>Friday

I replied to you also separately, but forgot to copy the list. Sorry for
the duplicate email. There is some additional information below though.
I believe you are using the wrong version of Django.

>Running the manage script I am getting issues migrating auth

The problem seems to be related to a schema change of the auth module.
There have been similar changes in the auth package before and I have to
add additional migrations to make this work.

>./manage.py migrate auth
>[…]
>INFO 2019-07-23 14:10:20,065 CATMAID version 2019.06.20-31-g1d04e4ff9
>[…]
> Applying auth.0010_alter_group_name_max_length...Traceback (most
> recent
>call last):
>
> File
>"/usr/local/lib/python3.6/dist-packages/django/db/backends/utils.py", line
>84, in _execute
>
> return self.cursor.execute(sql, params)
>
>psycopg2.errors.FeatureNotSupported: cannot alter type of a column used by
>a view or rule
>
>DETAIL: rule _RETURN on view auth_group__with_history depends on column
>"name"

I see you are running the 'manage.py migrate' command explicitly for the
'auth' module. Generally, you want to run just "./manage.py migrate",
because there is some interdependency between some migration of
different modules. This shouldn't fix the problem above though.

But apart from that, what is surprising to me is that you have the
migration 0010_alter_group_name_max_length of the auth module in the
first place. The last migration I have for the auth package is
0009_alter_user_last_name_max_length.

As far as I can tell, the migration you try to run is not part of Django
2.1 [1], but only of Django 2.2 [2]. CATMAID currently supports only
Django 2.1 and I wonder how you installed CATMAID Python dependencies.
Looking tat the path in the error message to the utils.py file, it looks
like you use a system-wide Django and not the one required by CATMAID in
a virtualenv. Could it be that you either have not setup a virtualenv
or that you haven't activated it?

For both dependency installation (pip install -r requirements.txt) and
migration (./manage.py migrate), you need to have the virtualenv
activated (if you use virtualenvwrapper, this is "workon <env-name>", if
you use virtualenv directly this is "source <env-path>/bin/activate").

As soon as we upgrade to Django 2.2, we will indeed require a migration
that handles the problem you encounter.

Best,
Tom

[2] https://github.com/django/django/tree/stable/2.1.x/django/contrib/auth/migrations
[1] https://github.com/django/django/tree/stable/2.2.x/django/contrib/auth/migrations

John Roche

unread,
Jul 29, 2019, 5:56:26 AM7/29/19
to CATMAID
Hi Tom 

Thank you for the reply back.
I managed to get ./manage.py migrate to work eventually 

right now I'm figuring out nginx installation 
the admin portal looks bleak too
is there something I'm missing?

John

catmaid.PNG

John Roche

unread,
Jul 29, 2019, 5:57:43 AM7/29/19
to CATMAID
I should say that javascript is enabled and i'm using an updated browser 


John


On Wednesday, 24 July 2019 10:20:25 UTC+1, John Roche wrote:

Tom Kazimiers

unread,
Jul 29, 2019, 10:08:41 AM7/29/19
to cat...@googlegroups.com
Hi John,

On Mon, Jul 29, 2019 at 02:57:43AM -0700, John Roche wrote:
>I should say that javascript is enabled and i'm using an updated browser

Okay, that's good to know and needed for CATMAID to work. Currently,
only Chromium, Chrome and Firefox are fully supported.

>Thank you for the reply back.
>I managed to get ./manage.py migrate to work eventually

Great!

>right now I'm figuring out nginx installation
>the admin portal looks bleak too
>is there something I'm missing?

Yes, it looks like static files (which include CSS) can't be loaded.
This can have multiple reasons:

1. Make sure "manage.py collectstatic" has been run successfully. This
will create the static files (JavaScript, CSS) that are needed by the
front-end. The files are created in the folder that is referenced by the
STATIC_ROOT settings variable.

2. The Nginx configuration needs to map the STATIC_URL Django setting (a
relative URL) to the STATIC_ROOT path. This is typically done with an
entry like this:

location /<sub-folder>/static/ {
alias <catmaid-path>/django/static/;
}

Depending on your setup, <sub-folder> might be empty, but like written
above, you basically map STATIC_URL to STATIC_ROOT. When you ran
./create_configuration.py, a valid basic Nginx configuration should have
been printed to the screen that contained this information as well.

Also, make sure that each folder hierarchy of the STATIC_ROOT path has
its execute flag set for the www-data user (or whatever user you run
Nginx with). Nginx needs this to access a folder. You can test this
easily by running

namei -l <STATIC_ROOT>

This should contain an "x" in every row for a user or group (or other)
that works with www-data.

If all this doesn't help, please send the Nginx configuration along with
the "namei" output for your STATIC_ROOT folder.

Cheers,
Tom

John Roche

unread,
Jul 30, 2019, 7:47:14 AM7/30/19
to CATMAID
Hi Tom

got a little further 
I got this far, using port 8000
but looking at the logs below it's looking for folders and files that are not found...

catmaid 2.PNG



[2019/07/30 12:43:12] HTTP GET / 200 [2.17, 10.3.16.247:61030]
Not Found: /home/catmaid/django/static/client/datastores/settings/
[2019/07/30 12:43:13] HTTP GET /home/catmaid/django/static/client/datastores/settings/ 404 [0.08, 10.3.16.247:61030]
Not Found: /home/catmaid/django/static/client/datastores/settings/
[2019/07/30 12:43:13] HTTP GET /home/catmaid/django/static/client/datastores/settings/ 404 [0.08, 10.3.16.247:61030]
Not Found: /home/catmaid/django/static/client/datastores/settings/
[2019/07/30 12:43:13] HTTP GET /home/catmaid/django/static/client/datastores/settings/ 404 [0.04, 10.3.16.247:61030]
Not Found: /home/catmaid/django/static/client/datastores/settings/
[2019/07/30 12:43:13] HTTP GET /home/catmaid/django/static/client/datastores/settings/ 404 [0.08, 10.3.16.247:61030]
Not Found: /home/catmaid/django/static/client/datastores/settings/
[2019/07/30 12:43:13] HTTP GET /home/catmaid/django/static/client/datastores/settings/ 404 [0.05, 10.3.16.247:61030]
Not Found: /home/catmaid/django/static/client/datastores/settings/
[2019/07/30 12:43:13] HTTP GET /home/catmaid/django/static/client/datastores/settings/ 404 [0.04, 10.3.16.247:61030]
Not Found: /home/catmaid/django/static/client/datastores/settings/
[2019/07/30 12:43:14] HTTP GET /home/catmaid/django/static/client/datastores/settings/ 404 [0.04, 10.3.16.247:61030]
Not Found: /home/catmaid/django/static/client/datastores/settings/
[2019/07/30 12:43:14] HTTP GET /home/catmaid/django/static/client/datastores/settings/ 404 [0.06, 10.3.16.247:61030]
Not Found: /home/catmaid/django/static/client/datastores/settings/
[2019/07/30 12:43:14] HTTP GET /home/catmaid/django/static/client/datastores/settings/ 404 [0.06, 10.3.16.247:61030]
Not Found: /home/catmaid/django/static/dataviews/list
[2019/07/30 12:43:14] HTTP GET /home/catmaid/django/static/dataviews/list 404 [0.07, 10.3.16.247:61030]
Not Found: /home/catmaid/django/static/log/error
Not Found: /home/catmaid/django/static/accounts/login
[2019/07/30 12:43:14] HTTP POST /home/catmaid/django/static/log/error 404 [0.07, 10.3.16.247:61030]
[2019/07/30 12:43:14] HTTP GET /home/catmaid/django/static/accounts/login 404 [0.07, 10.3.16.247:61037]
[2019/07/30 12:43:14] WebSocket HANDSHAKING /home/catmaid/django/static/channels/updates/ [10.3.16.247:61039]
[2019/07/30 12:43:14] WebSocket CONNECT /home/catmaid/django/static/channels/updates/ [10.3.16.247:61039]
Not Found: /home/catmaid/django/static/messages/latestunreaddate
[2019/07/30 12:43:14] HTTP GET /home/catmaid/django/static/messages/latestunreaddate 404 [0.07, 10.3.16.247:61037]

On Wednesday, 24 July 2019 10:20:25 UTC+1, John Roche wrote:

John Roche

unread,
Aug 6, 2019, 4:47:02 AM8/6/19
to CATMAID
Can anyone help me with this?

Kind Regards,

John

Tom Kazimiers

unread,
Aug 6, 2019, 9:55:07 AM8/6/19
to cat...@googlegroups.com
Hi John,

On Tue, Jul 30, 2019 at 04:47:14AM -0700, John Roche wrote:
>I got this far, using port 8000

Good to see that the static files are loaded now! How are you running CATMAID
exactly, i.e. what WSGI server are you using (uWSGI, manage.py runserver,
etc.)? It sounds a bit like you are running CATMAID through "manage.py
runserver" for now, which uses port 8000 by default. Note, this isn't suitable
for a production setup. There you want the browser to talk to Nginx on port 80
and have Nginx serve static files and forward all other requests to the WSGI
server running CATMAID [1]. For testing purposes and development, runserver is
totally fine though.

>but looking at the logs below it's looking for folders and files that are
>not found...
>[…]
>[2019/07/30 12:43:12] HTTP GET / 200 [2.17, 10.3.16.247:61030]
>Not Found: /home/catmaid/django/static/client/datastores/settings/
>[2019/07/30 12:43:13] HTTP GET
>[…]

The URLs that CATMAID tries to load look surprisingly more like paths of a
local folder hierarchy. This looks like a configuration error to me. What is
the value of the CATMAID_URL variable in your
django/projects/mysite/settings.py file and would you mind sending the content
of the file django/configuration.py (without database password)?

Best,
Tom

[1] https://catmaid.readthedocs.io/en/stable/nginx.html

John Roche

unread,
Aug 6, 2019, 10:50:37 AM8/6/19
to CATMAID
Hi Tom,

What is 
the value of the CATMAID_URL variable in your django/projects/mysite/settings.py 


/home/catmaid/django/static/

would you mind sending the content of the file django/configuration.py

# Absolute path to the root folder of your CATMAID fork without trailing slash
# e.g. /home/alice/catmaid

abs_catmaid_path = '/home/catmaid'

# Absolute path to the site-packages folder of your virtual Python environment
# without trailing slash
# e.g. /home/alice/.virtualenvs/catmaid/lib/python3.6/site-packages

abs_virtualenv_python_library_path = '/root/.local/lib/python3.6/site-packages'

# CATMAID database configuration - required
catmaid_database_name = '*********'
catmaid_database_username = '***********'
catmaid_database_password = '********'

# CATMAID database configuration - optional
catmaid_database_host = ''
catmaid_database_port = ''

# Writable folder to store automatically generated files that are publicly
# visible, e.g. used by by the NeuroHDF export script and the cropping tool.

catmaid_writable_path = '/home'

# Local time zone for this installation. Choices can be found here:
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
# e.g.: Europe/Zurich

catmaid_timezone = 'Europe/London'

# The domain name (server name) which hosts the CATMAID installation
# without http:// and without a trailing slash or port, e.g.: localhost

catmaid_servername = '10.28.41.235:8000/admin'

# The name of the catmaid subdirectory as seen from the outside
# e.g. for http://localhost/catmaid/ the variable catmaid_subdirectory
# would be 'catmaid'. It should not have a leading or trailing slash.

catmaid_subdirectory = 'catmaid'

Tom Kazimiers

unread,
Aug 7, 2019, 11:59:10 AM8/7/19
to cat...@googlegroups.com
Hi John,

Thanks for sending details on your configuration, they explain the
errors you are seeing: the CATMAID_URL variable should not point to a
folder, but to a potential subdirectory. In your case it should likely
read

CATMAID_URL = '/catmaid/'

This value should have been generated by the create_configuration.py
script (as described in the installation instructions [1]) given your
configuration.py file.

You also seem to have have set the variable "catmaid_servername" in the
file configuration.py to include a port and a path component. In your
case it should be:

catmaid_servername = '10.28.41.235'

I.e. it should not include the port and path.

If you didn't do any other manual changes in the settings.py file, it is
probably best to rerun the create_configuration.py script to write the
settings.py file from scratch. Otherwise, the catmaid_servername change
would be reflected as an entry in the list assigned to the ALLOWED_HOSTS
variable in settings.py. How does your setup behave with the above
changes?

There are also a couple of questions I have:

1. Do you run CATMAID using "manage.py runserver"?
2. Do you run any webserver, e.g. Nginx/Apache/etc. to serve static
files and provide access to CATMAID on port 80?
3. Is the plan to make this a production setup, i.e. should it be usable
by other people?

Let me know if I can improve anything in the documentation to make this
setup easier.

While I am sure we can get your current configuration to work, an alternative
way of setting up CATMAID is to use Docker, which does all the configuration
for you. If you want to try this, I'd suggest to try the Docker-Compose setup
described in the documentation [2]. This makes tuning and more specific
configuration slightly harder, but the initial setup is much easier.

Best,
Tom

[1] https://catmaid.readthedocs.io/en/latest/installation.html#create-the-django-settings-files
[2] https://catmaid.readthedocs.io/en/latest/docker.html#persistence-with-docker-compose
>--
>You received this message because you are subscribed to the Google Groups "CATMAID" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to catmaid+u...@googlegroups.com.
>To view this discussion on the web visit https://groups.google.com/d/msgid/catmaid/61476996-97c9-45cc-826e-d3186af00d20%40googlegroups.com.

John Roche

unread,
Aug 7, 2019, 12:25:48 PM8/7/19
to CATMAID
Hi Tom

this helped :)
some of the images are missing though..
1. Do you run CATMAID using "manage.py runserver"? 
Right now yes, I do want to fix this

2. Do you run any webserver, e.g. Nginx/Apache/etc. to serve static 
files and provide access to CATMAID on port 80? 
i am using Nginx.

my config for catmaid is 

 include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;

        upstream catmaid-wsgi {
        server 10.28.41.235:8000;
        }

        server {
          listen 80;
          server_name 10.28.41.235;

          # Give access to Django's static files
          location /catmaid/static/ {
          alias /home/catmaid/django/static/;
          }

         location /catmaid/ {
         proxy_pass http://catmaid-wsgi/;
         proxy_redirect http://catmaid-wsgi/ http://$host/;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;



3. Is the plan to make this a production setup, i.e. should it be usable 
by other people? 


yes, eventually, right now it's a proof of concept.

Regards.

John

catmaid 3.PNG

>To unsubscribe from this group and stop receiving emails from it, send an email to cat...@googlegroups.com.

John Roche

unread,
Aug 22, 2019, 11:45:48 AM8/22/19
to CATMAID
Hi Tom

what is the best way to import files over 
also I'm not 100% sure if I have nginx and the wsgi configured properly...

John

John Roche

unread,
Aug 22, 2019, 11:50:51 AM8/22/19
to CATMAID
this is my catmaid-uwsgi.ini file, what's the correct dir for socket?

root@catmaid:/home/catmaid/django/projects/mysite# cat catmaid-uwsgi.ini
; uWSGI instance configuration for CATMAID
[uwsgi]
virtualenv = /root/.virtualenvs/catmaid/
chdir = /home/catmaid/django/
socket = /run/uwsgi/app/catmaid/socket
mount = /catmaid=/home/catmaid/django/projects/mysite/django.wsgi
manage-script-name = true
workers = 2
threads = 2
disable-logging = true

Tom Kazimiers

unread,
Aug 24, 2019, 3:47:58 PM8/24/19
to cat...@googlegroups.com
Hi John,

On Thu, Aug 22, 2019 at 08:50:50AM -0700, John Roche wrote:
>this is my catmaid-uwsgi.ini file, what's the correct dir for socket?

On a production system this would likely be somewhere under /run,
because this is typically a tempfs file system, which lives only in
memory. Often times individual tools, like uwsgi, would have their own
folder, which are typically created by the init/service scripts for the
each tool (I think).

Depending on how you run CATMAID, it might be useful though to see
socket and PID files for the relevant components in one location, e.g.
/run/catmaid/. Especially if you also run Celery, Celery Beat, Cache
update worker processes, etc. it is sometimes useful to have all sockets
in one place.

Because /run is not a persistente folder, you want to use a folder like
/run/catmaid/ (or /run/uwsgi/… if you aren't using the regular uwsgi
service, but e.g. supervisord) make sure this folder exists after a
reboot by adding snippets like this to /etc/rc.local, which is executed
on startup:

if [ ! -d /run/catmaid ]; then
mkdir /run/catmaid/
chown www-data:www-data /run/catmaid/
chmod 0755 /run/catmaid/
fi

This assumes you are running all the processes as www-data user.

>root@catmaid:/home/catmaid/django/projects/mysite# cat catmaid-uwsgi.ini
>; uWSGI instance configuration for CATMAID
>[uwsgi]
>virtualenv = /root/.virtualenvs/catmaid/
>chdir = /home/catmaid/django/
>socket = /run/uwsgi/app/catmaid/socket
>mount = /catmaid=/home/catmaid/django/projects/mysite/django.wsgi
>manage-script-name = true
>workers = 2
>threads = 2
>disable-logging = true

In this case the socket file is stored /run/uwsgi/app/catmaid and if you
run uwsgi e.g. through supervisord, you'd need to take care of having
the folder /run/uwsgi/app/catmaid available, by adding sth. like this to
the /etc/rc.local file and excute it as well on a root shell.

if [ ! -d /run/uwsgi/app/catmaid ]; then
mkdir -p /run/uwsgi/app/catmaid
chown -R www-data:www-data /run/uwsgi/
chmod -R 0755 /run/uwsgi/
fi

And I should also updaet the examle uwsgi configuration at some point.
I found myself running uwsgi often also with these settings:

# CATMAID in started in lazy-apps mode, i.e. each worker has a full
# copy of the code in memory. Workers are managed by a master process
# (no emperor).
master = true
lazy-apps = true

# During deploy, old and new master share the same socket. With
# vacuum=true, old master would delete it during shutdown.
vacuum = false

What is also very useful I found is to enable a statistics socket, that
can be used with the extra tool uwsgitop (pip install -U uwsgitop):

# Stats
stats = %(socket-dir)/uwsgi-stats.socket
memory-report = true

>On Thursday, 22 August 2019 16:45:48 UTC+1, John Roche wrote:
>> what is the best way to import files over

What do you mean exactly? I typically would set up stacks and stack
mirrors manually, but the /admin UI has also an importer than can setup
most things for you, if you provide a YAML file. The documentation has
more information here [1].

>> also I'm not 100% sure if I have nginx and the wsgi configured properly...

Uwsgi is very flexible and can be complex to setup, I believe your basic
configuration is ok as long as you make sure the socket directories
exist. The log file is typically helpful if you run into problems. As
written below, the Nginx config looks fine in general.

>> On Wednesday, 7 August 2019 17:25:48 UTC+1, John Roche wrote:
>>> this helped :)

Great!

>>> some of the images are missing though..

The missing image on the front page is probably because you didn't
generate the thumbnail pictures "small.<file-extension>", which is used
there by default. I realize though that the documentation doesn't say
anything about this, but I added a GitHub issue here [2]:

>>> 1. Do you run CATMAID using "manage.py runserver"?
>>> Right now yes, I do want to fix this

Okay, like the documentation suggests, we have most experience running
CATMAID using uWSGI and are pretty happy with it.

>>> 2. Do you run any webserver, e.g. Nginx/Apache/etc. to serve static
>>> files and provide access to CATMAID on port 80?
>>> i am using Nginx.

Okay.

>>> my config for catmaid is
>>>
>>> include /etc/nginx/conf.d/*.conf;
>>> include /etc/nginx/sites-enabled/*;
>>>
>>> upstream catmaid-wsgi {
>>> server 10.28.41.235:8000;
>>> }
>>>
>>> server {
>>> listen 80;
>>> server_name 10.28.41.235;
>>>
>>> # Give access to Django's static files
>>> location /catmaid/static/ {
>>> alias /home/catmaid/django/static/;
>>> }
>>>
>>> location /catmaid/ {
>>> proxy_pass http://catmaid-wsgi/;
>>> proxy_redirect http://catmaid-wsgi/ http://$host/;
>>> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>>> proxy_set_header X-Forwarded-Proto $scheme;

This looks okay in general and should work both with runserver and
uWSGI. If you are using uWSGI though, you can also pass the request
directly to it, rather than using `proxy_pass`, to be slightly more
efficient and use less text:

location /catmaid/ {
include uwsgi_params;
uwsgi_pass unix:///run/uwsgi/app/catmaid/socket;
}

The documentation mentions this on its Production Setup page [3].

Cheers,
Tom

[1] https://catmaid.readthedocs.io/en/stable/importing_data.html#importing-project-and-stack-information
[2] https://github.com/catmaid/CATMAID/issues/1916
[3] https://catmaid.readthedocs.io/en/stable/nginx.html#setup-based-on-nginx-and-uwsgi

John Roche

unread,
Sep 12, 2019, 6:50:06 AM9/12/19
to CATMAID
Hi tom
have you seen this issue before?

John

uwsgi --uid www-data /home/catmaid/django/projects/mysite/catmaid-uwsgi.ini
[uWSGI] getting INI configuration from /home/catmaid/django/projects/mysite/catmaid-uwsgi.ini
*** Starting uWSGI 2.0.18 (64bit) on [Thu Sep 12 10:48:23 2019] ***
compiled with version: 7.4.0 on 19 July 2019 09:23:26
os: Linux-4.15.0-62-generic #69-Ubuntu SMP Wed Sep 4 20:55:53 UTC 2019
nodename: catmaid
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /root
detected binary path: /usr/local/bin/uwsgi
setuid() to 33
chdir() to /home/catmaid/django/
your processes number limit is 128421
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 /run/uwsgi/app/catmaid/socket fd 3
Python version: 3.6.8 (default, May  7 2019, 14:58:50)  [GCC 8.3.0]
!!! Python Home is not a directory: /root/.virtualenvs/catmaid/ !!!
Set PythonHome to /root/.virtualenvs/catmaid/
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f0a3621c740 (most recent call first):
Aborted (core dumped)


On Wednesday, 24 July 2019 10:20:25 UTC+1, John Roche wrote:

Tom Kazimiers

unread,
Sep 15, 2019, 9:36:39 PM9/15/19
to cat...@googlegroups.com
Hi John,

On Thu, Sep 12, 2019 at 03:50:06AM -0700, John Roche wrote:
>have you seen this issue before?
>
> [uwsgi log]
>Python version: 3.6.8 (default, May 7 2019, 14:58:50) [GCC 8.3.0]

I haven't seen this before, but it looks fine until after here.

>!!! Python Home is not a directory: /root/.virtualenvs/catmaid/ !!!

it looks like a problem. The uWSGI program you run (CATMAID) needs to be
started in its virtualenv and it don't seem to be able to load it. How
does your uwsgi config look like at the moment?

Also, this was apparently the original uwsgi call:

>uwsgi --uid www-data /home/catmaid/django/projects/mysite/catmaid-uwsgi.ini

It looks like you use the uwsgi installed through the operating system. If this
is the case, it is likely easier to have uwsgi installed in the virtualenv and
call this directly from your process manager (e.g. systemd or supervisord).

You seem to have CATMAID installed here:

>/home/catmaid/django/projects/mysite/catmaid-uwsgi.ini

I assume you use virtualenvwrapper (because of the .virtualenvs folder
reference above) and once you `pip install uwsgi` within the virtualenv,
you can run it like this from your process manager:

/home/catmaid/.virtualenvs/catmaid/bin/uwsgi --uid www-data /home/catmaid/…

This should load already all of CATMAID in the virtualenv. If this uwsgi path
doesn't work in the virtualenv, you might need to use a different path (see
which one with `which uwsgi` when in virtualenv).

If you are sure you use already a uwsgi installation from inside the
virtualenv, I'd be curious how you supervisord or systemd config looks like.

>Set PythonHome to /root/.virtualenvs/catmaid/
>Fatal Python error: Py_Initialize: Unable to get the locale encoding
>ModuleNotFoundError: No module named 'encodings'
>
>Current thread 0x00007f0a3621c740 (most recent call first):
>Aborted (core dumped)

I would assume for now these are consequences from not being able to
load the virtualenv and setting the PyHome environment variable to
something non-existent (possibly due to trying to load
~/.virtualenvs/catmaid somewhere rather than an absolute path). Let's
make sure the first error above goes away first.

Cheers,
Tom

John Roche

unread,
Sep 16, 2019, 12:20:44 PM9/16/19
to CATMAID
Hi Tom

changed around some stuff in the config files 

get this error when running  uwsgi --uid www-data /home/catmaid/django/projects/mysite/catmaid-uwsgi.ini
I changed the owership of the 
  mkdir -p /run/uwsgi/app/catmaid
    chown -R www-data:www-data /run/uwsgi/
    chmod -R 0755 /run/uwsgi/




spawned uWSGI worker 1 (pid: 3177, cores: 2)
spawned uWSGI worker 2 (pid: 3178, cores: 2)
bind(): No such file or directory [core/socket.c line 230]
...brutally killing workers...

Tom Kazimiers

unread,
Sep 27, 2019, 12:06:16 PM9/27/19
to cat...@googlegroups.com
Hi John,

On Mon, Sep 16, 2019 at 09:20:43AM -0700, John Roche wrote:
>changed around some stuff in the config files

Could you set it up so that you use the uwsgi intalled in the
virtualenv? Like explained in my last mail in this thread you would
probably want to run it similar to this:

/home/catmaid/.virtualenvs/catmaid/bin/uwsgi /home/catmaid/django/projects/mysite/catmaid-uwsgi.ini

This has the benefit that it sets up the virtualenv for the rest of CATMAID
already.

You can specify the user the process runs under also directly in the
catmaid-uwsgi.ini file:

uid = www-data

>get this error when running uwsgi --uid www-data
>/home/catmaid/django/projects/mysite/catmaid-uwsgi.ini
>I changed the owership of the
> mkdir -p /run/uwsgi/app/catmaid
> chown -R www-data:www-data /run/uwsgi/
> chmod -R 0755 /run/uwsgi/

These permissions should work in principle.

>spawned uWSGI worker 1 (pid: 3177, cores: 2)
>spawned uWSGI worker 2 (pid: 3178, cores: 2)
>bind(): No such file or directory [core/socket.c line 230]
>...brutally killing workers...

Do you still run into this? If so, what is the `socket` field set to in
your catmaid-uwsgi.ini? I would assume it points to a socket file in
/run/uwsgi/app/catmaid?

If this seems all correct, you could maybe try to run uwsgi entirely as
www-data. To test, you could do e.g.:

sudo su www-data uwsgi /home/catmaid/django/projects/mysite/catmaid-uwsgi.ini

In case you can't get this to work all, an alternative is also to not
use socket files, but HTTP. If you want to try this and revisit the
socket based setup later, you could replace the `socket` field in your
catmaid-uwsgi.ini with something like this:

http = 127.0.0.1:8080

This would however also require a change in your Nginx configuration
like explained here:

https://catmaid.readthedocs.io/en/stable/nginx.html#nginx-configuration

Generally though, the socket based setup is preferable.

Best,
Tom
Reply all
Reply to author
Forward
0 new messages