# Tensorflow: "No protocol specified"

**URL:** <https://deeptalk.lambda.ai/t/tensorflow-no-protocol-specified/3090>\
**Category:** Technical Help\
**Created:** [July 12, 2022, 2:46am UTC](https://deeptalk.lambda.ai/t/tensorflow-no-protocol-specified/3090 "2022-07-12T02:46:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tschmah](https://avatars.discourse-cdn.com/v4/letter/t/c57346/32.png) [@tschmah](https://deeptalk.lambda.ai/u/tschmah)\
**Post date:** [July 12, 2022, 2:46am UTC](https://deeptalk.lambda.ai/t/tensorflow-no-protocol-specified/3090/1 "2022-07-12T02:46:22Z")

</div>

I have Ubuntu 20.04 with a Lambda stack that was provided at time of purchase of my workstation and updated today using “sudo apt-get update && sudo apt-get dist-upgrade”

I created a virtual environment for testing:  
python3 -m venv --system-site-packages testenv  
source testenv/bin/activate

Within this environment, I am able to use tensorflow successfully via a jupyter notebook, however I get an error message “No protocol specified” if I start a python session from the command line and then import tensorflow:

> > > import tensorflow as tf  
> > > No protocol specified

What does this error mean? Do I need to set up an environment variable?

---

<div class="post-metadata">

**Author:** ![markd](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@markd](https://deeptalk.lambda.ai/u/markd)\
**Post date:** [July 22, 2022, 1:07am UTC](https://deeptalk.lambda.ai/t/tensorflow-no-protocol-specified/3090/2 "2022-07-22T01:07:07Z")

</div>

I am guessing it is failing the same way without venv also.  
From searches it shows references to issues with DISPLAY.

$ python -c ‘import tensorflow as tf ; print("\nTensorflow version: ",tf. **version** , "\nTensorflow file: ",tf. **file** )’

Tensorflow version: 2.8.0  
Tensorflow file: /usr/lib/python3/dist-packages/tensorflow/ **init**.py

I have not been able to repeat this.

I have seen a similar issue once with two processes running on the same machine with Tensorboard. As it was using a invalid port (one reserved for X11)

TensorBoard on the default port of 6006 \* (6000 - 6007 are reserved for X11)  
If this is a Tensorboard in the job you can change Tensorboard to use port 9000.

It would get stuck trying to start orted (part of MPI).

---

<div class="post-metadata">

**Author:** ![tschmah](https://avatars.discourse-cdn.com/v4/letter/t/c57346/32.png) [@tschmah](https://deeptalk.lambda.ai/u/tschmah)\
**Post date:** [July 24, 2022, 4:28pm UTC](https://deeptalk.lambda.ai/t/tensorflow-no-protocol-specified/3090/3 "2022-07-24T16:28:14Z")

</div>

Thank you for your thoughts, markd. You are correct that it fails the same way without venv also:

$ python -c ‘import tensorflow as tf’  
No protocol specified

$ python --version  
Python 3.8.10

I agree that the problem seems to be something to do with displays. I’m not using TensorBoard.

---

<div class="post-metadata">

**Author:** ![markd](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@markd](https://deeptalk.lambda.ai/u/markd)\
**Post date:** [August 1, 2022, 3:39am UTC](https://deeptalk.lambda.ai/t/tensorflow-no-protocol-specified/3090/4 "2022-08-01T03:39:06Z")

</div>

Another way to find out what is happening is run your code with:  
$ strace python -c ‘import tensorflow as tf’ \>& tensorflow-strace.txt

- You can send that output file here or contact ‘support@lambdal.com’  
with that file and nvidia-bug-report.log.gz from ‘sudo nvidia-bug-report.sh’

The two main commands would be if you are ssh’ing into the machine:

1. Enable X11 forwarding (it can be disabled at the client or server level also).  
$ ssh -X machine  
You can check the server setting:  
$ grep X /etc/ssh/sshd\_config
2. You can play with:  
a. ‘xhost +’ will give access to anybody to connect to your display (okay to test, but I would not keep it that way). I would recommend xhost +local:[hostname or ip]  
(NOTE: To remove xhost setting: ‘xhost -’)  
$ xhost +\<mymachine or IP\>  
example: xhost +10.0.0.2  
b. Set the DISPLAY  
$ export DISPLAY=:0.0  
c. xauth:  
$ xauth merge xauth\_extract  
or remote host via ssh:  
$ xauth extract - $DISPLAY | ssh user@\<machine or IP\> xauth merge -
