Jupyter notebook not initializing correctly without error message - python

I am having trouble with Jupyter Notebooks (with Anaconda) on a Windows 10 PC from work.
Yesterday I left the laptop running a little script on a Jupyter-Notebook, forgot to check it and it turned off due to battery.
Today, when I open Jupyter-Notebook I cannot use it at all. Here I share some screenshots.
The CMD output when launching Jupyter-Notebook (some info deleted since its a corporate pc, such as user).
The "landing page"
When I create a new python file.
As you can see, no error message is displayed on the cmd but the application is useless. I cannot see any existing documents or browse folders to open anything. When I start a new file it just stays in "about-blank".
I would need some help to get this working again, thanks a lot in advance!
update
When in firefox I go to the console I find that the error is generated by cookie config. It says something like
"Some cookies are making an incorrect use of recommended attribute
"SameSite" The cookie "username-localhost-8888" will be rejected soon
because it has the attribute "<SameSite" set to "none" or an invalid
value without "secure".
I have not yet found how to change this.
It also says
Uncaught TypeError: "#element".tooltip is not a function

Related

Python application using eel "unable to connect" to localhost on startup

I am trying to create a python application while using eel to create a user interface in html. My operating system is Ubuntu Linux and I'm using Firefox to display the web interface.
The problem I'm having is every time I run the python code, Firefox opens a blank page saying "Unable to connect" followed by "Firefox can't establish a connection to the server at localhost:8000". However, if I click the "Try Again" button once, twice, or three times, my interface is displayed.
Once open, I can navigate to different pages but I also noticed that once I navigate to a different page, some of my javascript stops working (specifically a window.close() function). I don't know if this is related but I thought I would mention it just in case.
Any advice on the matter would be greatly appreciated.
Thank you.
I changed my browser from firefox to chromium and now my interface loads on startup the first time. I know some documentation says it can be used with firefox, and it can, but it seems to be kind of buggy and works better with other browsers.
However, I'm still having trouble with my javascript not running but that will be another question.

Unable to run smallest windows service in Python

According to this answer I created a smallest Windows service in Python.
Then I ran successfully:
python.exe smallest_service.py install
and
python.exe smallest_service.py start
with error message
Starting service SmallestPythonService
Error starting service: The
service did not respond to the start or control request in a timely
fashion.
My Python version is Python 3.9.6
pip freeze
pypiwin32==223
pywin32 # file:///C:/Users/me/Downloads/pywin32-301-cp39-cp39-win_amd64.whl
How can I fix it?
Here are the list of scenarios one may see -> Error starting service: The service did not respond to the start or control request in a timely fashion.
Missing DLL file: Another instance of the error occurs when you have a missing DLL file on your computer which is used by numerous other applications as well. If this DLL file is in conflict or isn’t present at all, you will experience the error message.
Corrupt/missing system files: Another instance of why this issue occurs is because there are corrupt or missing system files on your computer. If the very installation of Windows is not proper and has issues, you will experience numerous problems including the error message under discussion.
Outdated Windows: Microsoft officially recognized this error message on their official website and even released a temporary hotfix to solve the problem. However, recently they removed the hotfix and instructed users to upgrade to the latest iteration of Windows.
Solutions
The very first thing which we should try is changing the timeout settings of your services through your registry editor. Whenever a service is requested to launch, a timer is started with a predefined value. If the service doesn’t start within this time frame, the error message comes forward reporting so. Here in this solution, we will navigate to your computer’s registry and change the value. If it isn’t present, we will create a new key for it.
-> Press Windows + R, type “regedit” in the dialogue box and press Enter.
Once in the registry editor, navigate to the following file path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
-> search for the key of ‘ServicesPipeTimeout’. If you find it already there, you can move to directly edit. However, if you don’t find the entry, select Control, right-click on any space present at the right side of the screen and select New > DWORD
-> Name the key as ‘ServicesPipeTimeout’ and set the value as 180000 (You can also right-click the value and click Modify if the option to set the value didn’t come in your case.
-> Save changes and exit. Restart your computer completely and then try launching the service. Check if the issue is resolved.
Solution 2: Getting Ownership of the Application
Another rare case that we came across was not having the ownership of the application caused the application not to execute the service properly. This makes sense as if the application doesn’t have enough elevated access, it will not be able to send/read the response to/from a service (especially if it is a system service). In this article, we will navigate to the executable of the application and then change the ownership to our username. If successful, this will solve the problem of getting the error 1053.
Bonus Tip
Making sure .NET Frameworks are in sync: If the application/service which you are trying to launch is on another Framework than that of the hosting machine, you will experience issues. Make sure that the frameworks are in sync.
If that doesn't work for you. It might be interesting to use NSSM. It is an easy piece of code that makes any py file into a windows service.
I've also found that most service creators only work with 32bit Python, so that might also be interesting to look at.

Running Python script as Executable

I have been attempting to run my python script as a service, and have followed the advice contained in several previous forum posts. However, these have not helped me thus far. Here is what I have attempted up until now:
Used an SMWinservice class that allowed me to install my Python script as a service. This solution, however, would not launch. If I would try to start it, I would receive an error message.
I have tried using NSSM with : nssm install myService pathToInterpreter PathToScript. Note, all files etc. can be found in the local directory of the PathToScript. For what its worth, I also tried using the GUI version of NSSM. When I rebooted my computer, it showed as "Paused" in task manager. I stopped it, and then tried to run it again, and I received an error. I have tried NSSM with both python.exe and pythonw.exe.
I suspect that a possible source of error is the fact that my program uses a text file as a configuration file. This configuration file has been coded as being in my local working directory. However, I wouldn't think this would be an issue with NSSM. I know for a fact that my program will completely exit, using the exit command, if the configuration file is not found.
I was thinking of doing a batch file and starting the batch file with the script and running it like that, but I prefer a service since it can monitor the process, can restart it, or windows can notify me via email if there is an issue with my service.
For completeness, I should also mention that the program runs without issue outside of a service. For the reason that the program runs as expected, I decided to not post the code, unless someone would like to see it for whatever reason.

Jupyter notebook not opening from Centos 7

I have recently installed jupyter notebook on Centos 7. I have been trying to get it launched on my browser from past 2 days and have tried every answer on stack overflow. It stopped showing " No web browser found " when i type it on the command terminal. But when i copy and paste the link onto the google chrome browser it's showing, This site can't be reached.
How will i resolve this issue?
If you follow carefully the instructions on this post, you'll solve your problem.
I went through the same situation and followed these steps.
https://techknight.eu/2016/01/03/setup-jupyter-notebook-centosrhel-7/
The key is to :
Modify the configuration .py file with your desired values (specially the IP on wich the notebook will run).
Allow the port you're gonna use throug the CentOS firewall
In any case, if you break the configuration and you need a fresh start, you can always do:
jupyter notebook --generate-config
And the file will regenerate with default values.
Good Luck

Jupyter Notebook becomes unresponsive after inactivity for a while, does not log to terminal

This is a strange thing that I've noticed only for a particular computer. If I leave the Jupyter Notebook page inactive for a while (without closing the browser page or putting the computer to sleep) and come back to it, the kernel would appear to be completely unresponsive; but it wouldn't say "Kernel Dead" either. Restarting the kernel from the Jupyter Notebook does nothing so I always ended up having to close the command window from which Jupyter Notebook was run, and it goes without saying that all the variables were lost.
Whenever this happens, any activity on the Jupyter Notebook page following its "death" is not logged in the command window that runs it.
Tried searching around on GitHub which might have been a more appropriate channel with no luck.
I'd be happy to provide more info. Thanks!
This wight not be a helpful answer as it will not address the root cause of the problem but rather present a workaround. The kernel is an independent process from the browser so you can close the browser tab and reopen it (e.g http://localhost:8888/) and it connects to the still running kernel without any problems.

Categories