IJulia... after removing Python

I recently had problems with running some Python code (Spyder didn’t find the kernel, etc. – maybe because I had several Python versions installed). So in the end, I deleted every Python version on my computer, and re-installed the latest Python version from Anaconda.

Next, I checked how this influenced Julia (Julia v. 1.1, Windows 10). So now, I can import IJulia (julia> using IJulia seems to work). What has changed is that when I try to start up jupyterlab(), I am asked to install Jupyter via Conda – I guess that removing Python installations has removed Jupyter for IJulia…

julia> using IJulia

julia> jupyterlab()
install Jupyter via Conda, y/n? [y]: y
[ Info: Downloading miniconda installer ...
ERROR: failed process: Process(`'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe' -Version 3 -NoProfile -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; (New-Object System.Net.Webclient).DownloadFile('https://repo.continuum.io/miniconda/Miniconda3-4.5.4-Windows-x86_64.exe', 'C:\Users\user_name\.julia\conda\3\installer.exe')"`, ProcessExited(1)) [1]
Stacktrace:
 [1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at .\error.jl:42
 [2] pipeline_error at .\process.jl:785 [inlined]
 [3] download(::String, ::String) at .\download.jl:20
 [4] _install_conda(::String, ::Bool) at C:\Users\user_name\.julia\packages\Conda\kLXeC\src\Conda.jl:160
 [5] _install_conda(::String) at C:\Users\user_name\.julia\packages\Conda\kLXeC\src\Conda.jl:152
 [6] runconda(::Cmd, ::String) at C:\Users\user_name\.julia\packages\Conda\kLXeC\src\Conda.jl:111
 [7] #add#1(::String, ::Function, ::String, ::String) at C:\Users\user_name\.julia\packages\Conda\kLXeC\src\Conda.jl:184
 [8] add at C:\Users\user_name\.julia\packages\Conda\kLXeC\src\Conda.jl:183 [inlined] (repeats 2 times)
 [9] find_jupyter_subcommand(::String) at C:\Users\user_name\.julia\packages\IJulia\fRegO\src\jupyter.jl:23
 [10] #jupyterlab#9(::String, ::Bool, ::Function) at C:\Users\user_name\.julia\packages\IJulia\fRegO\src\jupyter.jl:100
 [11] jupyterlab() at C:\Users\user_name\.julia\packages\IJulia\fRegO\src\jupyter.jl:99
 [12] top-level scope at none:0

Anyone has an idea of what goes wrong?

You removed jupyter as part of your python purge. Note that jupyter is written in python and requires python to run. Just let julia install its own version and have control over it.

1 Like

You are getting some kind of download error, but there is no error message beyond “failed process” so it is hard to tell what is going wrong. You could try running the same command in a Windows console:

C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Version 3 -NoProfile -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; (New-Object System.Net.Webclient).DownloadFile('https://repo.continuum.io/miniconda/Miniconda3-4.5.4-Windows-x86_64.exe', 'C:\Users\user_name\.julia\conda\3\installer.exe')"

and see if it gives a more informative error message.

1 Like

OK: I started a console window, did cd c:\windows\system32\windowspowershell\v1.0, and then issued command powershell.exe -Version 3 -NoProfile -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; (New-Object System.Net.Webclient).DownloadFile('https://repo.continuum.io/miniconda/Miniconda3-4.5.4-Windows-x86_64.exe', 'C:\Users\user_name\.julia\conda\3\installer.exe')"

Response:

Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."
At line:1 char:96
+ ... pe]::Tls12; (New-Object System.Net.Webclient).DownloadFile('https://r ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException

If anyone has got a clue, let me know :-o.

Try

]add Conda

>Conda.add("jupyterlab")

]add IJulia

Remove any other Anaconda/Miniconda installations first.

I tried to add the Conda package first, but running it produced a similar error message as before.

Note: I didn’t remove the existing Anaconda installation prior to doing this. Is that necessary?

  • Do you mean that I have to choose between having Python and Julia on my machine?
  • Or do you mean that I first have to install Python/Anaconda in the Julia context, and next can use that version of Python by starting up that installation independently?

Conda.jl will install Miniconda in C:\Users\user_name\.julia\conda\3\, when you first add a python library (julia> Conda.add("jupyterlab")), which will provide you with python and a terminal window too. So you don’t need to start with a separate Anaconda/Miniconda installation.

After Conda.add("jupyterlab") completes, check that running “jupyter lab” works from both the python terminal, and the windows cmd prompt. If the latter doesn’t work, make sure the directory jupyter is in, is in your path env (c:\Users\user_name\.julia\conda\3\Scripts).

Also, when you start the Julia terminal, do you right-click and “Run as administrator”?

Googling this error message seems to suggest that the path does not exist.

I’m guessing that you manually deleted your C:\Users\user_name\.julia\conda directory — in this case you need to re-run

pkg> add Conda
pkg> build Conda
3 Likes

I did. OK – since I was out of office today, I decided to upgrade to Julia 1.2.0. So I removed everything Julia from my computer, and then re-installed everything (using include(...) to add packages). So now, I’m back in office, and Julia seems to work.

Ooops… jupyterlab() starts up the browser. The browser opens with past notebooks, and I’m asked to choose kernel. I choose Julia 1.2.0. Then I get a long error message…

Traceback (most recent call last):
  File "C:\Users\User_Name\.julia\conda\3\lib\site-packages\tornado\web.py", line 1699, in _execute
    result = await result
  File "C:\Users\User_Name\.julia\conda\3\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\Users\User_Name\.julia\conda\3\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post
    type=mtype))
  File "C:\Users\User_Name\.julia\conda\3\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "C:\Users\User_Name\.julia\conda\3\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\Users\User_Name\.julia\conda\3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "C:\Users\User_Name\.julia\conda\3\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "C:\Users\User_Name\.julia\conda\3\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\Users\User_Name\.julia\conda\3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 101, in start_kernel_for_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "C:\Users\User_Name\.julia\conda\3\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "C:\Users\User_Name\.julia\conda\3\lib\site-packages\tornado\gen.py", line 209, in wrapper
    yielded = next(result)
  File "C:\Users\User_Name\.julia\conda\3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "C:\Users\User_Name\.julia\conda\3\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "C:\Users\User_Name\.julia\conda\3\lib\site-packages\jupyter_client\manager.py", line 259, in start_kernel
    **kw)
  File "C:\Users\User_Name\.julia\conda\3\lib\site-packages\jupyter_client\manager.py", line 204, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "C:\Users\User_Name\.julia\conda\3\lib\site-packages\jupyter_client\launcher.py", line 138, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "C:\Users\User_Name\.julia\conda\3\lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "C:\Users\User_Name\.julia\conda\3\lib\subprocess.py", line 997, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified


If I pull down the Kernel menu and try to change kernel, I get the following message:

Any ideas?

If it can’t find the Julia kernel, that usually means that you changed the location of Julia since IJulia was built. Run build IJulia at the pkg prompt and it should fix it.

I did build IJulia at the command prompt. Same problem as before.

OK – I made it work… I simply removed everything on my computer related to both Python and Julia. Then I installed Julia, and checked that IJulia worked. Next, I installed Anaconda, and checked that that worked. Finally, I rechecked that IJulia worked after installing Python from Anaconda.

Didn’t really cost that much time: my computer ran scripted Pkg.add()'s while I attended a PhD defence.