AttributeError: 'module' object has no attribute 'lru_cache' with python 3.6.4 and Django 2.0.2

894 views
Skip to first unread message

Greng Fortezza

unread,
Feb 14, 2018, 9:17:36 AM2/14/18
to Django users
Hi,

I'm trying to set up the following configuration in Docker
python: 3.6.4
Django: 2.0.2
Apache/2.4.10 (Debian)

First, I was getting the error 

ImportError: No module named django.core.wsgi

Then I added Django to PYTHONPATH

export PYTHONPATH="/usr/local/lib/python3.6/site-packages"

the previous problem has gone away but now there is another one

AttributeError: 'module' object has no attribute 'lru_cache'

Apache configs contains the following line 

WSGIScriptAlias / /www/settings/wsgi.py

where /www/settings/wsgi.py is  actual path to wsgi.py file.

What could be wrong?

Thanks,
Greng

PASCUAL Eric

unread,
Feb 14, 2018, 9:53:10 AM2/14/18
to Django users

Hi,


Normally you shouldn't have to add site-packages in the PYTHONPATH since it is supposed to be already. If not, packages installed via "sudo pip install" would not be found.


I've packaged a lot of applications in Docker containers, and never had to modify PYTHONPATH.


Your problem is maybe be lurking elsewhere than PYTHONPATH, and this change has just created a new one which is hiding the original one, but not solving it at all.


Best


Eric


From: django...@googlegroups.com <django...@googlegroups.com> on behalf of Greng Fortezza <gren...@gmail.com>
Sent: Wednesday, February 14, 2018 3:02:28 PM
To: Django users
Subject: AttributeError: 'module' object has no attribute 'lru_cache' with python 3.6.4 and Django 2.0.2
 
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/02803efb-92a9-4958-9a52-f77bee7de89b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthew Pava

unread,
Feb 14, 2018, 10:07:36 AM2/14/18
to django...@googlegroups.com

I’m not familiar with Docker, but I did have to add the path to Python 3.6 DLLs in my WSGI configuration in my Apache configuration file.

WSGIPythonPath ${project_path};${virtualenv};C:/Python36/DLLs;

PASCUAL Eric

unread,
Feb 14, 2018, 5:38:22 PM2/14/18
to django...@googlegroups.com

Maybe it works like this in Windows (I don't know since having left this world since long now), but Greng mentioned a Debian environment inside his Docker container. Hence my remark.


By the way you mentioned "DLLs". Geng's trouble seems to be related to Python packages finding, not binary libs. In Linux, they are governed by different search paths.


Eric


From: django...@googlegroups.com <django...@googlegroups.com> on behalf of Matthew Pava <Matthe...@iss.com>
Sent: Wednesday, February 14, 2018 4:05:57 PM
To: 'django...@googlegroups.com'
Subject: RE: AttributeError: 'module' object has no attribute 'lru_cache' with python 3.6.4 and Django 2.0.2
 
Reply all
Reply to author
Forward
0 new messages