# Using %TAP\_PATH% in package action steps

**URL:** https://forum.opentap.io/t/using-tap-path-in-package-action-steps/682
**Category:** Technical
**Created:** [May 6, 2022, 11:31am UTC](https://forum.opentap.io/t/using-tap-path-in-package-action-steps/682 "2022-05-06T11:31:02Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![tatiana.boye](https://avatars.discourse-cdn.com/v4/letter/t/ba8739/32.png) [@tatiana.boye](https://forum.opentap.io/u/tatiana.boye)
#### Post date: [May 6, 2022, 11:31am UTC](https://forum.opentap.io/t/using-tap-path-in-package-action-steps/682/1 "2022-05-06T11:31:02Z")

</div>

I’d like my OpenTAP package to install Python dependencies specified in a requirements.txt file within the install action. I’m currently using Windows.

The following works fine:

```csharp
  <PackageActionExtensions>
    <ActionStep ExeFile="pip" Arguments='install -r "C:\Program Files\OpenTAP\Packages\Python\my_plugin_name\requirements.txt"' ActionName="install" />
  </PackageActionExtensions>

```

However, when I use `"%TAP_PATH%\Packages\Python\my_plugin_name\requirements.txt"` instead of hardcoding the path, I’m getting the following error:

`13:23:05.582 Plugin ERROR: Could not open requirements file: [Errno 2] No such file or directory: '%TAP_PATH%\\Packages\\Python\\my_plugin_name\\requirements.txt'`

Using `pip install -r "%TAP_PATH%\Packages\Python\my_plugin_name\requirements.txt"` from cmd line doesn’t cause any issues.

I also tried a few more things:

- using relative path (similarly to an [example in the documentation](https://doc.opentap.io/Developer%20Guide/Plugin%20Packaging%20and%20Versioning/#packaging-configuration-file))
- using `/` instead of `\`

… but nothing seems to work except for the full hardcoded path. Am I missing something?

---

<div class="post-metadata">

### Author: ![alexander.larsen](https://avatars.discourse-cdn.com/v4/letter/a/9d8465/32.png) [@alexander.larsen](https://forum.opentap.io/u/alexander.larsen)
#### Post date: [May 6, 2022, 12:12pm UTC](https://forum.opentap.io/t/using-tap-path-in-package-action-steps/682/2 "2022-05-06T12:12:06Z")

</div>

It should work using a relative path, since package install actions are always executed from the directory containing the `tap` executable. Did you try `Packages/Python/my_plugin_name/requirements.txt` ? If that doesn’t work I would call it a bug.

Edit:  
And I should add that environment variables are never expanded in `ActionStep` elements, so %TAP\_PATH% / $TAP\_PATH will be treated as a literal string

---

<div class="post-metadata">

### Author: ![tatiana.boye](https://avatars.discourse-cdn.com/v4/letter/t/ba8739/32.png) [@tatiana.boye](https://forum.opentap.io/u/tatiana.boye)
#### Post date: [May 6, 2022, 12:24pm UTC](https://forum.opentap.io/t/using-tap-path-in-package-action-steps/682/3 "2022-05-06T12:24:05Z")

</div>

Thanks for the clarification about the env variables in action steps.

Regarding the relative path, I’ve already tried that as documentation suggests this way indeed. It causes a similar error: `14:19:54.191 Plugin ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'Packages/Python/my_plugin_name/requirements.txt'`

---

<div class="post-metadata">

### Author: ![alexander.larsen](https://avatars.discourse-cdn.com/v4/letter/a/9d8465/32.png) [@alexander.larsen](https://forum.opentap.io/u/alexander.larsen)
#### Post date: [May 6, 2022, 12:57pm UTC](https://forum.opentap.io/t/using-tap-path-in-package-action-steps/682/4 "2022-05-06T12:57:00Z")

</div>

I just created a small example package to test this, and it seems to work fine for me:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Package Name="MyPythonPlugin" xmlns="http://opentap.io/schemas/package" InfoLink="" Version="0.1.0-alpha" OS="Windows,Linux">
    <Description>This is my OpenTAP plugin package.</Description>
    <Files>
        <File Path="Packages/Python/MyPlugin/requirements.txt" SourcePath="requirements.txt"/>
    </Files>
    <PackageActionExtensions>
        <ActionStep ExeFile="pip" Arguments="install -r Packages/Python/MyPlugin/requirements.txt" ActionName="install"></ActionStep>
    </PackageActionExtensions>
</Package>

```

Can you share your `package.xml` file?

---

<div class="post-metadata">

### Author: ![tatiana.boye](https://avatars.discourse-cdn.com/v4/letter/t/ba8739/32.png) [@tatiana.boye](https://forum.opentap.io/u/tatiana.boye)
#### Post date: [May 6, 2022, 1:08pm UTC](https://forum.opentap.io/t/using-tap-path-in-package-action-steps/682/5 "2022-05-06T13:08:12Z")

</div>

Looking at your example I was able to spot the difference: you added the `requirements.txt` explicitly whereas I forgot. I was not getting errors when using the full path because the file was present in this folder due to a directory junction from my source code. My guess it was not taken into account by Package manager as it was not “owning” it.

Thanks for your help!

---

<div class="post-metadata">

### Author: ![alexander.larsen](https://avatars.discourse-cdn.com/v4/letter/a/9d8465/32.png) [@alexander.larsen](https://forum.opentap.io/u/alexander.larsen)
#### Post date: [May 6, 2022, 1:09pm UTC](https://forum.opentap.io/t/using-tap-path-in-package-action-steps/682/6 "2022-05-06T13:09:43Z")

</div>

Great, I’m glad you worked it out.

Happy tapping!
