# Why is tensorflow required to deploy REST channel

**URL:** <https://forum.rasa.com/t/why-is-tensorflow-required-to-deploy-rest-channel/13870>\
**Category:** Rasa Open Source\
**Created:** [August 2, 2019, 4:59pm UTC](https://forum.rasa.com/t/why-is-tensorflow-required-to-deploy-rest-channel/13870 "2019-08-02T16:59:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonsku](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@Jonsku](https://forum.rasa.com/u/Jonsku)\
**Post date:** [August 2, 2019, 4:59pm UTC](https://forum.rasa.com/t/why-is-tensorflow-required-to-deploy-rest-channel/13870/1 "2019-08-02T16:59:22Z")

</div>

Hi!

I’m new to RASA and machine learning in general, meaning I got it up and running and created a relatively simple bot with it, but I’m still fuzzy on the details about how exactly it works.

Because the CPUs on my own computers do not support AVX, and I wanted to use the supervised pipeline, I am at the moment doing my development on a VPS.

I had the assumption that once I had trained a model I was happy with, I would then be able to deploy the bot (using the REST channel for instance) on my outdated laptops, in other words I assumed tensorflow would only be a requirement to train the bot, but not to make it run. So you can imagine I was slightly disappointed when

`docker run -v $(pwd)/models:/app/models rasa/rasa:latest run`

gave me the good old

`The TensorFlow library was compiled to use AVX instructions, but these aren't available on your machine.` 😭

My question is therefore two fold:

- Could someone explain why is tensorflow required at _runtime_ ?
- Is there anyway around it? 👿
- Or as an alternative, could one have a RASA core runtime depending on a tensorflow version prior to 1.5 - so it would not need AVX support - (I checked on Github, couldn’t find one), but using a model trained by the latest stable version of RASA and tensorflow ?

Thank you for your time!

Best regards.

---

<div class="post-metadata">

**Author:** ![hsm207](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/hsm207/32/2647_2.png) [@hsm207](https://forum.rasa.com/u/hsm207)\
**Post date:** [August 3, 2019, 3:49pm UTC](https://forum.rasa.com/t/why-is-tensorflow-required-to-deploy-rest-channel/13870/2 "2019-08-03T15:49:14Z")

</div>

How does the warning:

`The TensorFlow library was compiled to use AVX instructions, but these aren't available on your machine`

stop you from using Rasa?

---

<div class="post-metadata">

**Author:** ![Jonsku](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@Jonsku](https://forum.rasa.com/u/Jonsku)\
**Post date:** [August 3, 2019, 7:54pm UTC](https://forum.rasa.com/t/why-is-tensorflow-required-to-deploy-rest-channel/13870/3 "2019-08-03T19:54:54Z")

</div>

Hi, thanks for asking.

Because the docker container exits immediately after, I’m afraid this is more than a warning:

`$ docker run -p 5005:5005 -v $(pwd)/models:/app/models rasa/rasa:latest run`

`2019-08-03 19:50:33.942955: F tensorflow/core/platform/cpu_feature_guard.cc:37] The TensorFlow library was compiled to use AVX instructions, but these aren't available on your machine.`

`$ docker ps -a`

`CONTAINER ID IMAGE COMMAND CREATED STATUS`

`54cc5db882ae rasa/rasa:latest "rasa run" 3 minutes ago Exited (139) 3 minutes ago`

Are you implying it should work?

---

<div class="post-metadata">

**Author:** ![hsm207](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/hsm207/32/2647_2.png) [@hsm207](https://forum.rasa.com/u/hsm207)\
**Post date:** [August 4, 2019, 5:42am UTC](https://forum.rasa.com/t/why-is-tensorflow-required-to-deploy-rest-channel/13870/4 "2019-08-04T05:42:44Z")

</div>

Yes, it should work. I use tensorflow a lot and get that warning all the time.

I tried running your command and never got that warning. Here’s the screenshot:

![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/6/654af97c7892a0a47bbfc48e6788cac8316fbca9.png)

The models were created with the following command:

`docker run -v $(pwd):/app rasa/rasa init --no-prompt`

Can you try starting the rasa server on the model created by `rasa init`?

---

<div class="post-metadata">

**Author:** ![Jonsku](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@Jonsku](https://forum.rasa.com/u/Jonsku)\
**Post date:** [August 4, 2019, 3:20pm UTC](https://forum.rasa.com/t/why-is-tensorflow-required-to-deploy-rest-channel/13870/5 "2019-08-04T15:20:38Z")

</div>

> [@hsm207](#):
>
> docker run -v $(pwd):/app rasa/rasa init --no-prompt

I made a new empty directory and executed the command. Sadly, I get the same result:

```auto
$ docker run -v $(pwd):/app rasa/rasa init --no-prompt
2019-08-04 15:15:27.666522: F tensorflow/core/platform/cpu_feature_guard.cc:37] The TensorFlow library was compiled to use AVX instructions, but these aren't available on your machine.

```

```auto
$ ls -la
total 0
drwxr-xr-x 2 KSD staff 68 Aug 4 17:14 **.**
drwxr-xr-x 7 KSD staff 238 Aug 4 17:14 **..**

```

Actually, even `docker run -v $(pwd):/app rasa/rasa --version` produces the same result…

---

<div class="post-metadata">

**Author:** ![hsm207](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/hsm207/32/2647_2.png) [@hsm207](https://forum.rasa.com/u/hsm207)\
**Post date:** [August 4, 2019, 4:24pm UTC](https://forum.rasa.com/t/why-is-tensorflow-required-to-deploy-rest-channel/13870/6 "2019-08-04T16:24:27Z")

</div>

I’m sorry.

It turns out I misread your error.

So, yes, the standard tensorflow binary was compiled to use AVX instructions so your CPU must support this instruction set.

The workaround is to compile tensorflow yourself…

But I would suggest try installing the tensorflow version from [Anaconda](https://anaconda.org/anaconda/tensorflow) locally. You can also look at this [post](https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/Ake2BLfzzuQ) for more background info. If that works, then you can modify the docker image to uninstall the tensorflow version that came with it and use the Anaconda version instead.

---

<div class="post-metadata">

**Author:** ![Jonsku](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@Jonsku](https://forum.rasa.com/u/Jonsku)\
**Post date:** [August 5, 2019, 3:14pm UTC](https://forum.rasa.com/t/why-is-tensorflow-required-to-deploy-rest-channel/13870/7 "2019-08-05T15:14:26Z")

</div>

Ok, I will give it a shot.

I took a deeper look at the source code and I can now answer my own questions, hoping it will helpful to anyone who is starting to work with Rasa and might be wondering the same ( **!!! do correct me if some of the information below is incorrect !!!** ):

- Why is tensorflow required at _runtime_ ?

Contrary to my assumption, Rasa **does not** produce models that are independent of the machine learning library used to train them. So if you train a model using tensorflow, your model will become dependent of the tensorflow library.

- Is there anyway around it?

Nope, this is at the heart of Rasa’s architecture.

When Rasa tries to start the REST server for instance, it will attempt to load the model and validate it using the [rasa/nlu/components.py](https://github.com/RasaHQ/rasa/blob/master/rasa/nlu/components.py), `validate_requirements` method. This method itself calls [rasa/nlu/registry](https://github.com/RasaHQ/rasa/blob/master/rasa/nlu/registry.py), `get_component_class` in order to assert that the libraries required by the model are available on the system. If validation passes, then Rasa will load the appropriate pipeline of components - which have dependencies to machine learning libraries like tensorflow - to deal with the model (see [rasa/nlu/model.py](https://github.com/RasaHQ/rasa/blob/master/rasa/nlu/model.py) )
