Kozea / Radicale

A simple CalDAV (calendar) and CardDAV (contact) server.
https://radicale.org
GNU General Public License v3.0
3.36k stars 436 forks source link

No module named radicale #1079

Closed svsk1ng closed 8 months ago

svsk1ng commented 4 years ago

I am trying to run radicale as a service on AWS Ubuntu 18 machine but i get the following error...

Capture

Can anw advice pls?

ghost commented 4 years ago

I think the error message is pretty clear -- python3 is not able to find the radicale module. That is not a bug in radicale, but rather a configuration issue on your side, and as such does not belong in bugtracking.

Nevertheless, some pointers:

1) Can you run radicale outside of the service? e.g python3 -c 'import radicale' does not give the same error message

jkpubsrc commented 3 years ago

I've the same problem. The problem seems to appear if radicale is installed in a local user account (as it should be) via pip.

Everything is correct:

However, if started as a service, apparently the process environment is not initialized the same way as if you are logged in locally. Therefore the python process does not find the radicale packages installed locally. Therefore the error message "No module named radicale"

In my case I'm using a standard Linux Ubuntu installation without any relevant modification, so this problem should exist on quite a lot of systems. The solution should be simple: Provide a suitable environment for python for services. But I've no idea how to do that right now.

jkpubsrc commented 3 years ago

SOLVED

No, sorry, I was wrong. The environment is set up correctly in general, but the service example provided by radicale fails because security parameters get in the way. This is easy to see: If I comment them all out the service starts.

However,I figured out what exactly causes the problem: It's the ProtectHome=true configuration parameter. Please leave everything as specified at https://radicale.org/3.0.html#tutorials/running-as-a-service but specify ProtectHome=read-only instead. Then everything will work.

usersrc commented 3 years ago

Hi there, i have exactly the same problem. I strictly followed the systemd system-wide instructions, however journalctl tells me No module named radicale. Changing ProtectHome from true to read-only did not change anything.

jkpubsrc commented 3 years ago

Then it shouldn't be exactly the same problem ;-)

If systemd tells you that no module named radicale exists, the problem is likely that something is wrong with the installation, for unknown reason. My recommendation: Check if you can at least invoke the radicale process manually. This MUST be the case. Then check if you have a radicale service. This MUST be the case as well. Your error message indicates that most likely the latter of these two issues is the problem.

Update: Please be aware that if you install radicale locally (= as a local user) radicale will not be available as a regular software package to the root user. You have to su to your local user to be able to find "radicale". (And this is what systemd does normally.)

ghost commented 3 years ago

I had the same problem (Ubuntu Server 20.04.2 LTS) but then from the remarks above I realized that I didn't install radicale as root.

My solution is therefore very simple, by adding 'sudo' in the installation command and it becomes:

sudo python3 -m pip install --upgrade radicale

Then it works perfectly.

I think this should be mentioned in the documentation.

Hope that it helps.

usersrc commented 3 years ago

@gsenroc Thx. Works like a charm!

chartre commented 3 years ago

Followed instructions from @gsenroc and, indeed, it solves the issue with the "missing module". But another appears: An exception occurred during server startup: [Errno 30] Read-only file system: '/.var' IMHO Raicale owners should check if the proposed solution is actually a valid one or just a workaround that may not be the recommended one.