Target WSGI script '/usr/share/archivematica/dashboard/apache/django.wsgi' cannot be loaded as Python module.

423 views
Skip to first unread message

Pawel

unread,
Nov 17, 2015, 12:46:23 PM11/17/15
to archivematica
Hello,

I have been asked to install Archivematica as a local testing environment. I did that with the latest Archivematica 1.4 on fresh Ubuntu 14.04.3 desktop version. The Storage Service works but instead of Dashboard I'm getting Internal Server Error.

I suspect the problem must be with django or/and user permissions but after trying to change these it still doesn't work. I used user:archivematicadashboard and group:archivematica.

Here's Apache error log:

[Tue Nov 17 15:37:36.989663 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476] mod_wsgi (pid=6007): Target WSGI script '/usr/share/archivematica/dashboard/apache/django.wsgi' cannot be loaded as Python module.
[Tue Nov 17 15:37:36.989752 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476] mod_wsgi (pid=6007): Exception occurred processing WSGI script '/usr/share/archivematica/dashboard/apache/django.wsgi'.
[Tue Nov 17 15:37:36.989786 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476] Traceback (most recent call last):
[Tue Nov 17 15:37:36.989820 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476]   File "/usr/share/archivematica/dashboard/apache/django.wsgi", line 32, in <module>
[Tue Nov 17 15:37:36.989915 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476]     if settings.DEBUG:
[Tue Nov 17 15:37:36.989935 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 53, in __getattr__
[Tue Nov 17 15:37:36.990086 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476]     self._setup(name)
[Tue Nov 17 15:37:36.990105 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 48, in _setup
[Tue Nov 17 15:37:36.990136 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476]     self._wrapped = Settings(settings_module)
[Tue Nov 17 15:37:36.990154 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 132, in __init__
[Tue Nov 17 15:37:36.990182 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476]     mod = importlib.import_module(self.SETTINGS_MODULE)
[Tue Nov 17 15:37:36.990200 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476]   File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
[Tue Nov 17 15:37:36.990270 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476]     __import__(name)
[Tue Nov 17 15:37:36.990289 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476]   File "/usr/share/archivematica/dashboard/settings/common.py", line 45, in <module>
[Tue Nov 17 15:37:36.990455 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476]     'USER': config.get('client', 'user'),         # Not used with sqlite3.
[Tue Nov 17 15:37:36.990474 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476]   File "/usr/lib/python2.7/ConfigParser.py", line 607, in get
[Tue Nov 17 15:37:36.990784 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476]     raise NoSectionError(section)
[Tue Nov 17 15:37:36.990820 2015] [:error] [pid 6007:tid 140502438614784] [remote 127.0.0.1:38476] NoSectionError: No section: 'client'

I also reinstalled apache2 and then used configured it with commands from installation guide but that didn't help. Any ideas which component I should reinstall or if there's a need to tweak some config file? Also I set the django to debug
by switching it to TRUE in 'common.py'. Where would be the error log for that?

Hope you can help.

Best wishes,
Pawel
@PawelitoCom
TNA Trainee @ NRO
archivematica-error-log-mod_wsgi-problem.rtf

Justin Simpson

unread,
Nov 18, 2015, 1:07:54 PM11/18/15
to archiv...@googlegroups.com
This is just a guess, based on the stack trace you posted, but it sounds like maybe the archivematica-common package is not installed properly?

The error you posted is from this section of the dashboard code:
https://github.com/artefactual/archivematica/blob/stable/1.4.x/src/dashboard/src/settings/common.py#L38-L46

As django is starting, It is trying to read a file at /etc/archivematica/archivematicaCommon/dbsettings , to get the database username and password, and either that file doesn't exist, or is missing the [client] section.

Here is what the file looks like by default:
https://github.com/artefactual/archivematica/blob/stable/1.4.x/src/archivematicaCommon/etc/dbsettings

Can you verify that you have a file called dbsettings?  Maybe there was a problem when the archivematica-common package was installed?  Normally it would be automatically installed, when you install the other archivematica packages, as it is listed as a dependency of those.  You could try 'sudo apt-get-install archivematica-common' and make sure it says that this package is already installed.  The other possibility I can think of is that the dbsettings file got edited somehow; restoring it to the original I linked to above should help.


Justin Simpson
Director of Archivematica Technical Services
www.artefactual.com
604-527-2056

--
You received this message because you are subscribed to the Google Groups "archivematica" group.
To unsubscribe from this group and stop receiving emails from it, send an email to archivematic...@googlegroups.com.
To post to this group, send email to archiv...@googlegroups.com.
Visit this group at http://groups.google.com/group/archivematica.
For more options, visit https://groups.google.com/d/optout.

Pawel

unread,
Nov 19, 2015, 5:25:38 AM11/19/15
to archivematica
Thank you for your fast reply Justin.

When I run dpkg -l archivematica-common I get:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=============
ii  archivematica- 1:1.4.1-1~14 amd64        Common libraries for archivematic


and when trying to install it says that it is installed already:

archivematica-common is already the newest version.
0 to upgrade, 0 to newly install, 0 to remove and 19 not to upgrade.


I checked the 'dbsettings' file and it was there /etc/archivematica/archivematicaCommon/dbsettings however it was blank/unpopulated. I edited it with sudo nano and copied all default content.

The error log got shorter but the problem persists, this time not not being able to locate
custom_handlers module:

[Thu Nov 19 09:02:46.948075 2015] [:error] [pid 3920:tid 140197940713216] [remote 127.0.0.1:46950] mod_wsgi (pid=3920): Target WSGI script '/usr/share/archivematica/dashboard/apache/django.wsgi' cannot be loaded as Python module.
[Thu Nov 19 09:02:46.948170 2015] [:error] [pid 3920:tid 140197940713216] [remote 127.0.0.1:46950] mod_wsgi (pid=3920): Exception occurred processing WSGI script '/usr/share/archivematica/dashboard/apache/django.wsgi'.
[Thu Nov 19 09:02:46.948208 2015] [:error] [pid 3920:tid 140197940713216] [remote 127.0.0.1:46950] Traceback (most recent call last):
[Thu Nov 19 09:02:46.948249 2015] [:error] [pid 3920:tid 140197940713216] [remote 127.0.0.1:46950]   File "/usr/share/archivematica/dashboard/apache/django.wsgi", line 32, in <module>
[Thu Nov 19 09:02:46.948392 2015] [:error] [pid 3920:tid 140197940713216] [remote 127.0.0.1:46950]     if settings.DEBUG:
[Thu Nov 19 09:02:46.948415 2015] [:error] [pid 3920:tid 140197940713216] [remote 127.0.0.1:46950]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 53, in __getattr__
[Thu Nov 19 09:02:46.948592 2015] [:error] [pid 3920:tid 140197940713216] [remote 127.0.0.1:46950]     self._setup(name)
[Thu Nov 19 09:02:46.948614 2015] [:error] [pid 3920:tid 140197940713216] [remote 127.0.0.1:46950]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 49, in _setup
[Thu Nov 19 09:02:46.948651 2015] [:error] [pid 3920:tid 140197940713216] [remote 127.0.0.1:46950]     self._configure_logging()
[Thu Nov 19 09:02:46.948672 2015] [:error] [pid 3920:tid 140197940713216] [remote 127.0.0.1:46950]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 84, in _configure_logging
[Thu Nov 19 09:02:46.948705 2015] [:error] [pid 3920:tid 140197940713216] [remote 127.0.0.1:46950]     logging_config_func(self.LOGGING)
[Thu Nov 19 09:02:46.948725 2015] [:error] [pid 3920:tid 140197940713216] [remote 127.0.0.1:46950]   File "/usr/lib/python2.7/logging/config.py", line 794, in dictConfig
[Thu Nov 19 09:02:46.949134 2015] [:error] [pid 3920:tid 140197940713216] [remote 127.0.0.1:46950]     dictConfigClass(config).configure()
[Thu Nov 19 09:02:46.949155 2015] [:error] [pid 3920:tid 140197940713216] [remote 127.0.0.1:46950]   File "/usr/lib/python2.7/logging/config.py", line 576, in configure
[Thu Nov 19 09:02:46.949190 2015] [:error] [pid 3920:tid 140197940713216] [remote 127.0.0.1:46950]     '%r: %s' % (name, e))
[Thu Nov 19 09:02:46.949223 2015] [:error] [pid 3920:tid 140197940713216] [remote 127.0.0.1:46950] ValueError: Unable to configure handler 'logfile': Cannot resolve 'custom_handlers.GroupWriteRotatingFileHandler': No module named custom_handlers


I have been also advised to restart services before accessing http://localhost/ but it didn’t help

Restart Services

sudo service uwsgi restart
sudo service nginx restart
sudo /etc/init.d/apache2 restart
sudo /etc/init.d/gearman-job-server restart
sudo restart archivematica-mcp-server
sudo restart archivematica-mcp-client
sudo restart fits

Best,
Pawel

Pawel

unread,
Nov 19, 2015, 5:39:04 AM11/19/15
to archivematica
An Update: I changed the DEBUG option in django and ended up with this traceback: http://dpaste.com/1MB8EVB

Request Method: GET
Request URL: http://localhost/
Django Version: 1.5.4
Exception Type: ImportError
Exception Value:
No module named elasticSearchFunctions
Exception Location: /usr/share/archivematica/dashboard/components/decorators.py in <module>, line 30
Python Executable: /usr/bin/python
Python Version: 2.7.6
Python Path:
['/usr/local/lib/python2.7/dist-packages/setuptools-18.5-py2.7.egg',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/PILcompat',
 '/usr/lib/python2.7/dist-packages/gtk-2.0',
 '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
 '/usr/share/archivematica/dashboard',
 '/usr/lib/archivematica/archivematicaCommon/externals',
 '/usr/lib/archivematica/archivematicaCommon',
 '/usr/lib/archivematica/archivematicaCommon',
 '/usr/lib/archivematica/archivematicaCommon',
 '/usr/lib/archivematica/archivematicaCommon']

Server time: Thu, 19 Nov 2015 10:32:31 +0000

Best,
Pawel

Justin Simpson

unread,
Nov 19, 2015, 6:30:24 AM11/19/15
to archiv...@googlegroups.com
It sounds like there was some kind of error when the archivemaitca-common package was first installed.  The 'no module named elasticSearchFuntions' error means that either that module is not present on your system, or at least is not in a directory on your python path.  Your debug shows that 'usr/lib/archivematica/archivematicaCommon' is on your python path, that is where you should find the elasticSearchFucntions.py file.

You can check that you file an elasticSearchFunctions.py file in /usr/lib/archivematica/archivematicaCommon/, but given that this is the 2nd anomaly related to the installation of the archivematica-common package, I am tempted to suggest that you reinstall that package.  This would require you to 'apt-get purge archivematica-common' and then 'apt-get install archivematica-common'.  You will probably have to apt-get install the other archivematica packages, as they will be removed when you apt-get purge their dependency (archivematica-common).


 


Justin Simpson
Director of Archivematica Technical Services
www.artefactual.com
604-527-2056

Pawel

unread,
Nov 19, 2015, 12:50:00 PM11/19/15
to archivematica
Thank you Justin, that worked! I have the dashboard up and running! There's only one issue left - with administration tab, when clicked it returns an error (http://dpaste.com/1ZS3PQB):

IOError at /administration/processing/

[Errno 2] No such file or directory: 'sharedMicroServiceTasksConfigs/processingMCPConfigs/defaultProcessingMCP.xml'

Is that again a missing config file? Is there a way of copying that from github maybe?

Thank you for your support.

Best,
Pawel

Pawel

unread,
Nov 23, 2015, 7:01:13 AM11/23/15
to archivematica
An Update:

Archivematica Dashboard now fully works. I tried to reinstall Archivematica packages, for most of which I got the message that there are already installed but I think
archivematica-mcp-server was missing 3 or 4 components for some reason. Another issue is elasticsearch. It doesn't boot up at start so it needs be run from terminal beforehand (sudo /etc/init.d/elasticsearch start).

The Dashboard has the status connected (lit up in green) and the pipeline for this instance of Archivematica shows up in Storage Service with the right UUID. Archivematica set up default space and location
s.

However when I attempt a transfer the error message shows up:

Error copying /var/archivematica/sharedDirectory/tmp/tmp50yMbZ/Test_001 to start of transfer.

Any ideas what might be an issue? The dashboard log shows:

INFO 2015-11-23 11:34:50 archivematica.common:storageService:get_location:129: Storage locations returned: [{'uuid': '21f87a60-99ed-4897-bd3f-6edbe04673b2', 'pipeline': ['/api/v2/pipeline/182fbd5c-768a-4d58-8fb5-714e4d36626b/'], 'used': '0', 'description': 'Currently Processing', 'space': '/api/v2/space/e1774890-c4ad-4f73-9859-adfe12a2df78/', 'enabled': True, 'quota': None, 'relative_path': '/CurrentProcess', 'purpose': 'CP', 'path': '/CurrentProcess', 'resource_uri': '/api/v2/location/21f87a60-99ed-4897-bd3f-6edbe04673b2/'}]
INFO 2015-11-23 11:34:50 archivematica.common:storageService:get_location:129: Storage locations returned: [{'uuid': '1a2ec80c-9f85-4fa1-b90b-9e32dc3af370', 'pipeline': ['/api/v2/pipeline/182fbd5c-768a-4d58-8fb5-714e4d36626b/'], 'used': '0', 'description': '/home', 'space': '/api/v2/space/1f1bb799-7324-4191-bd7b-b691c3b744f3/', 'enabled': True, 'quota': None, 'relative_path': 'home', 'purpose': 'TS', 'path': '/home', 'resource_uri': '/api/v2/location/1a2ec80c-9f85-4fa1-b90b-9e32dc3af370/'}]
WARNING 2015-11-23 11:34:50 archivematica.common:storageService:copy_files:175: Could not connect to storage service: Server Error 500: http://localhost:8000/api/v2/location/21f87a60-99ed-4897-bd3f-6edbe04673b2/ ({"error_message": "Sorry, this request could not be processed. Please try again later."})

And the Storage Service log:

INFO 2015-11-23 03:34:50 locations.models.space:space:_move_rsync:375: Rsyncing from /home/norfolk/Documents/amdropbox/test_data/media3/. to /home/norfolk/Documents/amdropbox/CurrentProcess/tmp/tmp50yMbZ/Test_001/.
INFO 2015-11-23 03:34:50 locations.models.space:space:_move_rsync:383: rsync command: ['rsync', '-t', '-O', '--protect-args', '-vv', '--chmod=ugo+rw', '-r', '/home/norfolk/Documents/amdropbox/test_data/media3/.', '/home/norfolk/Documents/amdropbox/CurrentProcess/tmp/tmp50yMbZ/Test_001/.']
WARNING 2015-11-23 03:34:50 locations.models.space:space:_create_local_directory:413: Could not create storage directory: [Errno 13] Permission denied: '/CurrentProcess'
ERROR 2015-11-23 03:34:50 django.request.tastypie:resources:_handle_500:295: Internal Server Error: /api/v2/location/21f87a60-99ed-4897-bd3f-6edbe04673b2/

Traceback (most recent call last):
  File "/usr/share/python/archivematica-storage-service/local/lib/python2.7/site-packages/tastypie/resources.py", line 217, in wrapper
response = callback(request, *args, **kwargs)
File "/usr/share/python/archivematica-storage-service/local/lib/python2.7/site-packages/tastypie/resources.py", line 468, in dispatch_detail
return self.dispatch('detail', request, **kwargs)
File "/usr/share/python/archivematica-storage-service/local/lib/python2.7/site-packages/tastypie/resources.py", line 491, in dispatch
response = method(request, **kwargs)
File "./locations/api/resources.py", line 371, in post_detail
destination_path=destination_path,
File "./locations/models/space.py", line 296, in move_from_storage_service
source_path, destination_path, *args, **kwargs)
File "./locations/models/local_filesystem.py", line 42, in move_from_storage_service
self.space._create_local_directory(destination_path)
File "./locations/models/space.py", line 409, in _create_local_directory
os.makedirs(dir_path, mode)
File "/usr/share/python/archivematica-storage-service/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/share/python/archivematica-storage-service/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/share/python/archivematica-storage-service/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/share/python/archivematica-storage-service/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/CurrentProcess'

And Storage Service Debug log:

DEBUG 2015-11-23 03:34:50 locations.models.space:space:move_to_storage_service:221: TO: src: home/norfolk/Documents/amdropbox/test_data/media3/.
DEBUG 2015-11-23 03:34:50 locations.models.space:space:move_to_storage_service:222: TO: dst: /CurrentProcess/tmp/tmp50yMbZ/Test_001/.
DEBUG 2015-11-23 03:34:50 locations.models.space:space:move_to_storage_service:223: TO: staging: /home/norfolk/Documents/amdropbox
INFO 2015-11-23 03:34:50 locations.models.space:space:_move_rsync:375: Rsyncing from /home/norfolk/Documents/amdropbox/test_data/media3/. to /home/norfolk/Documents/amdropbox/CurrentProcess/tmp/tmp50yMbZ/Test_001/.
INFO 2015-11-23 03:34:50 locations.models.space:space:_move_rsync:383: rsync command: ['rsync', '-t', '-O', '--protect-args', '-vv', '--chmod=ugo+rw', '-r', '/home/norfolk/Documents/amdropbox/test_data/media3/.', '/home/norfolk/Documents/amdropbox/CurrentProcess/tmp/tmp50yMbZ/Test_001/.']
DEBUG 2015-11-23 03:34:50 locations.models.space:space:move_from_storage_service:290: FROM: src: /CurrentProcess/tmp/tmp50yMbZ/Test_001/.
DEBUG 2015-11-23 03:34:50 locations.models.space:space:move_from_storage_service:291: FROM: dst: /CurrentProcess/tmp/tmp50yMbZ/Test_001/.
WARNING 2015-11-23 03:34:50 locations.models.space:space:_create_local_directory:413: Could not create storage directory: [Errno 13] Permission denied: '/CurrentProcess'
ERROR 2015-11-23 03:34:50 django.request.tastypie:resources:_handle_500:295: Internal Server Error: /api/v2/location/21f87a60-99ed-4897-bd3f-6edbe04673b2/

Traceback (most recent call last):
  File "/usr/share/python/archivematica-storage-service/local/lib/python2.7/site-packages/tastypie/resources.py", line 217, in wrapper
response = callback(request, *args, **kwargs)
File "/usr/share/python/archivematica-storage-service/local/lib/python2.7/site-packages/tastypie/resources.py", line 468, in dispatch_detail
return self.dispatch('detail', request, **kwargs)
File "/usr/share/python/archivematica-storage-service/local/lib/python2.7/site-packages/tastypie/resources.py", line 491, in dispatch
response = method(request, **kwargs)
File "./locations/api/resources.py", line 371, in post_detail
destination_path=destination_path,
File "./locations/models/space.py", line 296, in move_from_storage_service
source_path, destination_path, *args, **kwargs)
File "./locations/models/local_filesystem.py", line 42, in move_from_storage_service
self.space._create_local_directory(destination_path)
File "./locations/models/space.py", line 409, in _create_local_directory
os.makedirs(dir_path, mode)
File "/usr/share/python/archivematica-storage-service/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/share/python/archivematica-storage-service/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/share/python/archivematica-storage-service/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/share/python/archivematica-storage-service/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/CurrentProcess'

Best,
Pawel


Pawel

unread,
Nov 24, 2015, 3:20:58 PM11/24/15
to archivematica
And another, final update - the problem was misconfigured Storage Service. For some reason I had 'Currently Processing' location registered under different space than all other default locations. I must have done it myself somehow since I tried to set up another space with different locations.

I reinstalled Storage Service and registered new pipeline from there. It now works! Let's get testing.. Thank you and sorry to be a nuisance

Best,
Pawel

Sarah Romkey

unread,
Nov 24, 2015, 3:22:52 PM11/24/15
to archiv...@googlegroups.com
Thank you for posting your results Pawel, and I'm glad you got it working!

Cheers,

Sarah

Sarah Romkey, MAS,MLIS
Archivematica Program Manager
Artefactual Systems
604-527-2056
@archivematica / @accesstomemory


Caroline Gil

unread,
Oct 19, 2017, 2:48:40 PM10/19/17
to archivematica
Hi all,

I was getting the exact same error Pawel was getting-- the dreaded internal server error, and worked my way through the troubleshooting steps outlined here. Purged the archivematica-common packages and reinstalled, and still getting the same error.

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.


Apache/2.4.7 (Ubuntu) Server at 10.10.78.31 Port 80

[Thu Oct 19 13:03:09.146109 2017] [:error] [pid 22991:tid 139692916340480] [remote 10.10.78.31:9411] ImportError: No module named monitor
[Thu Oct 19 14:43:31.569248 2017] [:error] [pid 22991:tid 139692798719744] [remote 10.10.78.31:42953] mod_wsgi (pid=22991): Target WSGI script '/usr/share/archivematica/dashboard/apache/django.wsgi' cannot be loaded as Python module.
[Thu Oct 19 14:43:31.569263 2017] [:error] [pid 22991:tid 139692798719744] [remote 10.10.78.31:42953] mod_wsgi (pid=22991): Exception occurred processing WSGI script '/usr/share/archivematica/dashboard/apache/django.wsgi'.
[Thu Oct 19 14:43:31.569277 2017] [:error] [pid 22991:tid 139692798719744] [remote 10.10.78.31:42953] Traceback (most recent call last):
[Thu Oct 19 14:43:31.569289 2017] [:error] [pid 22991:tid 139692798719744] [remote 10.10.78.31:42953]   File "/usr/share/archivematica/dashboard/apache/django.wsgi", line 6, in <module>
[Thu Oct 19 14:43:31.569309 2017] [:error] [pid 22991:tid 139692798719744] [remote 10.10.78.31:42953]     import monitor
[Thu Oct 19 14:43:31.569322 2017] [:error] [pid 22991:tid 139692798719744] [remote 10.10.78.31:42953] ImportError: No module named monitor

I'm on a recently upgraded Archivematica 1.6 on Ubuntu 14.04 Trusty Tahr.

Any idea of what may be going on here?
I was trying to fix having to restart all am services when booting up my pipeline machine.

Thanks so much,

Jesús García Crespo

unread,
Oct 19, 2017, 5:26:53 PM10/19/17
to archiv...@googlegroups.com
Hi Caroline,

That sounds to me like the PYTHONPATH environment string is not defined as expected. You can use this file as a reference: https://github.com/artefactual-labs/ansible-archivematica-src/blob/a38b2d1a8a972f51f395cffb6cf52ef2155b291d/templates/etc_apache2_sites_dashboard.conf.j2. The important bit is:

python-path=/usr/share/archivematica/dashboard:/usr/lib/archivematica/archivematicaCommon

That tells Python where to find the Archivematica code. In that error you pasted I saw this message: ImportError: No module named monitor. That makes me think that Python didn't see monitor.py which should be located at /usr/share/archivematica/dashboard/.

--
You received this message because you are subscribed to the Google Groups "archivematica" group.
To unsubscribe from this group and stop receiving emails from it, send an email to archivematica+unsubscribe@googlegroups.com.

To post to this group, send email to archiv...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Jesús García Crespo,
Software Developer, Artefactual Systems Inc.
http://www.artefactual.com | +1.604.527.2056

Caroline Gil

unread,
Oct 20, 2017, 11:29:11 AM10/20/17
to archivematica

Jesús,

Thank you. I'm getting closer!

I edited my apache2 sites-enabled default.conf file to define the python path. But, now I'm getting this error:

AH00526: Syntax error on line 30 of /etc/apache2/sites-enabled/default.conf:
Invalid command '{%', perhaps misspelled or defined by a module not included in the server configuration
Action 'restart' failed.
The Apache error log may have more information.

I cross-checked my conf file with the example you sent and it's exactly the same! Am I missing a line-break or something?

My error log shows this:

[Fri Oct 20 10:15:44.933760 2017] [:error] [pid 24269:tid 140511156053760] [remote 10.10.78.31:1862] mod_wsgi (pid=24269): Exception occurred processing WSGI script '/usr/share/archivematica/dashboard/apache/django.wsgi'.
[Fri Oct 20 10:15:44.933775 2017] [:error] [pid 24269:tid 140511156053760] [remote 10.10.78.31:1862] Traceback (most recent call last):
[Fri Oct 20 10:15:44.933787 2017] [:error] [pid 24269:tid 140511156053760] [remote 10.10.78.31:1862]   File "/usr/share/archivematica/dashboard/apache/django.wsgi", line 6, in <module>
[Fri Oct 20 10:15:44.933807 2017] [:error] [pid 24269:tid 140511156053760] [remote 10.10.78.31:1862]     import monitor
[Fri Oct 20 10:15:44.933821 2017] [:error] [pid 24269:tid 140511156053760] [remote 10.10.78.31:1862] ImportError: No module named monitor
[Fri Oct 20 10:15:45.049603 2017] [:error] [pid 24269:tid 140511038424832] [remote 10.10.78.31:40019] mod_wsgi (pid=24269): Target WSGI script '/usr/share/archivematica/dashboard/apache/django.wsgi' cannot be loaded as Python module.
[Fri Oct 20 10:15:45.049622 2017] [:error] [pid 24269:tid 140511038424832] [remote 10.10.78.31:40019] mod_wsgi (pid=24269): Exception occurred processing WSGI script '/usr/share/archivematica/dashboard/apache/django.wsgi'.
[Fri Oct 20 10:15:45.049636 2017] [:error] [pid 24269:tid 140511038424832] [remote 10.10.78.31:40019] Traceback (most recent call last):
[Fri Oct 20 10:15:45.049649 2017] [:error] [pid 24269:tid 140511038424832] [remote 10.10.78.31:40019]   File "/usr/share/archivematica/dashboard/apache/django.wsgi", line 6, in <module>
[Fri Oct 20 10:15:45.049670 2017] [:error] [pid 24269:tid 140511038424832] [remote 10.10.78.31:40019]     import monitor
[Fri Oct 20 10:15:45.049692 2017] [:error] [pid 24269:tid 140511038424832] [remote 10.10.78.31:40019] ImportError: No module named monitor
[Fri Oct 20 10:37:55.902165 2017] [:error] [pid 24269:tid 140511156053760] [remote 10.10.78.31:35404] mod_wsgi (pid=24269): Target WSGI script '/usr/share/archivematica/dashboard/apache/django.wsgi' cannot be loaded as Python module.
[Fri Oct 20 10:37:55.902179 2017] [:error] [pid 24269:tid 140511156053760] [remote 10.10.78.31:35404] mod_wsgi (pid=24269): Exception occurred processing WSGI script '/usr/share/archivematica/dashboard/apache/django.wsgi'.
[Fri Oct 20 10:37:55.902192 2017] [:error] [pid 24269:tid 140511156053760] [remote 10.10.78.31:35404] Traceback (most recent call last):
[Fri Oct 20 10:37:55.902204 2017] [:error] [pid 24269:tid 140511156053760] [remote 10.10.78.31:35404]   File "/usr/share/archivematica/dashboard/apache/django.wsgi", line 6, in <module>
[Fri Oct 20 10:37:55.902223 2017] [:error] [pid 24269:tid 140511156053760] [remote 10.10.78.31:35404]     import monitor
[Fri Oct 20 10:37:55.902236 2017] [:error] [pid 24269:tid 140511156053760] [remote 10.10.78.31:35404] ImportError: No module named monitor
[Fri Oct 20 10:37:56.884503 2017] [:error] [pid 24269:tid 140511038424832] [remote 10.10.78.31:2118] mod_wsgi (pid=24269): Target WSGI script '/usr/share/archivematica/dashboard/apache/django.wsgi' cannot be loaded as Python module.
[Fri Oct 20 10:37:56.884521 2017] [:error] [pid 24269:tid 140511038424832] [remote 10.10.78.31:2118] mod_wsgi (pid=24269): Exception occurred processing WSGI script '/usr/share/archivematica/dashboard/apache/django.wsgi'.
[Fri Oct 20 10:37:56.884535 2017] [:error] [pid 24269:tid 140511038424832] [remote 10.10.78.31:2118] Traceback (most recent call last):
[Fri Oct 20 10:37:56.884548 2017] [:error] [pid 24269:tid 140511038424832] [remote 10.10.78.31:2118]   File "/usr/share/archivematica/dashboard/apache/django.wsgi", line 6, in <module>
[Fri Oct 20 10:37:56.884569 2017] [:error] [pid 24269:tid 140511038424832] [remote 10.10.78.31:2118]     import monitor
[Fri Oct 20 10:37:56.884582 2017] [:error] [pid 24269:tid 140511038424832] [remote 10.10.78.31:2118] ImportError: No module named monitor
[Fri Oct 20 10:39:13.797641 2017] [mpm_event:notice] [pid 23992:tid 140511259568000] AH00491: caught SIGTERM, shutting down
To unsubscribe from this group and stop receiving emails from it, send an email to archivematic...@googlegroups.com.

To post to this group, send email to archiv...@googlegroups.com.

Jesús García Crespo

unread,
Oct 20, 2017, 12:02:37 PM10/20/17
to archiv...@googlegroups.com
Hi Caroline,

The file I linked to is a Jinja2 template that we used in Ansible to build configuration times dynamically but as it is it won't be understood by Apache. Here you have another example: https://github.com/artefactual/archivematica/blob/92d7abd238585e64e6064bc3f1ddfc663c4d3ace/localDevSetup/apache/apache.default - that one you should be able to drop it as it is but I can't guarantee that it'll work.

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

To post to this group, send email to archiv...@googlegroups.com.
Visit this group at https://groups.google.com/group/archivematica.
For more options, visit https://groups.google.com/d/optout.

Caroline Gil

unread,
Oct 23, 2017, 11:15:02 AM10/23/17
to archivematica
Hi Jesús,

Thank you. I'm a relative newcomer to this, so forgive me if I'm misunderstanding.

Am I supposed to replace my etc/apache2/sites-enabled/default.conf file with the template you linked to?

Where was I to change the PYTHONPATH environment string you originally linked to?

Here's how my apache2 sites-enabled file looks like right now:

# NameVirtualHost directive is assigned at ports.conf

<VirtualHost *:80>
  ServerAdmin webmaster@localhost
  DocumentRoot /var/www

  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>

  ErrorLog /var/log/apache2/error.log

  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn

  CustomLog /var/log/apache2/access.log combined
  ServerSignature On

  # Serve static files from Dashboard
  Alias /media "/usr/share/archivematica/dashboard/media/"
  <Directory "/usr/share/archivematica/dashboard/media/">
    Order allow,deny
    Allow from all
  </Directory>

  # Django with mod_wsgi
  # http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
  {% if archivematica_src_environment_type == "development" %}
    SetEnv DJANGO_SETTINGS_MODULE settings.local
  {% else %}
    SetEnv DJANGO_SETTINGS_MODULE settings.common
  {% endif %}
  WSGIScriptAlias / /usr/share/archivematica/dashboard/apache/django.wsgi
  WSGIDaemonProcess dashboard user=archivematicadashboard group=archivematica python-path=/usr/share/archivematica/dashboard:/usr/lib/archivematica/archivematicaCommon
  WSGIProcessGroup dashboard
  <Directory "/usr/share/archivematica/dashboard/apache/">
    Order allow,deny
    Allow from all
  </Directory>

</VirtualHost>

My apache2.conf looks like this:

# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.4/ for detailed information about
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
# hints.
#
#
# Summary of how the Apache 2 configuration works in Debian:
# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
# default Apache2 installation attempts to make adding and removing modules,
# virtual hosts, and extra configuration directives as flexible as possible, in
# order to make automating the changes and administering the server as easy as
# possible.

# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
#    /etc/apache2/
#    |-- apache2.conf
#    |    `--  ports.conf
#    |-- mods-enabled
#    |    |-- *.load
#    |    `-- *.conf
#    |-- conf-enabled
#    |    `-- *.conf
#     `-- sites-enabled
#         `-- *.conf
#
#
# * apache2.conf is the main configuration file (this file). It puts the pieces
#   together by including all remaining configuration files when starting up the
#   web server.
#
# * ports.conf is always included from the main configuration file. It is
#   supposed to determine listening ports for incoming connections which can be
#   customized anytime.
#
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
#   directories contain particular configuration snippets which manage modules,
#   global configuration fragments, or virtual host configurations,
#   respectively.
#
#   They are activated by symlinking available configuration files from their
#   respective *-available/ counterparts. These should be managed by using our
#   helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
#   their respective man pages for detailed information.
#
# * The binary is called apache2. Due to the use of environment variables, in
#   the default configuration, apache2 needs to be started/stopped with
#   /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
#   work with the default configuration.


# Global configuration
#

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the Mutex documentation (available
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
#ServerRoot "/etc/apache2"

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
Mutex file:${APACHE_LOCK_DIR} default

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5


# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log

#
# LogLevel: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
#
LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf


# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

#<Directory /srv/>
#    Options Indexes FollowSymLinks
#    AllowOverride None
#    Require all granted
#</Directory>




# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
    Require all denied
</FilesMatch>


#
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

 And when I attempt to restart apache2, I get this:

sudo service apache2 restart
 * Restarting web server apache2                                         [fail]
 * The apache2 configtest failed.
Output of config test was:

AH00526: Syntax error on line 30 of /etc/apache2/sites-enabled/default.conf:
Invalid command '{%', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.

The Apache error log may have more information.

Jesús García Crespo

unread,
Oct 23, 2017, 2:47:54 PM10/23/17
to archiv...@googlegroups.com
On Mon, Oct 23, 2017 at 8:15 AM, Caroline Gil <gilcar...@gmail.com> wrote:
Am I supposed to replace my etc/apache2/sites-enabled/default.conf file with the template you linked to?

Yes, I would try that. Unless you keep a copy of the original file. You can also reinstall. Were you using our Ubuntu packages?

Caroline Gil

unread,
Oct 26, 2017, 12:27:30 PM10/26/17
to archivematica
Hi Jesús,

I replaced the apache2 conf file with the template and am now getting this error on the browser:


Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.


Apache/2.4.7 (Ubuntu) Server at localhost Port 80

I'm getting this on my error log:

[Thu Oct 26 12:21:16.399640 2017] [:error] [pid 13000:tid 140231534044928] [remote 127.0.0.1:16939]   File "/usr/share/archivematica/dashboard/apache/django.wsgi", line 16, in __call__
[Thu Oct 26 12:21:16.399661 2017] [:error] [pid 13000:tid 140231534044928] [remote 127.0.0.1:16939]     django.setup()
[Thu Oct 26 12:21:16.399674 2017] [:error] [pid 13000:tid 140231534044928] [remote 127.0.0.1:16939] AttributeError: 'module' object has no attribute 'setup'
[Thu Oct 26 12:21:16.475098 2017] [:error] [pid 13000:tid 140231416424192] [remote 127.0.0.1:53555] mod_wsgi (pid=13000): Exception occurred processing WSGI script '/usr/share/archivematica/dashboard/apache/django.wsgi'.
[Thu Oct 26 12:21:16.475125 2017] [:error] [pid 13000:tid 140231416424192] [remote 127.0.0.1:53555] Traceback (most recent call last):
[Thu Oct 26 12:21:16.475138 2017] [:error] [pid 13000:tid 140231416424192] [remote 127.0.0.1:53555]   File "/usr/share/archivematica/dashboard/apache/django.wsgi", line 16, in __call__
[Thu Oct 26 12:21:16.475158 2017] [:error] [pid 13000:tid 140231416424192] [remote 127.0.0.1:53555]     django.setup()
[Thu Oct 26 12:21:16.475172 2017] [:error] [pid 13000:tid 140231416424192] [remote 127.0.0.1:53555] AttributeError: 'module' object has no attribute 'setup'


Yes, we used Archivematica's Ubuntu packages. We did upgrade from 1.4 to 1.6 recently by way of ansible-vagrant with one of your colleagues.

Where would the re-installation instruction be at?

Caroline Gil

unread,
Oct 31, 2017, 10:34:30 AM10/31/17
to archivematica
Hi,

Can someone please point me in the direction of re-installation instructions for v. 1.6?

Kelly Stewart

unread,
Nov 8, 2017, 12:48:04 PM11/8/17
to archivematica
Hi Caroline,

If you're using a  VM you should destroy the VM and make a new one.  Otherwise follow the installation instructions here

Regards,
Kelly Stewart
Systems Archivist
Reply all
Reply to author
Forward
0 new messages