Could not install packages due to an OSError

During installation you may encounter the exception below:

ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\\Python312\\IronPdf.Slim'
Consider using the `--user` option or check the permissions.

Solution

The solution is to include the --user flag at the end of the installation command. For example:

pip install ironpdf==2024.9.1.3 --user

When using --user, the package is installed in a directory under your user profile, such as 'C:\Users\<username>\AppData\' on Windows or ~/.local/ on Linux. However, this solution may lead to the issue 'Failed to locate IronPdf.Slim.dll.'

Reason

This occurs because the program is being installed in the C: drive's base directory, instead of in your 'C:\Users\<username>' directory.