Re: Further problems with dev environment

29 views
Skip to first unread message

Dominic König

unread,
Mar 25, 2025, 9:48:37 AMMar 25
to eden...@googlegroups.com
Hi Oskar--

yes, of course we can look into that on Thursday.

However, I can reproduce this particular problem locally - inspite of having
installed python-requests from the OS package repository, web2py would not
have it and the UpdateCheck process (which checks dependencies) fails,
resulting in this 500-Error.

Additionally, I've had this problem reported from another developer before, so
this isn't an isolated case. Therefore, I'm moving this to the mailing list
(please reply to the list), as it might be of interest for the wider
community.

---

To identify the cause, you can try the following:

1) Start the web2py shell:
python web2py.py -S admin

2) In the web2py shell, try importing requests:
>>> import requests

If that throws an exception, send me the traceback. If that traceback says
something like this:

"""
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/dominic/work/projects/web2py/gluon/custom_import.py", line 86,
in custom_importer
raise ImportError("No module named %s" % modules_prefix)
ImportError: No module named applications.admin.modules.requests
"""

...then the requests library is not in the import path of the Python
interpreter you're running, which could be down to the PYTHONPATH. To verify
that, check:

>>> import sys
>>> print(sys.path)

...and check if the requests library is somewhere in that path. Otherwise, you
may need to set (or fix) PYTHONPATH explicitly in your virtual environment.

---

In my case, the problem was due to the requests version I installed for the OS
not being compatible with the Python version I'm running. Installing the
requests library via pip for the correct Python version solved the problem.

But since I'm not using a virtual environment, there may be yet another
problem that I can't see.

Dominic

tisdag 25 mars 2025 12:43:30 CET skrev du:
> Hi Dominic,
>
> I hope you're doing well.
>
> I’ve encountered an issue while trying to run Sahana Eden using the command
> provided in the documentation:
>
> python3 web2py.py -S eden -M -R
> applications/eden/static/scripts/tools/noop.py
>
> Although I followed the instructions carefully, I ran into several
> unresolved dependency warnings and eventually a 500 Internal Server Error.
> I’ve attached a screenshot showing the traceback.
>
> [image: image.png]
>
> The strange thing is that the requests library, which seems to be the
> source of the error, is already installed on my system. I installed all the
> required packages via apt, and also tried using a virtual environment
> (venv) with pip, but the same issue occurs in both cases.
signature.asc

Oskar Laubsch

unread,
Mar 27, 2025, 8:30:12 AMMar 27
to Eden ASP
Hello,

I resolved my issue by running the following command:

pip install --no-cache-dir --force-reinstall -t applications/eden/modules requests

This command installs the requests Python package directly into the applications/eden/modules directory. Here's what each part does:

  • --no-cache-dir: Prevents pip from using the local cache, forcing it to download the package again.

  • --force-reinstall: Ensures that the package is reinstalled, even if it already exists.

  • -t applications/eden/modules: Specifies a custom target directory for the installation — in this case, inside the Sahana Eden application's module folder.




Dominic König

unread,
Mar 27, 2025, 9:03:18 AMMar 27
to eden...@googlegroups.com
Hi Oskar--

well, that's not a solution because that's not where the package should be, as
it will interfere with your Git workflow.

But it reveals the actual issue:

The requests-package you installed from the OS packet repository ended up
here:

/usr/lib/python3/dist-packages/requests

However, this location is not in your Python library path, and can therefore
not be imported in Eden. It should be here instead:

/usr/lib/python3/site-packages/requests

or here:

/usr/local/lib/python3/site-packages/requests

...as those locations usually are in the Python library path.

Now, what you can do is either:
1) add the dist-packages location to the PYTHONPATH environment variable,
like:

export PYTHONPATH=/usr/lib/python3/dist-packages

...before starting web2py, or

2) create a symbolic link to that location in the local site-packages, or

3) run that pip -t again, but with the site-packages location as target (not
the Eden modules path), i.e.

pip install --no-cache-dir --force-reinstall -t /usr/local/lib/python3/site-
packages

...while removing it from eden/modules?

---

Do you want to try this and tell us how it worked out?

Dominic
> --
> You received this message because you are subscribed to the Google Groups
> "Eden ASP" group. To unsubscribe from this group and stop receiving emails
> from it, send an email to eden-asp+u...@googlegroups.com. To view
> this discussion visit
> https://groups.google.com/d/msgid/eden-asp/06a2fce9-7387-4c13-8dc1-35bac0d5
> 07a0n%40googlegroups.com.

signature.asc

Oskar Laubsch

unread,
Mar 27, 2025, 10:57:20 AMMar 27
to Eden ASP
Hello,
I used the following command:
sudo pip install --no-cache-dir --force-reinstall -t /usr/local/lib/python3/site-packages requests

And it resolved the issue, of course i deleted package from eden/modules
Reply all
Reply to author
Forward
0 new messages