OSError: [WinError 5] Access is denied when upgrading from

13,459 views
Skip to first unread message

John Reardon

unread,
Jul 12, 2022, 8:43:28 AM7/12/22
to QATrack+
I am trying to upgrade from QATrack+ v0.2.9 to v3.1.0 on Windows server 2019 and Python 3.9.13.  While upgrading from v0.2.9 to v3.0, I see messages like the following:

ERROR: Could not install packages due to an OSError: [WinError 5] Access is deni
ed: 'C:\\Users\\<username>\\AppData\\Local\\Temp\\pip-uninstall-fxjmvi
8t\\pip.exe'

I am running as an administrator.  Have you any suggestions?  I have tried using Windows 7 with an earlier version of Python to see if that made a difference, and run into the same problem.  I have tried changing the temp folder to C:\temp, which also made no difference.  

I  can install v3.1.0 with an empty database without problems and it runs OK.  

Thanks in advance.  

John


Randle Taylor

unread,
Jul 12, 2022, 9:14:41 AM7/12/22
to John Reardon, QATrack+
HI John,

This is usually a file permissions issue. However, I would have thought that if you were running with Administrator privileges that would not be an issue.  Two things to check:

1) You created a new virtualenv with python 3.9 and have it activated
2) pip is updated `pip install --upgrade pip`

Another issue might be that Python wasn't installed for "All Users"?  When you install Python you need to ensure that the "Install for All Users" option is selected.

Randy


--
You received this message because you are subscribed to the Google Groups "QATrack+" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qatrack+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qatrack/e33310ff-88f5-455f-bb8a-0db5f4837798n%40googlegroups.com.

John Reardon

unread,
Jul 12, 2022, 9:45:50 AM7/12/22
to QATrack+
Thanks Randy

This is what I am doing:

"Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Windows\system32> cd c:\deploy\qatrackplus
PS C:\deploy\qatrackplus> git checkout v0.3.0.20
Updating files: 100% (1072/1072), done.
Previous HEAD position was 53398fa4 bump versions
HEAD is now at be52e5d7 update requirements for python 3.9 upgrade
PS C:\deploy\qatrackplus> python --version
Python 3.9.13
PS C:\deploy\qatrackplus> cd C:\deploy
PS C:\deploy> python -m venv venvs\qatrack3
PS C:\deploy> .\venvs\qatrack3\Scripts\Activate.ps1
(qatrack3) PS C:\deploy> pip install --upgrade pip
Requirement already satisfied: pip in c:\deploy\venvs\qatrack3\lib\site-packages (22.0.4)
Collecting pip
  Using cached pip-22.1.2-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 22.0.4
    Uninstalling pip-22.0.4:
      Successfully uninstalled pip-22.0.4
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\\Users\\jreardonadmin\\AppData\\Local\\Temp\\pip-uninstall-2xuca8s4\\pip.exe'
Check the permissions.

(qatrack3) PS C:\deploy>"

Python was installed for all users.  The folder permissions look OK.  

Any suggestions woulld be gratefully recieved.  

Regards

John

Randle Taylor

unread,
Jul 12, 2022, 9:50:49 AM7/12/22
to John Reardon, QATrack+
Strange.  That looks ok to me.  Here's a stack overflow answer that looks like the same issue and suggests upgrading the Python version of pip as well:  https://stackoverflow.com/questions/72325510/pip-upgrade-in-virtual-environment-access-denied 

python -m pip install --upgrade pip

Randy

John Reardon

unread,
Jul 12, 2022, 10:05:50 AM7/12/22
to QATrack+
Thanks Randy

That is much appreciated, it seems to have worked - "python -m pip install --upgrade pip" completed with no error messages.  

Unfortunately, at the next step, the follwing happens:

"(qatrack3) PS C:\deploy\qatrackplus> pip install -r requirements\win.txt
Obtaining django-formtools from git+https://github.com/django/django-formtools.git@bb97a8abd374c50991c0a9ce144f17e7322a0c48#egg=django-formtools (from -r requirements\base.txt (line 1))
  Skipping because already up-to-date.
  Preparing metadata (setup.py) ... done
Obtaining django_genericdropdown from git+https://github.com/randlet/django-genericdropdown.git@56dbaf6b4f518a3946e5e253fec85ede175f3727#egg=django_genericdropdown (from -r requirements\base.txt (line 2))
  Skipping because already up-to-date.
  Preparing metadata (setup.py) ... done
Obtaining django_listable from git+https://github.com/randlet/django-listable.git@efff32a4ceaa795d5b1a32dc75decacef3de90e8#egg=django_listable (from -r requirements\base.txt (line 3))
  Skipping because already up-to-date.
  Preparing metadata (setup.py) ... done
Ignoring scikit-image: markers 'python_version == "3.4"' don't match your environment
Ignoring scikit-learn: markers 'python_version == "3.4"' don't match your environment
Ignoring pylinac: markers 'python_version < "3.6"' don't match your environment
Collecting Django==1.11.20
  Using cached Django-1.11.20-py2.py3-none-any.whl (6.9 MB)
Collecting PyVirtualDisplay==0.2
  Using cached PyVirtualDisplay-0.2.tar.gz (29 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [3 lines of output]
      C:\Program Files\Python39\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'use_2to3_exclude_fixers'
        warnings.warn(msg)
      error in PyVirtualDisplay setup command: use_2to3 is invalid.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
(qatrack3) PS C:\deploy\qatrackplus>"

Have you any suggestions?

Regards

John

Randle Taylor

unread,
Jul 19, 2022, 2:36:31 PM7/19/22
to John Reardon, QATrack+
Hi John,

I'm sorry I haven't been able to reproduce this issue after a couple of attempts (everything is installing OK for me). 

As a first step you could open up C:\deploy\qatrackplus\requirements\base.txt and comment out the "PyVirtualDisplay" line by putting a hash mark at the beginning of the line like:

#PyVirtualDisplay==2.0

and then trying to install the requirements again.  It is only used for testing and not strictly required.

If that fails, I would suggest deleting the existing virtualenv you have and recreating it and then trying to install the packages again.

Randy

John Reardon

unread,
Jul 19, 2022, 2:47:29 PM7/19/22
to QATrack+
Randy

That is much appreciated - thanks for your help.  I have been working on it this afternoon.  Deleting and recreating the virtualenv did not make any difference, so I went through the contents of win.txt and base.txt one by one, installing them until I found the one that caused the problem and then removing it.  It also told me that the version of SQL Server was not supported, adding it to the list in the relevant py file seem to resolve the problem.  After that the installation proceeded without problems, and "python manage.py migrate --fake-initial" produced a sensible looking output.   I will reply in more detail later.  

Regards

John
Reply all
Reply to author
Forward
0 new messages