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
pip install ironpdf==2024.9.1.3 --user
SHELL

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

Reason

This issue occurs because the program is being installed in the C: drive's base directory, instead of in your 'C:\Users\' directory. The --user flag allows installation in a user-specific directory, bypassing permission issues associated with system directories.

Chaknith Bin
Software Engineer
Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience.
Talk to an Expert Five Star Trust Score Rating

Ready to Get Started?