Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: No module named 'radicale #725

Closed
Lokotito opened this issue Oct 15, 2017 · 3 comments
Closed

ImportError: No module named 'radicale #725

Lokotito opened this issue Oct 15, 2017 · 3 comments

Comments

@Lokotito
Copy link

Lokotito commented Oct 15, 2017

Hi,
I'm trying to setup a radicale service behind apache2 in debian Strech 9.0.1. But have a problem that I can't solve.
Installing via phyton3 pip. Using the radicale.wsgi form archive Kozea-Radicale-2.1.8-0-g4176ef4.tar.gz in radicale page.

My radicale configurations (Place it into /etc/radicale/config (global)) are:

[server]
hosts = 0.0.0.0:5232

[encoding]
request = utf-8
stock = utf-8

[auth]

[rights]

[storage]
type = multifilesystem
filesystem_folder = /MY_PATH/

[web]

[logging]

[headers]

My apache2 radicale,conf are:

<IfModule mod_ssl.c>
   <VirtualHost *:5232>
       ServerName MyServer

       WSGIDaemonProcess radicale user=www-data group=www-data threads=1
       WSGIScriptAlias / /etc/apache2/radicale.wsgi

       <Directory /MY_PATH>
           WSGIProcessGroup radicale
           WSGIApplicationGroup %{GLOBAL}
           AllowOverride None
           Require all granted
           Options -Indexes
       </Directory>

       <Location />
           AuthType Basic
           AuthName "Calendar Auth"
           AuthBasicProvider file
           AuthUserFile /PATHS/.secrets
           Require valid-user
       </Location>

       # ssl stuff
       SSLEngine on
       SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
       SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

   </VirtualHost>
</IfModule>

But when I log via web broswer to test have an error in apache log:

mod_wsgi (pid=2082): Target WSGI script '/etc/apache2/radicale.wsgi' cannot be loaded as Python module.
mod_wsgi (pid=2082): Exception occurred processing WSGI script '/etc/apache2/radicale.wsgi'.
File "/etc/apache2/radicale.wsgi", line 25, in
from radicale import Application, config, log
ImportError: No module named 'radicale

And a 500 Internal Server Error apears in webbrowser.

Checked in python3 console and radicle is there, also using libapache2-mod-wsgi-py3 (unistall previous libapache2-mod-wsgi).
Will apreciate some help. Thank you.

@Unrud
Copy link
Collaborator

Unrud commented Oct 15, 2017

Checked in python3 console and radicle is there

Are you using SELinux? Maybe it's blocking access to the Radicale package. (pip doesn't set the SELinux context, when it installs packages.) Did you get any warning messages?

Maybe access to the Radicale packages is blocked by some other security measure.

My radicale configurations (Place it into /etc/radicale/config (global)) are:

You still have to specify the config path in the RADICALE_CONFIG environment variable. Unfortunately this is not directly supported by Apache.
On Debian you can put something like export RADICALE_CONFIG=/etc/radicale/config in the file /etc/apache2/envvars.
Otherwise, you can change line 28 of radicale.wsgi to something like

config_paths = ["/etc/radicale/config"]

@Lokotito
Copy link
Author

Lokotito commented Oct 16, 2017

Thank you for your answer, at the beging setup I configure the envvars in apache (at the end) like this:
export RADICALE_CONFIG=/etc/radicale/config
Also change UTF-8 in same file: export LANG=C.UTF-8. and included config_paths = ["/etc/radicale/config"] in radicale.wsgi, none of this works, same error.

But uninstalling radicale via python3 pip, and re-installing with SUDO python3 pip comand made the difference (not sure if run as root before).
Now I don't have any error in apache log and can access via web-browser.

Well now after exporting to VCF file my android contacts, later delete all local contacts or other carddav service, and later importing to Radicale service... al contacts are in place. 👍

Well hope my configs can be useful to any noob like me in linux, really can't find guides or info updated to configure this conbination of radicale+apache.

B.R.

@tillydray
Copy link

But uninstalling radicale via python3 pip, and re-installing with SUDO python3 pip comand made the difference (not sure if run as root before).

This did the trick for me. I was having the same issue where radicale would start, status would be good for a second or two, then it would error out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants