I can't access Pynq Z2 via browser after altering jupyter_notebook_config.py

Hello,

I am using the Pynq Z2 board to code a project. I have been accessing the Jupyter Notebook by connecting the board to a router that my PC is also connected to by LAN-cable. I used to be able to access it by using the address “http://pynq:9090/”.

But yesterday I altered the file jupyter_notebook_config.py so I could send data from my PC to the Jupyter Notebook. I altered it with the following steps:

  1. I typed “jupyter notebook --generate-config” in a terminal

  2. I opened the file jupyter_notebook_config.py which was located in “/home/root/.jupyter/jupyter_notebook_config.py”

  3. I added the lines “c.NotebookApp.allow_origin = ‘*’” and “c.NotebookApp.ip = ‘0.0.0.0’”

  4. I ran the following in the terminal: “sudo ufw allow 8888”

After doing this I was able to send strings from my PC to the Jupyter Notebook using sockets. But when I try to access the Notebook today the connection simply fails.

I don’t know what exactly I did wrong and how I can fix it. Could someone please give me help?

Edit: Found a typo in the path for jupyter_notebook_config.py in my post here and corrected it

Edit2: Clarified the previous edit

Edit3: I have since regained access to the Jupyter Notebook by flashing a new image to the SD card. My question now is: Why did this outcome occur after those modifications?

1 Like

Hi,
Do you still have a connection issue after repairing the path for jupyter_notebook_config.py?

Sorry, I meant that I wrote the path incorrectly in my post here in the discussion. I can’t access the Jupyter Notebook at all

When you delete the lines “c.NotebookApp.allow_origin = ‘*’” and “c.NotebookApp.ip = ‘0.0.0.0’”, do you recover the ability to connect to the board? You can delete those lines by flashing a previous image in the SD card, as you still remember the modifications you made.
When you say you cannot connect, that means you cannot modify directly the codes anymore?

When I say that “I cannot connect to the Jupyter Notebook” I mean that when I try to access the Jupyter Notebook on the FPGA with my web browser (firefox) using the address “http://pynq:9090/”, the browser simply returns:

unable to connect

firefox can’t establish a connection to the server at pynq:9090

This has so far been the only way for me to connect to the Jupyter Notebook.
I have the latest version of the SD card image on my PC and can flash it. Should I do so?

I thought about deleting the modifications you made. Since you cannot access to the code because you cannot connect to the board, you could reinitialize the code by flashing the previous image you used without the modifications.
With that, if you can access to the board that means your modifications were not valid. If not, the issue is somewhere else.

Flashed a new image and I can now access the board. I guess the modifications were not valid. I have no idea what I did wrong.

I did lose a bit of work, but all important work was uploaded to a git repository which I can now retrieve.

Should I mark this problem as solved or not now?

You can keep the issue open, just ask where the problem is in your modifications.

Why did you add the lines “c.NotebookApp.allow_origin = ‘*’” and “c.NotebookApp.ip = ‘0.0.0.0’” ?

Is sudo ufw allow 8888 allowing the “port 8888” for a ssh connection?

Your questions made me re-examine my code and reread the motivation behind the edits to jupyter_config.py and “sudo ufw allow 8888”.

I have come to the rather embarrassing conclusion that they had no relevance to what I was trying to achieve and in fact were counterproductive. The reason I was able to send those strings that I mentioned in my original post was due to an alteration to a different code block in my project and I simply misattributed the reason it worked to the unnecessary edits and command.

I tried using the code without them and not only was I able to send strings of text again, but when I turned off and on the FPGA I was able to access Jupyter Notebook again. All of this happened because of me misunderstanding what had happened.

I think I can continue with my project now even though I technically didn’t get my question answered. Thank you for your help. Should I mark this as answered?

If you have no more issue (even if the coding question was not answered), you can close this request by marking your message as the solution.