4.4. Upgrading CRATE¶
Activate your CRATE virtual environment. We use a batch file to do this, but from the command prompt, the command will be something like
C:\srv\crate\crate_virtualenv\Scripts\activate. (If you use a batch file, you must
CALLthis activation script.)
Make sure that nobody’s doing anything important! You could use tools like
Stop any parts of CRATE that are running.
Run the Windows Service Manager (if you can’t find it on the menus, run
services.mscfrom the command line).
Stop the service named “CRATE web service”.
Install the version you want, e.g.:
pip install crate_anon==0.18.50.
If you get this error:
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: 'c:\\srv\\crate\\crate_virtualenv\\ Lib\\site-packages\\win32\\servicemanager.pyd' Consider using the `--user` option or check the permissions.
then it means (probably) that you have run the CRATE service via a privileged account, which compiled a
.pyfile to a
.pydfile is then undeletable by a normal user.
Delete the offending file and reinstall CRATE. See Deleting hard-to-delete files below.
crate_django_manage migrate. This ensures the CRATE administrative database is up to date (in terms of its structure). See crate_django_manage.
crate_django_manage collectstatic. This ensures that all static files are in the right place. You’ll have to answer “yes” when it asks you if you want to overwrite existing files.
Use Service Manager to restart the CRATE service.
If it doesn’t start, check the CRATE Django log, fix the problem (maybe your configuration file has errors in it), and restart the service.
If you want to check which Python virtual environment is activated, you can do this:
import sys print(sys.executable)
You can show the current version numbers of all software installed in a
Python virtual environment with
To see which versions of CRATE are available from PyPI, you can issue an
“install” command using a nonexistent version number:
Deleting hard-to-delete files under Windows
You can try several methods:
Try a privileged command prompt. From the Windows Start menu, find
cmd.exe, right-click it, and choose “Run as administrator”. Delete the offending file.
If that doesn’t work, try deleting it via Windows Explorer. You might see this:
The action can't be completed because the file is open in DHCP Client Close the file and try again.
resmon.exeand using , and search for part of the filename 2.
proxecp64.exeand use and enter part of a filename, similarly.
Another way is to use LockHunter. This is pretty helpful! It integrates with Windows Explorer, and will offer a reboot-plus-delete if all else fails.