# Windows create beat fails with /build/python-env/bin/activate: No such file or directory

**URL:** <https://discuss.elastic.co/t/windows-create-beat-fails-with-build-python-env-bin-activate-no-such-file-or-directory/70203>\
**Category:** Beats\
**Created:** [December 29, 2016, 12:10pm UTC](https://discuss.elastic.co/t/windows-create-beat-fails-with-build-python-env-bin-activate-no-such-file-or-directory/70203 "2016-12-29T12:10:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mast](https://avatars.discourse-cdn.com/v4/letter/m/e274bd/32.png) [@mast](https://discuss.elastic.co/u/mast)\
**Post date:** [December 29, 2016, 12:10pm UTC](https://discuss.elastic.co/t/windows-create-beat-fails-with-build-python-env-bin-activate-no-such-file-or-directory/70203/1 "2016-12-29T12:10:21Z")

</div>

Hi,

Trying to build a custom beat on windows but the command "make setup" fails with:  
[path to custom beat folder]/build/python-env/bin/activate: No such file or directory

Seems like there is something wrong with the virtualenvironment, but I fail to understand the cause.

I have go (1.7.4 windows/amd64), python (2.7.13 win/amd64) and virtualenv(15.1.0) installed. What can be the reason? What is it I'm missing? I'm running cygwin when executing the make call.

BR  
Mathias

---

<div class="post-metadata">

**Author:** ![mast](https://avatars.discourse-cdn.com/v4/letter/m/e274bd/32.png) [@mast](https://discuss.elastic.co/u/mast)\
**Post date:** [December 29, 2016, 2:03pm UTC](https://discuss.elastic.co/t/windows-create-beat-fails-with-build-python-env-bin-activate-no-such-file-or-directory/70203/2 "2016-12-29T14:03:44Z")

</div>

Or if anyone succefully installed a custom beat on windows and would like to share how this puzzle was solved, it would be appreciated!

BR  
Mathias

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [December 29, 2016, 3:10pm UTC](https://discuss.elastic.co/t/windows-create-beat-fails-with-build-python-env-bin-activate-no-such-file-or-directory/70203/3 "2016-12-29T15:10:09Z")

</div>

When I do Beat development on Windows I stick to the basic commands for building the go code (`go build`) and testing it (`go test`). I do the index template generation and packaging on linux (using cross-compilation).

The `make` targets were not written with Windows in mind. But if you find a specific bug that can be fixed in a way that it works across linux and windows then let's get it fixed. I would like it to be more Windows friendly.

You'll see from the main projects [.appveyor.yml](https://github.com/elastic/beats/blob/master/.appveyor.yml) that we don't use `make` in our CI setup for Windows. Some of the official Beats have a helper [`make.bat`](https://github.com/elastic/beats/blob/master/winlogbeat/make.bat) that is used when on Windows to build and test.

It sounds like there is a problem with the `make python-env` target. Maybe you can step through the [commands](https://github.com/elastic/beats/blob/master/libbeat/scripts/Makefile#L186-L195) that it runs to see what's happening and if/where the environment is written. It's supposed to go into the beat's `build/python-env` dir.

---

<div class="post-metadata">

**Author:** ![mast](https://avatars.discourse-cdn.com/v4/letter/m/e274bd/32.png) [@mast](https://discuss.elastic.co/u/mast)\
**Post date:** [December 30, 2016, 8:25am UTC](https://discuss.elastic.co/t/windows-create-beat-fails-with-build-python-env-bin-activate-no-such-file-or-directory/70203/4 "2016-12-30T08:25:53Z")

</div>

Hi Andrew,

I got it to work with make setup on win with cygwin.  
Manually create the virtualenv [beat-dir]/python-env

Change the following files below elastic/beats/libbeat/scripts:  
Makefile set:  
PYTHON\_ENV?=python-env  
Replace all:  
${PYTHON\_ENV}/bin/activate  
To:  
${PYTHON\_ENV}/Scripts/activate

generate\_fields\_docs.py:  
Somewhere around Line 108-110  
args = parser.parse\_args()  
if args.path.startswith("/cygdrive/"):  
args.path = args.path[len('/cygdrive/'):len('/cygdrive/') + 1] + ":" + args.path[len("/cygdrive/") + 1:]

generate\_template.py:  
Somewhere around line 303-305  
args = parser.parse\_args()  
if args.path.startswith("/cygdrive/"):  
args.path = args.path[len('/cygdrive/'):len('/cygdrive/') + 1] + ":" + args.path[len("/cygdrive/") + 1:]

generate\_index\_pattern.py  
Somewhere around line 114-116  
args = parser.parse\_args()  
if args.beat.startswith("/cygdrive/"):  
args.beat = args.beat[len('/cygdrive/'):len('/cygdrive/') + 1] + ":" + args.beat[len("/cygdrive/") + 1:]

This is a hack and not generalized at all, but for my simple purpose it works. This will give you a hint on what needs to be changed.

No attaching of files here so I uploaded my fix here:  
[http://s000.tinyupload.com/?file\_id=00340893578855435437](http://s000.tinyupload.com/?file_id=00340893578855435437)  
BR Mathias

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [January 3, 2017, 9:13am UTC](https://discuss.elastic.co/t/windows-create-beat-fails-with-build-python-env-bin-activate-no-such-file-or-directory/70203/5 "2017-01-03T09:13:12Z")

</div>

Thanks for sharing. Could be worth adding to our scripts. In python we could detect the OS, in the Makefile we could make `activate` a variable and just overwrite it for windows runs? @andrewkroh WDYT? Will this work on appveyor?

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [January 3, 2017, 3:13pm UTC](https://discuss.elastic.co/t/windows-create-beat-fails-with-build-python-env-bin-activate-no-such-file-or-directory/70203/6 "2017-01-03T15:13:15Z")

</div>

For the cygdrive changes we would want to detect the cygwin usage since those changes are not needed if you just run the script manually in a Powershell.

For the choice between `/Scripts/activate` and `/bin/activate` in the Makefile I assume that choice could be made based on the OS. Maybe another option is to always `mv ${PYTHON_ENV}/Scripts/activate ${PYTHON_ENV}/bin/activate` after running virtualenv to normalize things and ignore the `mv` error that would occur on non-Windows.

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [January 5, 2017, 11:27am UTC](https://discuss.elastic.co/t/windows-create-beat-fails-with-build-python-env-bin-activate-no-such-file-or-directory/70203/7 "2017-01-05T11:27:52Z")

</div>

@mast Interested to open a PR or a Github issue with this?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 19, 2017, 12:10pm UTC](https://discuss.elastic.co/t/windows-create-beat-fails-with-build-python-env-bin-activate-no-such-file-or-directory/70203/8 "2017-01-19T12:10:26Z")

</div>

This topic was automatically closed after 21 days. New replies are no longer allowed.
