Hello!
On Windows 8.1 I installed Anaconda. It's strange, but jupyter notebook link wasn't created in start menu. Then I tried in my folder with python code:
jupyter notebook
After this I got error:
[C 18:45:58.227 NotebookApp] Bad config encountered during initialization:
[C 18:45:58.227 NotebookApp] Could not decode 'C:\\Users\\xc0\xe4\xf0\xe5\xe9\\.jupyter' for unicode trait 'config_dir' of a NotebookApp instance.
How can I fix it?
Best regards, Andrey.
@damianavila do you who to ping at continuum for that ? It looks like Anaconda is passing a flag on the command-line to the notebook.
Full output when I run jupyter notebook in command line in Windows 8.1:
The Jupyter HTML Notebook.
This launches a Tornado based HTML Notebook Server that serves up an
HTML5/Javascript Notebook client.
Subcommands
-----------
Subcommands are launched as `jupyter-notebook cmd [args]`. For information on
using subcommand 'cmd', do: `jupyter-notebook cmd -h`.
list
List currently running notebook servers.
Options
-------
Arguments that take values are actually convenience aliases to full
Configurables, whose aliases are listed on the help line. For more information
on full configurables, see '--help-all'.
--script
DEPRECATED, IGNORED
--pylab
DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib.
--debug
set log level to logging.DEBUG (maximize logging output)
--no-browser
Don't open the notebook in a browser after startup.
-y
Answer yes to any questions instead of prompting.
--no-mathjax
Disable MathJax
MathJax is the javascript library Jupyter uses to render math/LaTeX. It is
very large, so you may want to disable it if you have a slow internet
connection, or for offline use of the notebook.
When disabled, equations etc. will appear as their untransformed TeX source.
--no-script
DEPRECATED, IGNORED
--generate-config
generate default config file
--certfile=<Unicode> (NotebookApp.certfile)
Default: u''
The full path to an SSL/TLS certificate file.
--ip=<Unicode> (NotebookApp.ip)
Default: 'localhost'
The IP address the notebook server will listen on.
--pylab=<Unicode> (NotebookApp.pylab)
Default: 'disabled'
DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib.
--log-level=<Enum> (Application.log_level)
Default: 30
Choices: (0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL')
Set the log level by value or name.
--port-retries=<Integer> (NotebookApp.port_retries)
Default: 50
The number of additional ports to try if the specified port is not
available.
--notebook-dir=<Unicode> (NotebookApp.notebook_dir)
Default: u''
The directory to use for notebooks and kernels.
--keyfile=<Unicode> (NotebookApp.keyfile)
Default: u''
The full path to a private key file for usage with SSL/TLS.
--client-ca=<Unicode> (NotebookApp.client_ca)
Default: u''
The full path to a certificate authority certifificate for SSL/TLS client
authentication.
--config=<Unicode> (JupyterApp.config_file)
Default: u''
Full path of a config file.
--port=<Integer> (NotebookApp.port)
Default: 8888
The port the notebook server will listen on.
--transport=<CaselessStrEnum> (KernelManager.transport)
Default: 'tcp'
Choices: [u'tcp', u'ipc']
--browser=<Unicode> (NotebookApp.browser)
Default: u''
Specify what command to use to invoke a web browser when opening the
notebook. If not specified, the default browser will be determined by the
`webbrowser` standard library module, which allows setting of the BROWSER
environment variable to override it.
To see all available configurables, use `--help-all`
Examples
--------
jupyter notebook # start the notebook
jupyter notebook --certfile=mycert.pem # use SSL/TLS certificate
[C 18:45:58.227 NotebookApp] Bad config encountered during initialization:
[C 18:45:58.227 NotebookApp] Could not decode 'C:\\Users\\xc0\xe4\xf0\xe5\xe9\\.jupyter' for unicode trait 'config_dir' of a NotebookApp instance.
I can try to find mistake and fix it, but I don't know how to debug .exe using Python. In Linux I use python -m pdb my_script.py but I can't adapt this to debug Jupyter on Windows....
How to debug .exe on Windows using Python?
I just noticed, that Anaconda works nice on Windows 7: there is link to Jupiter in start menu and Jupiter starts without any problems. All problems are on Windows 8. Maybe these problems are on Windows 10 too - I really don't know.
Also I'd like to say that my username in Windows 8 is written in cyrillic.
Best regards, Andrey.
@AndreWin Are you using Python 3? If you have a non-ascii home directory on Windows, I would _strongly_ recommend Python 3. There are loads of difficult unicode bugs with Python 2 on Windows. It's entirely possible that there's a unicode bug in the Jupyter paths code, though.
What do you get from:
os.path.expanduser('~')sys.getfilesystemencoding()os.path.expanduser('~').decode(sys.getfilesystemencoding())@minrk it seems for me I understood my problem. Anaconda installed fine on my work computer and other one, but not on my home computer. I thought that problem is in Anaconda, but I noticed now that username in my work computer is in English. Now I think that username is in English on other computer too. In other words it seems that problem isn't in Anaconda.
I use python 2.7, because the same version is used by sage. Now I decided to use this decision. I will try it today and will adapt it for myself.
Now I have only one question: how can I use pdb or any other tool to debug jupyter? I want to know what .py files are used by jupyter.exe and in what order. Please help me to answer on this question.
Best regards, Andrey.
You can run the notebook with pdb with:
python -m pdb C:\Path\to\Scripts\jupyter-notebook-script.py
Thanks a lot, @minrk!
I now noticed, that I can open .exe files like jupyter.exe as zip archives. And there are python files in these archives. This will helped me too.
@minrk, I found the decision: in file C:\Path\to\Lib\site-packages\jupyter_core\paths.py you need to append .decode(sys.getfilesystemencoding()) at the line end:
get_homedir:homedir = os.path.realpath(homedir).decode(sys.getfilesystemencoding())jupyter_data_dir:appdata = os.environ.get('APPDATA', None).decode(sys.getfilesystemencoding())After that jupyter notebook started on my Windows!
Now I'd like to create shourtcut for jupyter notebook in folder with my files. I found jupyter.ico and write program path as jupyter notebook (that is I wrote the same as in console). After doubleclick I see console, something text in it, but console closes after a second. How can I fix it?
Best regards, Andrey.
Thanks for looking into it.
I'm not sure the .decode() are the exact right fix as os.environ is not supposed to by bytes, the bytes version is exposed with os.environb, it's not clear what the Python 2 version does exactly though.
@Carreau, but it works! :smiley:
@Carreau, @minrk, I solved my problems with creating shortcuts! In folder we make right click and choose "create shortcut", targert (path to program) is C:\path\to\jupyter.exe "notebook", start in (work folder) must be empty - at this case path will is place where shortcut is located. Run = minimized. As for icon, I downloaded it from here.
I just created virtualenv and installed jupyter notebook in it. Jupyter notebook couldn't start. I added additional changes in Lib\site-packages\jupyter_core\migrate.py:


I selected all my changes using multiple cursors.
After this jupyter notebook was be able to start.
@Carreau, but it works!
The following works, but is still not correct
$ python2
>>> 'hello'.decode().decode().decode()
u'hello'
Thanks for your changes, they will be incompatible Python3, but that will give us hint on how to fix them in a way which is compatible in both versions.
Side comment: you should really think of using Python3, it won't prevent you from having a Python2 kernel if necessary.
The following works, but is still not correct
@Carreau, sorry for that. I really didn't think about it. I don't write apps on Python 3 yet.
they will be incompatible Python3
To be honest, I'm just mechanical engineer but can use Python a little :-) It seems for me we can use sys.version_info for that.
you should really think of using Python3
I use Python 2 only because sage uses it. If sage will use python 3, I willn't have any reason not to switch on Python 3.
it won't prevent you from having a Python2 kernel if necessary
Unfortunatelly I don't know how to install other kernel in Jupyter. I didn't learn this because I didn't need in it.
Best regards, Andrey.
@Carreau, reading this it does not seem Anaconda-related, but if you think still does, please let me know and I can ping someone about this...
it worked for me by copying the files IPython\utils\py3compat.py, IPython\utils\encoding.py into jupyter_core\utils\ and putting the code from the function get_home_dir in IPython\utils\path.py into the function get_home_dir in jupyter_core\paths.py.
Well, I have had the same problem (also with Russian language),
I have changed:
homedir = os.path.expanduser('~')
to the absolute path:
homedir = os.path.abspath('C:/Anaconda2/Notebooks')
And all works.
Hope this will help.
I am closing this issue as it looks as if this issue is resolved. I'm labelling it as "reference" since it may help users in the future. Thanks to everyone!
I am teaching a course in Brazil, where many have non-ascii characters in their path, and some of the students are suffering from this. I did not test https://github.com/jupyterhub/jupyterhub/issues/444#issuecomment-222372466 solution myself because I do not have a Windows machine but even if that works my students are not tech savy nor-Python programers, so asking them to fix this by themselves is not simple.
Would it be possible to fix that in Jupyter itself? Or that does not make sense?
Would it be possible to fix that in Jupyter itself? Or that does not make sense?
I'm unsure if there is really anything we can do. Are your students using Python 2 ? Or 3 ? Most of unicode problems usually get solved when using Python 3.
I have also encountered the same problem
> [C 17: 23: 41.345 NotebookApp] Bad config encountered during initialization:
> [C 17: 23: 41.348 NotebookApp] No such notebook dir: u'D: \\ notebook2 \\ python2 '
Looked at the wrong tips, and looked at the D drive, found the 'notebook' folder was gone. Find the 'notebook' folder, put it on the D drive, or create a new one.
problem solved!
This is might Help I SOLVED and wrote about it HERE
There is sometimes that the jupyter_notebook_config.py is missing To create a jupyter_notebook_config.py file, after installing the python , you can use the following command line:
jupyter notebook --generate-config
then run :
jupyter notebook --config=/home/john/mystuff/jupyter_notebook_config.json

I hope that help you
please comment if it is works
This is might Help I SOLVED and wrote about it HERE
There is sometimes that the jupyter_notebook_config.py is missing To create a jupyter_notebook_config.py file, after installing the python , you can use the following command line:
jupyter notebook --generate-configthen run :
jupyter notebook --config=/home/john/mystuff/jupyter_notebook_config.json
I hope that help you
please comment if it is works
i am using jupyter on Ubuntu. i made changes in (#c.NotebookApp.notebook_dir = '' ") to change the path to my desire path. but jupyter was not iniitializing. so i follow your instructions and it worked. Thanks Sir
For those who are in trouble,first run
jupyter notebook --generate-config
then run,
jupyter notebook --config=/home/john/mystuff/jupyter_notebook_config.json
Now it will work fine.
and if you want to change path to your desired path. Just Follow these steps
Most helpful comment
@minrk, I found the decision: in file
C:\Path\to\Lib\site-packages\jupyter_core\paths.pyyou need to append.decode(sys.getfilesystemencoding())at the line end:get_homedir:homedir = os.path.realpath(homedir).decode(sys.getfilesystemencoding())jupyter_data_dir:appdata = os.environ.get('APPDATA', None).decode(sys.getfilesystemencoding())After that jupyter notebook started on my Windows!
Now I'd like to create shourtcut for jupyter notebook in folder with my files. I found jupyter.ico and write program path as
jupyter notebook(that is I wrote the same as in console). After doubleclick I see console, something text in it, but console closes after a second. How can I fix it?Best regards, Andrey.