# EF2: "Permission denied:" when deploying python extension on Windows ActiveGate

**URL:** <https://community.dynatrace.com/t/ef2-permission-denied-when-deploying-python-extension-on-windows-activegate/48622>\
**Category:** Extensions\
**Tags:** extensions\
**Created:** [October 29, 2024, 9:41pm UTC](https://community.dynatrace.com/t/ef2-permission-denied-when-deploying-python-extension-on-windows-activegate/48622 "2024-10-29T21:41:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [October 29, 2024, 9:41pm UTC](https://community.dynatrace.com/t/ef2-permission-denied-when-deploying-python-extension-on-windows-activegate/48622/1 "2024-10-29T21:41:07Z")

</div>

I have developed an EF2 extension that has to be deployed on a Windows server. It is giving a “Permission denied:” error in the logs, when it is being deployed:

```markup
2024-10-29 20:56:21.774 UTC [000018b8] warning [native] Failed to prepare extension environment:
 	id: f_7462894110209093396
 	datasource: python:3.10
 	time elapsed: 1.44s
 	command: "C:\ProgramData\dynatrace\remotepluginmodule\agent\runtime\extensions\python_venvs\custom_abc_0.0.2\Scripts\python.exe" -m pip install --no-warn-script-location --no-cache-dir --no-index -f C:\ProgramData\dynatrace\remotepluginmodule\agent\runtime\extensions\cache\custom_abc\0.0.2/lib abc
 	error: Traceback (most recent call last):
   File "C:\Program Files\dynatrace\remotepluginmodule\agent\res\dsruntime\python3.10\lib\runpy.py", line 196, in _run_module_as_main
     return _run_code(code, main_globals, None,
   File "C:\Program Files\dynatrace\remotepluginmodule\agent\res\dsruntime\python3.10\lib\runpy.py", line 86, in _run_code
     exec(code, run_globals)
   File "C:\Program Files\dynatrace\remotepluginmodule\agent\res\dsruntime\python3.10\lib\site-packages\pip\ __main__.py", line 22, in <module>
     from pip._internal.cli.main import main as _main
   File "C:\Program Files\dynatrace\remotepluginmodule\agent\res\dsruntime\python3.10\lib\site-packages\pip\_internal\ __init__.py", line 3, in <module>
     from pip._internal.utils import _log
   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
   File "<frozen importlib._bootstrap_external>", line 879, in exec_module
   File "<frozen importlib._bootstrap_external>", line 1016, in get_code
   File "<frozen importlib._bootstrap_external>", line 1073, in get_data
 PermissionError: [Errno 13] Permission denied: 'C:\\Program Files\\dynatrace\\remotepluginmodule\\agent\\res\\dsruntime\\python3.10\\lib\\site-packages\\pip\\_internal\\utils\\ __init__.py'

2024-10-29 20:56:21.774 UTC [000018b8] warning [native] std ouput from ""C:\Program Files\dynatrace\remotepluginmodule\agent\res\dsruntime\python3.10\bin\python.exe" -m venv C:\ProgramData\dynatrace\remotepluginmodule\agent\runtime\extensions\python_venvs\custom_abc_0.0.2 --system-site-packages --without-pip" command:

 std ouput from ""C:\ProgramData\dynatrace\remotepluginmodule\agent\runtime\extensions\python_venvs\custom_abc_0.0.2\Scripts\python.exe" -m pip install --no-warn-script-location --no-cache-dir --no-index -f C:\ProgramData\dynatrace\remotepluginmodule\agent\runtime\extensions\cache\custom_abc\0.0.2/lib abc" command:

2024-10-29 20:56:21.775 UTC [000018b8] info [native] Rejected fastcheck for task f_7462894110209093396 -

```

It’s not a certificate issue, as another modified WMI extension is working OK in the server. It is the first python extension though.

Another interesting thing is that the \_\_init\_\_.py referenced is a 0 byte python file. It doesn’t seem to have any permission issues though. The environment is a restricted environment, with no Internet connectivity.

Has anyone got any issue similar to this, developing custom extensions in Windows AGs?

---

<div class="post-metadata">

**Author:** ![MostafaHussein](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mostafahussein/32/2785_2.png) [@MostafaHussein](https://community.dynatrace.com/u/MostafaHussein)\
**Post date:** [October 29, 2024, 10:20pm UTC](https://community.dynatrace.com/t/ef2-permission-denied-when-deploying-python-extension-on-windows-activegate/48622/2 "2024-10-29T22:20:40Z")

</div>

- I’ve faced the same issue when activating **venv** while testing locally, and it worked well when I deactivated **venv**.

- other thing, this may because of you’ve dependencies is already installed in your development environment but not included in setup.py under `install_requires` or `extra_requires` as the following figure

 ![MostafaHussein_0-1730239672205.png](https://global.discourse-cdn.com/dynatrace/original/3X/3/c/3c9ce09c9005d8c9a903990841d39fb3275475a6.png)

- regarding **\_\_init\_\_.py** it makes python treats the current directory as package and it was important for defining the namespace of the **.py** files included in the same directory (before version 3.3) as the namespace of each class take the same name of the current directory of the **\_\_init\_\_.py** , Since python version 3.3 it’s automatically build namespaces and this file became optional.

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [October 30, 2024, 10:55pm UTC](https://community.dynatrace.com/t/ef2-permission-denied-when-deploying-python-extension-on-windows-activegate/48622/3 "2024-10-30T22:55:05Z")

</div>

[@MostafaHussein](https://community.dynatrace.com/user/66935),

It doesn’t seem to be related to my extension. It’s complaining about the \_\_init\_\_.py file that comes inside pip, inside the python distributed with AG:

```markup
C:\Program Files\dynatrace\remotepluginmodule\agent\res\dsruntime\python3.10\lib\site-packages\pip\_internal\utils\ __init__.py

```

In the meantime, I tried the trick of putting in a “#” in the file, so it isn’t 0 bytes, but that didn’t help either.
