For several days I have been completely stuck with a persistant error that stops ipython from launching.
Background: I am running python on Windows 10 using the 64-bit build downloaded from https://www.python.org/. I am using pip and running python and ipython from the mobaxterm terminal. I had been able to run ipython for the past couple of years this way without issue.
The error: Unfortunately, after a recent pip package update, ipython now fails to launch and returns the following message:
Python 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.0.1 -- An enhanced Interactive Python. Type '?' for help.
Traceback (most recent call last):
File "C:\Users\Andrew Friedman\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\Andrew Friedman\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\Andrew Friedman\AppData\Local\Programs\Python\Python39\Scripts\ipython.exe\__main__.py", line 7, in <module>
sys.exit(start_ipython())
File "C:\Users\Andrew Friedman\AppData\Local\Programs\Python\Python39\lib\site-packages\IPython\__init__.py", line 123, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "C:\Users\Andrew Friedman\AppData\Local\Programs\Python\Python39\lib\site-packages\traitlets\config\application.py", line 845, in launch_instance
app.initialize(argv)
File "C:\Users\Andrew Friedman\AppData\Local\Programs\Python\Python39\lib\site-packages\traitlets\config\application.py", line 88, in inner
return method(app, *args, **kwargs)
File "C:\Users\Andrew Friedman\AppData\Local\Programs\Python\Python39\lib\site-packages\IPython\terminal\ipapp.py", line 283, in initialize
self.init_code()
File "C:\Users\Andrew Friedman\AppData\Local\Programs\Python\Python39\lib\site-packages\IPython\core\shellapp.py", line 315, in init_code
sys.stderr.flush()
AttributeError: 'NoneType' object has no attribute 'flush'
The distressing thing is that I'm unable to get back to the previous ipython functionality, so it is now completely unusable. I have removed and reinstalled python and all of my pip packages several times, and removed the .ipython/ directory, but I continue to get the same error. It persists even when I downgrade python or ipython back to earlier versions.
Does anyone have any suggestions how I can address this?