Trouble installing IJulia in fresh Julia 1.0

[Update: This is fixed in a recent update. Updating packages and re-building fixes the Windows-vs-Conda problem that was behind the IJulia failure for me.]

I just downloaded Julia v0.7 and tried to install IJulia (literally the first thing I did), following the instructions here:

It failed. I tried again with Julia v1.0, and it failed in the same way. Does anyone know what’s going on here?

I’m on Windows 10. I have previous versions of Julia installed, with IJulia. I’m just leaving everything in a default state.

Here’s my entire Julia session, which consists of adding the IJulia package, trying to use it, building it, and getting the error.

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.0.0 (2018-08-08)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(v1.0) pkg> st
    Status `C:\Users\Tucker\.julia\environments\v1.0\Project.toml`

(v1.0) pkg> add IJulia
  Updating registry at `C:\Users\Tucker\.julia\registries\General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
  Updating `C:\Users\Tucker\.julia\environments\v1.0\Project.toml`
  [7073ff75] + IJulia v1.12.0
  Updating `C:\Users\Tucker\.julia\environments\v1.0\Manifest.toml`
  [b99e7846] + BinaryProvider v0.4.2
  [34da2185] + Compat v1.1.0
  [8f4d0f93] + Conda v1.0.1
  [7073ff75] + IJulia v1.12.0
  [682c06a0] + JSON v0.19.0
  [739be429] + MbedTLS v0.6.0
  [b85f4697] + SoftGlobalScope v1.0.7
  [81def892] + VersionParsing v1.1.2
  [c2297ded] + ZMQ v1.0.0
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [8bb1440f] + DelimitedFiles
  [8ba89e20] + Distributed
  [7b1f6079] + FileWatching
  [b77e0a4c] + InteractiveUtils
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [a63ad114] + Mmap
  [44cfe95a] + Pkg
  [de0858da] + Printf
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [1a1011a3] + SharedArrays
  [6462fe0b] + Sockets
  [2f01184e] + SparseArrays
  [10745b16] + Statistics
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode

(v1.0) pkg> st
    Status `C:\Users\Tucker\.julia\environments\v1.0\Project.toml`
  [7073ff75] IJulia v1.12.0

julia> using IJulia
[ Info: Precompiling IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a]
ERROR: LoadError: IJulia not properly installed. Please run Pkg.build("IJulia")
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] top-level scope at none:0
 [3] include at .\boot.jl:317 [inlined]
 [4] include_relative(::Module, ::String) at .\loading.jl:1038
 [5] include(::Module, ::String) at .\sysimg.jl:29
 [6] top-level scope at none:2
 [7] eval at .\boot.jl:319 [inlined]
 [8] eval(::Expr) at .\client.jl:389
 [9] top-level scope at .\none:3
in expression starting at C:\Users\Tucker\.julia\packages\IJulia\4VL8h\src\IJulia.jl:45
ERROR: Failed to precompile IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a] to C:\Users\Tucker\.julia\compiled\v1.0\IJulia\nfu7T.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] macro expansion at .\logging.jl:313 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at .\loading.jl:1184
 [4] _require(::Base.PkgId) at .\logging.jl:311
 [5] require(::Base.PkgId) at .\loading.jl:852
 [6] macro expansion at .\logging.jl:311 [inlined]
 [7] require(::Module, ::Symbol) at .\loading.jl:834

(v1.0) pkg> build IJulia
  Building Conda ──→ `C:\Users\Tucker\.julia\packages\Conda\m7vem\deps\build.log`
  Building ZMQ ────→ `C:\Users\Tucker\.julia\packages\ZMQ\ABGOx\deps\build.log`
  Building MbedTLS → `C:\Users\Tucker\.julia\packages\MbedTLS\Qo8TN\deps\build.log`
  Building IJulia ─→ `C:\Users\Tucker\.julia\packages\IJulia\4VL8h\deps\build.log`
┌ Error: Error building `IJulia`:
│ Solving environment: ...working... done
│
│ # All requested packages already installed.
│
│ Error executing Jupyter command 'kernelspec': [Errno 'jupyter-kernelspec' not found] 2
│ Traceback (most recent call last):
│   File "C:\Users\Tucker\.julia\packages\Conda\m7vem\deps\usr\Scripts\jupyter-kernelspec-script.py", line 6, in <module>
│     from jupyter_client.kernelspecapp import KernelSpecApp
│   File "C:\Users\Tucker\.julia\packages\Conda\m7vem\deps\usr\lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
│     from .connect import *
│   File "C:\Users\Tucker\.julia\packages\Conda\m7vem\deps\usr\lib\site-packages\jupyter_client\connect.py", line 23, in <module>
│     import zmq
│   File "C:\Users\Tucker\.julia\packages\Conda\m7vem\deps\usr\lib\site-packages\zmq\__init__.py", line 47, in <module>
│     from zmq import backend
│   File "C:\Users\Tucker\.julia\packages\Conda\m7vem\deps\usr\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
│     reraise(*exc_info)
│   File "C:\Users\Tucker\.julia\packages\Conda\m7vem\deps\usr\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
│     raise value
│   File "C:\Users\Tucker\.julia\packages\Conda\m7vem\deps\usr\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
│     _ns = select_backend(first)
│   File "C:\Users\Tucker\.julia\packages\Conda\m7vem\deps\usr\lib\site-packages\zmq\backend\select.py", line 27, in select_backend
│     mod = __import__(name, fromlist=public_api)
│   File "C:\Users\Tucker\.julia\packages\Conda\m7vem\deps\usr\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
│     from . import (constants, error, message, context,
│ ImportError: DLL load failed: The specified module could not be found.
│ [ Info: Installing Jupyter via the Conda package.
│ [ Info: Running `conda install -y jupyter` in root environment
│ [ Info: Found Jupyter version 4.4.0: C:\Users\Tucker\.julia\packages\Conda\m7vem\deps\usr\Scripts\jupyter
│ [ Info: Installing Julia kernelspec julia-1.0
│ ERROR: LoadError: failed process: Process(`'C:\Users\Tucker\.julia\packages\Conda\m7vem\deps\usr\python.exe' 'C:\Users\Tucker\.julia\packages\Conda\m7vem\deps\usr\Scripts\jupyter-kernelspec-script.py' install --replace --user 'C:\Users\Tucker\AppData\Local\Temp\julia-1.0'`, ProcessExited(1)) [1]
│ Stacktrace:
│  [1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at .\error.jl:42
│  [2] pipeline_error at .\process.jl:695 [inlined]
│  [3] #run#505(::Bool, ::Function, ::Cmd) at .\process.jl:653
│  [4] run at .\process.jl:651 [inlined]
│  [5] #installkernel#4(::String, ::Function, ::String) at C:\Users\Tucker\.julia\packages\IJulia\4VL8h\deps\kspec.jl:85
│  [6] installkernel(::String) at C:\Users\Tucker\.julia\packages\IJulia\4VL8h\deps\kspec.jl:36
│  [7] top-level scope at logging.jl:310
│  [8] top-level scope at logging.jl:309
│  [9] top-level scope at C:\Users\Tucker\.julia\packages\IJulia\4VL8h\deps\build.jl:38
│  [10] include at .\boot.jl:317 [inlined]
│  [11] include_relative(::Module, ::String) at .\loading.jl:1038
│  [12] include(::Module, ::String) at .\sysimg.jl:29
│  [13] include(::String) at .\client.jl:388
│  [14] top-level scope at none:0
│ in expression starting at C:\Users\Tucker\.julia\packages\IJulia\4VL8h\deps\build.jl:9
└ @ Pkg.Operations C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Pkg\src\Operations.jl:1068

(v1.0) pkg>

Might be related to https://github.com/JuliaPy/Conda.jl/pull/121 … apparently there has been some recent breakage in how the PATH is handled by Anaconda on Windows.

Wow, that is very recent. Thanks for the info!

This might be related: I’m also having trouble adding PyPlot, and it’s mentioning stuff about Conda.

] add PyPlot
using Plots
pyplot()

Then there’s a bunch of nominal-looking output, and then:

ERROR: InitError: PyCall.PyError("PyImport_ImportModule\n\nThe Python package matplotlib could not be found by pyimport. Usually this means\nthat you did not install matplotlib in the Python version being used by PyCall.\n\nPyCall is currently configured to use the Julia-specific Python distribution\ninstalled by the Conda.jl package.  To install the matplotlib module, you can\nuse `pyimport_conda(\"matplotlib\", PKG)`, where PKG is the Anaconda\npackage the contains the module matplotlib, or alternatively you can use the\nConda package directly (via `using Conda` followed by `Conda.add` etcetera).\n\nAlternatively, if you want to use a different Python distribution on your\nsystem, such as a system-wide Python (as opposed to the Julia-specific Python),\nyou can re-configure PyCall with that Python.   As explained in the PyCall\ndocumentation, set ENV[\"PYTHON\"] to the path/name of the python executable\nyou want to use, run Pkg.build(\"PyCall\"), and re-launch Julia.\n\n", PyCall.PyObject(Ptr{PyCall.PyObject_struct} @0x00007ff807376c20), PyCall.PyObject(Ptr{PyCall.PyObject_struct} @0x00000000015d3c88), PyCall.PyObject(Ptr{PyCall.PyObject_struct} @0x0000000001635308))

https://discourse.julialang.org/t/is-ijulia-meant-to-be-working-with-julia-v1-0-yet/13257/15

Have a look at the above post. It might help.

I wonder if Conda.add("python=3.6") can fix it. I don’t have Windows so I can’t test it. (Warning: it could break your Conda.jl setup)

The suggestion to use the older version of Anaconda 3.6 works for me on Windows 10. This is what I did:

  • download and install Minconda3-4.5.1-Windows-x86_64.exe from https://repo.continuum.io/miniconda/. I am not sure this is relevant since later you tell conda to install python3.6 in the python environment for Julia, but I have not tested it.
  • follow the instruction at https://github.com/JuliaPy/Conda.jl except for explicitly forcing conda to install python3.6 in the environment conda_jl by typing conda create -n conda_jl python=3.6 conda
  • add ENV["CONDA_JL_HOME"] = "/path/to/Miniconda3/envs/conda_jl" to your startup.jl file in .julia/config/startup.jl
  • start julia and type using Pkg; Pkg.add("PyPlot")

Thanks. Yeah, I implemented a similar approach Install Miniconda3-4.5.4 (Python 3.6) on Windows by tkf · Pull Request #124 · JuliaPy/Conda.jl · GitHub and it looks like it’s working with the CIs.

FYI it looks like Minconda3-4.5.4 is old enough (= has Python 3.6).

If you take CONDA_JL_HOME approach, I think you can just use the latest miniconda.

2 Likes

These are great replies; thanks @Ajaychat3, @tkf, and @mzaffalon. I can’t test this right now, but I’ll update when I’ve tried it.

Looks like @tkf and @stevengj fixed this in https://github.com/JuliaPy/Conda.jl/pull/124. I updated by packages and built IJulia without a problem.

] up
build IJulia

Thanks!

I’m also having trouble to load IJulia in Julia v1.0.0. I’m running Ubuntu 18.04.1 LTS.

julia> using IJulia
[ Info: Precompiling IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a]
ERROR: LoadError: IJulia not properly installed. Please run Pkg.build("IJulia")
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at none:0
 [3] include at ./boot.jl:317 [inlined]
 [4] include_relative(::Module, ::String) at ./loading.jl:1038
 [5] include(::Module, ::String) at ./sysimg.jl:29
 [6] top-level scope at none:2
 [7] eval at ./boot.jl:319 [inlined]
 [8] eval(::Expr) at ./client.jl:389
 [9] top-level scope at ./none:3
in expression starting at /home/mroavi/.julia/packages/IJulia/4VL8h/src/IJulia.jl:45
ERROR: Failed to precompile IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a] to /home/mroavi/.julia/compiled/v1.0/IJulia/nfu7T.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] macro expansion at ./logging.jl:313 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1184
 [4] macro expansion at ./logging.jl:311 [inlined]
 [5] _require(::Base.PkgId) at ./loading.jl:941
 [6] require(::Base.PkgId) at ./loading.jl:852
 [7] macro expansion at ./logging.jl:311 [inlined]
 [8] require(::Module, ::Symbol) at ./loading.jl:834

This is in your error message. Did you try it?

Yes. I tried rebuilding it but unfortunately I got the same error once I tried to load it again. My temporal solution was to run: (v1.0) pkg> add IJulia#v1.11.1. Now it is loading fine.

There was probably an error message during build that you ignored — what what it? If it was an error message about ipykernel, see https://github.com/JuliaLang/IJulia.jl/issues/739 … you probably need to re-install Conda.

@stevengj You are right. I overlooked an error message when re-building IJulia. However, I tried building it one more time and I couldn’t find anything about ipkernel in the error message. It does say something about kernelspec. Here is the error message:

(v1.0) pkg> build IJulia
  Building Conda ──→ `~/.julia/packages/Conda/hsaaN/deps/build.log`
  Building ZMQ ────→ `~/.julia/packages/ZMQ/ABGOx/deps/build.log`
  Building MbedTLS → `~/.julia/packages/MbedTLS/mkHpa/deps/build.log`
  Building IJulia ─→ `~/.julia/packages/IJulia/4VL8h/deps/build.log`
┌ Error: Error building `IJulia`: 
│ ERROR: LoadError: IJulia not properly installed. Please run Pkg.build("IJulia")
│ Stacktrace:
│  [1] error(::String) at ./error.jl:33
│  [2] top-level scope at none:0
│  [3] include at ./boot.jl:317 [inlined]
│  [4] include_relative(::Module, ::String) at ./loading.jl:1038
│  [5] include(::Module, ::String) at ./sysimg.jl:29
│  [6] top-level scope at none:2
│  [7] eval at ./boot.jl:319 [inlined]
│  [8] eval(::Expr) at ./client.jl:389
│  [9] top-level scope at ./none:3
│ in expression starting at /home/mroavi/.julia/packages/IJulia/4VL8h/src/IJulia.jl:45
│ Error executing Jupyter command 'kernelspec': [Errno 2] No such file or directory
│ ┌ Warning: Could not turn on Rebugger key bindings.
│ └ @ Main ~/.julia/config/startup.jl:32
│ ┌ Warning: Could not load IJulia.
│ └ @ Main ~/.julia/config/startup.jl:39
│ [ Info: Found Jupyter version 4.4.0: jupyter
│ [ Info: Installing Julia kernelspec julia-1.0
│ ERROR: LoadError: IOError: could not spawn `jupyter-kernelspec install --replace --user /tmp/julia-1.0`: no such file or directory (ENOENT)
│ Stacktrace:
│  [1] _jl_spawn(::String, ::Array{String,1}, ::Cmd, ::Tuple{RawFD,RawFD,RawFD}) at ./process.jl:367
│  [2] (::getfield(Base, Symbol("##495#496")){Cmd})(::Tuple{RawFD,RawFD,RawFD}) at ./process.jl:509
│  [3] setup_stdio(::getfield(Base, Symbol("##495#496")){Cmd}, ::Tuple{RawFD,RawFD,RawFD}) at ./process.jl:490
│  [4] #_spawn#494(::Nothing, ::Function, ::Cmd, ::Tuple{RawFD,RawFD,RawFD}) at ./process.jl:508
│  [5] _spawn at ./process.jl:504 [inlined]
│  [6] #run#505(::Bool, ::Function, ::Cmd) at ./process.jl:652
│  [7] run at ./process.jl:651 [inlined]
│  [8] macro expansion at ./logging.jl:312 [inlined]
│  [9] #installkernel#8(::String, ::Function, ::String) at /home/mroavi/.julia/packages/IJulia/4VL8h/deps/kspec.jl:68
│  [10] installkernel(::String) at /home/mroavi/.julia/packages/IJulia/4VL8h/deps/kspec.jl:36
│  [11] top-level scope at logging.jl:310
│  [12] top-level scope at logging.jl:309
│  [13] top-level scope at /home/mroavi/.julia/packages/IJulia/4VL8h/deps/build.jl:38
│  [14] include at ./boot.jl:317 [inlined]
│  [15] include_relative(::Module, ::String) at ./loading.jl:1038
│  [16] include(::Module, ::String) at ./sysimg.jl:29
│  [17] include(::String) at ./client.jl:388
│  [18] top-level scope at none:0
│ in expression starting at /home/mroavi/.julia/packages/IJulia/4VL8h/deps/build.jl:9