When I try to start (any) jupyter notebook directly, I get the following error:
Traceback (most recent call last):
File "/usr/bin/jupyter-notebook", line 11, in <module>
sys.exit(main())
File "/usr/lib/python2.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/usr/lib/python2.7/site- packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/usr/lib/python2.7/site-packages/notebook/notebookapp.py", line 1784, in start
self.launch_browser()
File "/usr/lib/python2.7/site-packages/notebook/notebookapp.py", line 1742, in launch_browser
with open(fd, 'w', encoding='utf-8') as fh:
TypeError: coercing to Unicode: need string or buffer, int found
However, if I only start jupyter on some directory, I can open notebooks through browser just fine.
jupyter version: 4.4.0
python version: 2.7.15
OS: Fedora 29
It was a problem introduced in notebook=5.7.3. Running with 5.7.2 works.
The problem was introduced in #4260 and backported to the 5.7.x branch in #4265.
Fix at #4340.
Fix should be part of notebook 5.7.5 when it is released.
More info at GitHub
Assuming you are using the Anaconda for Jupyter Notebook, try using the update option. Use the following code "conda update anaconda" in the Terminal.
Related
I was running python 2.7 in Anaconda2 in spyder 4 up until today with no problems. But now I keep getting the same error, when I make an environment and install python 2.7 and spyder in it:
Traceback (most recent call last):
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 3718, in main
mainwindow = run_spyder(app, options, args)
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 3557, in run_spyder
main = MainWindow(options)
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 426, in init
from spyder.preferences.runconfig import RunConfigPage
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/spyder/preferences /runconfig.py", line 482, in
class RunConfigPage(GeneralConfigPage):
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/spyder/preferences/runconfig.py", line 487, in RunConfigPage
ICON = ima.icon('run')
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/spyder/utils/icon_manager.py", line 394, in icon
directory=_resource['directory'])
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/qtawesome/init.py", line 178, in load_font
return _instance().load_font(prefix, ttf_filename, charmap_filename, directory)
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/qtawesome/init.py", line 54, in _instance
'materialdesignicons-webfont-charmap.json')
File "/home/cmiprc/anaconda2/envs/test/lib/python2.7/site-packages/qtawesome/iconic_font.py", line 206, in init
super().init()
TypeError: super() takes at least 1 argument (0 given)
This started happening after I reinstalled the package "pydicom" in the environment, and now nothing works. I have reinstalled anaconda2, used spyder --reset, and all other common suggestions.
Spyder 3.3.6 works in the base environment, but every time I make a new environment and install spyder in this, I get the same error. Any suggestions?
(Spyder maintainer here) To fix this problem, you need to install QtAwesome 0.7.3 in your environment. For that, please use the following command:
conda install qtawesome=0.7.3
I recently created a new environment with Anaconda Navigator and installed in it the Spyder IDE version 4.1.1. The problem is, whenever I try to launch it (via Anaconda Navigator), it raises me the following exception, and doesn´t launch at all:
Traceback (most recent call last):
File "C:\Users\marco\anaconda3\envs\Webscraping_env\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "C:\Users\marco\anaconda3\envs\Webscraping_env\lib\site-packages\spyder\app\start.py", line 205, in main
mainwindow.main()
File "C:\Users\marco\anaconda3\envs\Webscraping_env\lib\site-packages\spyder\app\mainwindow.py", line 3700, in main
mainwindow = run_spyder(app, options, args)
File "C:\Users\marco\anaconda3\envs\Webscraping_env\lib\site-packages\spyder\app\mainwindow.py", line 3556, in run_spyder
main.setup()
File "C:\Users\marco\anaconda3\envs\Webscraping_env\lib\site-packages\spyder\app\mainwindow.py", line 1217, in setup
self.apply_shortcuts()
File "C:\Users\marco\anaconda3\envs\Webscraping_env\lib\site-packages\spyder\app\mainwindow.py", line 3207, in apply_shortcuts
self.help.show_intro_message()
File "C:\Users\marco\anaconda3\envs\Webscraping_env\lib\site-packages\spyder\plugins\help\plugin.py", line 456, in show_intro_message
shortcut_editor, "\n\n", prefs)
TypeError: not enough arguments for format string
But when I go to the root environment and try to launch from there Spyder version 4.0.1, it launchs with no issues.
I have just tried to upgrade everything in my main environment to the latest version (using conda update --all). Everything went completely fine until I actually tried to run python. I got this error message:
Traceback (most recent call last):
File "C:\Users\Ayush\Anaconda3\lib\site.py", line 579, in <module>
main()
File "C:\Users\Ayush\Anaconda3\lib\site.py", line 562, in main
known_paths = venv(known_paths)
File "C:\Users\Ayush\Anaconda3\lib\site.py", line 494, in venv
addsitepackages(known_paths, [sys.prefix])
File "C:\Users\Ayush\Anaconda3\lib\site.py", line 349, in addsitepackages
addsitedir(sitedir, known_paths)
File "C:\Users\Ayush\Anaconda3\lib\site.py", line 207, in addsitedir
addpackage(sitedir, name, known_paths)
File "C:\Users\Ayush\Anaconda3\lib\site.py", line 159, in addpackage
f = open(fullname, "r")
File "C:\Users\Ayush\Anaconda3\lib\_bootlocale.py", line 12, in getpreferredencoding
if sys.flags.utf8_mode:
AttributeError: 'sys.flags' object has no attribute 'utf8_mode'
As you can see, it looks like a problem with sys.flags. I tried googling this, but I couldn't find anyone with the same issue. I am using python 3.6.7 (python didn't update itself). This error message also appears if I try to run python in the command prompt. Here is the output of running conda update --all. Hope you can help!
EDIT: I found an issue on this issue on github here, but this doesn't give any explanations on how to fix this.
NOTE: I have also tried to install a new version of python using the installer, but that didn't work either.
I somehow did it - I re-installed Python, and then I tried using the command prompt, and it worked. It turned out that if I deleted my idea folder in Pycharm, it would work with the new version!
I installed jupyter on my macbook pro (10.10), using pip install jupyter, it completed sucessfully. However, when trying to run the
jupyter notebook
command - I get the following errors.
Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 11, in
sys.exit(main())
File "/Library/Python/2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/Library/Python/2.7/site-packages/traitlets/config/application.py", line 591, in launch_instance
app.initialize(argv)
File "<string>", line 2, in initialize
File "/Library/Python/2.7/site-packages/traitlets/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/notebook/notebookapp.py", line 1008, in initialize
self.init_terminals()
File "/Library/Python/2.7/site-packages/notebook/notebookapp.py", line 908, in init_terminals
from .terminal import initialize
File "/Library/Python/2.7/site-packages/notebook/terminal/__init__.py", line 3, in <module>
import terminado
File "/Library/Python/2.7/site-packages/terminado/__init__.py", line 7, in <module>
logging.getLogger(__name__).addHandler(logging.NullHandler())
AttributeError: 'module' object has no attribute 'NullHandler'
Can you please advise..
per additional requested info
bash-3.2$ python --version
Python 2.7.10
bash-3.2$ echo $PYTHONPATH
bash-3.2$ which -a python
/usr/bin/python
Simpler installation with Anaconda
An alternative to using pip is Anaconda or Miniconda.
It is great for installing scientific libraries such as Jupyter.
Anaconda
Anaconda is a full distribution of about 200 libraries including Jupyter. Just install it with given instruction as user (not root) and you should be good to go.
Miniconda
Miniconda is smaller. It includes Python and a few essential libraries. If Anconda seems to big, download and install Miniconda. Again, as user not as root.
Then, install Jupyter with:
conda install jupyter
In your case it is complaining to the log file. If you can specify it it should solve the problem, as now it is not finding it.
Since my laptop crashed (for unknown reason) last night, Spyder has not been able to connect to a kernel. I am getting this error:
IOError: Could not find u'kernel-1809.json' in ['.', '~/Library/Jupyter/runtime']
(The name of the json file changes each time I attempt to launch an iPython console.)
This does not seem to be related to the matplotlib 1.5 issue, that I have seen elsewhere on here - it is using 1.4.3.
iPython (version 4.0.0) runs fine from the command line.
Mac 10.10.1 (Yosemite). Spyder 2.3.7. Python 2.7.10 64bits, Qt 4.8.7, PyQt4 (API v2) 4.11.3 on Darwin
UPDATED TO INCLUDE LOGS
>>> /Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/nbformat/current.py:19: UserWarning: nbformat.current is deprecated.
- use nbformat for read/write/validate public API
- use nbformat.vX directly to composing notebooks of a particular version
ERROR: 3rd party plugin import failed for `p_pylint`
Traceback (most recent call last):
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/otherplugins.py", line 53, in get_spyderplugins_mods
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderplugins/p_pylint.py", line 23, in <module>
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderplugins/widgets/pylintgui.py", line 71, in <module>
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderplugins/widgets/pylintgui.py", line 61, in get_pylint_version
File "subprocess.pyc", line 710, in __init__
File "subprocess.pyc", line 1335, in _execute_child
OSError: [Errno 2] No such file or directory
Traceback (most recent call last):
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/plugins/externalconsole.py", line 925, in <lambda>
give_focus=give_ipyclient_focus))
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/plugins/externalconsole.py", line 1033, in register_ipyclient
give_focus=give_focus)
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/plugins/ipythonconsole.py", line 836, in register_client
self.connect_client_to_kernel(client)
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/plugins/ipythonconsole.py", line 1048, in connect_client_to_kernel
client.password)
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/plugins/ipythonconsole.py", line 1017, in create_kernel_manager_and_client
cf = find_connection_file(connection_file)
File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/jupyter_client/connect.py", line 185, in find_connection_file
raise IOError("Could not find %r in %r" % (filename, path))
IOError: Could not find u'kernel-2018.json' in ['.', u'/Users/garyspatterson/Library/Jupyter/runtime']
** Further update **
I deleted all files under the .spyder2/ folder in my user directory, reopened Spyder, and it was able to connect to an iPython console. So far, so good. Trouble is, when I added a path to the PYTHONPATH manager (so I could import external modules, such as nltk), I am back to getting the same error.
Had a similar issue and was able to resolve it by creating a new virtualenv with the same dependencies installed.
Now Spyder is working with the PYTHONPATH pointing at lib/python2.7/site-packages of the new environment.