I am having something like this issue but none of the answers worked for me. I have my own package and I am trying to install it on Windows using
python setup.py install
It is a pretty typical/minimal setup.py, nothing special. I am using a conda environment. I get the famous WinError 5: Access Denied when it is trying to extract stuff from the egg and put it in my site-packages.
<... other install noise ...>
creating 'dist\mypackage-1.0-py3.8.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing mypackage-1.0-py3.8.egg
creating c:\users\user1\.conda\envs\myenv\lib\site-packages\mypackage-1.0-py3.8.egg
Extracting mypackage-1.0-py3.8.egg to c:\users\user1\.conda\envs\myenv\lib\site-packages
error: [WinError 5] Access is denied:
'c:\\users\\user1\\.conda\\envs\\myenv\\lib\\site-packages\\mypackage-1.0-py3.8.egg\\mypackage\\__pycache__\\my_module.cpython-38.pyc.1481939376624' -> 'c:\\users\\user1\\.conda\\envs\\myenv\\lib\\site-packages\\mypackage-1.0-py3.8.egg\\mypackage\\__pycache__\\my_moduel.cpython-38.pyc'
I have checked every folder in the path to the install location (.conda\envs\myenv\Lib\site-packages\
) and they are all owned by me with full control. Using an admin terminal did not solve the problem. I searched the MacAfee logs and did not see anything indicating that it was the culprit.
I solved this by instead creating a wheel file and installing it via pip. This works in my environment and does not require admin privileges:
python setup.py bdist_wheel
cd dist\
pip install mypackage-py3-none-any.whl --force
It seems like there is some deeper bug here with setuptools or whatever that is copying the files from the egg over to site-packages. Posting here to help anyone else who is hopelessly googling this issue without luck. Is this a bug that should be reported?