No module named 'tensorflow'

Hi I’m new to starting my journey into Deep learning and I’m setting up my Knime to run this first example but I think I’ve missed a trick here - I’ve followed a number of guides and I always seem to get to this point on the pre-processing node on the tokenizing node at the following python code:

# Copy input to output
import tensorflow as tf
import tensorflow_hub as hub
import bert

ERROR Python Script (1⇒1) 4:108:0:164:113 Execute failed: No module named ‘tensorflow’
Traceback (most recent call last):
File “”, line 2, in
ModuleNotFoundError: No module named ‘tensorflow’

I’m running on a fresh Knime 4.2, Python 3.6.1, Conda 4.8.4, Updated my GPU drivers and CUDA, Visual C and others - I think I’m missing something stupid here!?

any help would be appreciated!

Thanks

The issue most likley is, that in your example you are using a Python Script 1=>1 node but in the screen shot you are showing the dialog for the “Special deep learning configuration”.

The dialog you show sets up python environment for the specific Tensorflow and Keras nodes:

image

But you are using a Python Scripting node which uses the “standard” knime python environment, not the “special” one for deep learning.

Eg. there are 2 places to configure python and each can use a different environment. In your case the “standard” Python env which is used by the Python Scripting Node does not have Tensorflow installed and hence the error. You will need to use the special Python deeplearning nodes.

1 Like

AH - OK thanks - that helps & makes sense! so I’ve used the environment Knime has built for the deep learning nodes with the regular python config and it will load tensorflow but not bert! - was there another think I needed to install manually for BERT?

ERROR Python Script (1⇒1) 0:108:0:164:113 Execute failed: No module named ‘bert’
Traceback (most recent call last):
File “”, line 4, in
ModuleNotFoundError: No module named ‘bert’

Or some extra steps needed for BERT?

Thanks!!!

I assume you need to install it separatley. KNIME only handles keras and TF intstall.

OK - there is a hint in the details that the bert-for-tf2 needs to be available in the python packages - I’m able to install bert-for-tf2 with pip but I can’t conda install --name to make it as part of my environment - is there some further documentation you can recommend and I can post the eventual resolution?

Do I need to build my own YML file?

Thanks!

I think it would be good for you to learn about what conda, what pip is etc how the whole ecosystem works before even trying to jump into deep learning. If you need constant handholding now, it will only get worse.

Having that said you can easily install anything from pip in an conda environment. activate the environment and then it’s just pip install <package-name>

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.