Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IJulia Installation on Windows #363

Closed
ericjang opened this issue Sep 27, 2015 · 32 comments
Closed

IJulia Installation on Windows #363

ericjang opened this issue Sep 27, 2015 · 32 comments

Comments

@ericjang
Copy link

I am using Windows 10 and Anaconda with julia-0.5.0. I previously had IJulia installed and working, but then somehow calling Pkg.update() broke my installation.

Here is the error message:

Installing julia kernelspec julia-0.5
===================================================[ ERROR: IJulia ]====================================================

LoadError: could not spawn jupyter-kernelspec install --replace --user julia-0.5: no such file or directory (ENOENT)
while loading C:\Users\eric.julia\v0.5\IJulia\deps\build.jl, in expression starting on line 101

====================================================[ BUILD ERRORS ]====================================================

WARNING: IJulia had build errors.

  • packages with build errors remain installed in C:\Users\eric.julia\v0.5
  • build the package(s) and all dependencies with Pkg.build("IJulia")
  • build a single package by running its deps/build.jl script

INFO: Package database updated

Running Pkg.build("IJulia") produced the same error.

dhoegh added a commit to dhoegh/IJulia.jl that referenced this issue Sep 27, 2015
dhoegh added a commit to dhoegh/IJulia.jl that referenced this issue Sep 27, 2015
@dhoegh
Copy link
Contributor

dhoegh commented Sep 27, 2015

I have proposed a fix in #364 could you check if it works?

@ericjang
Copy link
Author

Simply patching those 2 lines didn't seem to work for me:

I ran Windows Powershell with administrator and did pip install --upgrade jupyter (I'm using Anaconda), then ran jupyter kernelspec in Windows powershell but got

"jupyter: kernelspec is not a Jupyter command"

Writing IJulia kernelspec to julia-0.4\kernel.json ...
Installing julia kernelspec julia-0.4
jupyter: 'kernelspec' is not a Jupyter command
===================================================[ ERROR: IJulia ]====================================================

LoadError: failed process: Process(`jupyter kernelspec install --replace --user julia-0.4`, ProcessExited(1)) [1]
while loading C:\Users\eric\.julia\v0.4\IJulia\deps\build.jl, in expression starting on line 103

========================================================================================================================

====================================================[ BUILD ERRORS ]====================================================

WARNING: IJulia had build errors.

 - packages with build errors remain installed in C:\Users\eric\.julia\v0.4
 - build the package(s) and all dependencies with `Pkg.build("IJulia")`
 - build a single package by running its `deps/build.jl` script

========================================================================================================================

@dhoegh
Copy link
Contributor

dhoegh commented Sep 27, 2015

Ok. Have you tried the orginal build script after pip install --upgrade jupyter? Do excuting jupyter-kernelspec --version work now?

@ericjang
Copy link
Author

Yep, it yields the error above (kernelspec is not a Jupyter command).
I also get this error when I run jupyter kernelspec --version in Powershell.

Do I need to be using the dev branch of Jupyter notebook for kernelspec to show up?

@dhoegh
Copy link
Contributor

dhoegh commented Sep 27, 2015

Sorry the comment split the line unfortunate it is jupyter-kernelspec --version where jupyter and kernerlspec joined by -.

@ericjang
Copy link
Author

Unfortunately, that doesn't work either :/

PS C:\Users\eric> jupyter-kernelspec --version
jupyter-kernelspec : The term 'jupyter-kernelspec' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
+ jupyter-kernelspec --version
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (jupyter-kernelspec:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

@dhoegh
Copy link
Contributor

dhoegh commented Sep 27, 2015

Do the command work in cmd instead of powershell?

@ericjang
Copy link
Author

tried that, doesn't work either.

jupyter --version returns 4.0.6

Strangely enough, running jupyter -h lists the following subcommands:

Available subcommands: console kernelspec migrate nbconvert nbextension
notebook qtconsole trust

@dhoegh
Copy link
Contributor

dhoegh commented Sep 27, 2015

Hmm. I am indeed confused now. I think the only resolution to this is to wait for jupyter/jupyter_core#62 or downgrade to IPython3. Alternative you could let IJulia use the Conda package which can be done by:

julia> ENV["JUPYTER"]=""
julia> Pkg.build("IJulia")

@stevengj
Copy link
Member

If jupyter-kernelspec is not in the PATH either, that sounds like it is a different problem from jupyter/jupyter_core#62 ... sounds like a problem with your Anaconda installation?

@dhoegh
Copy link
Contributor

dhoegh commented Sep 28, 2015

It sounds like what minrk describes here, jupyter/notebook#448 (comment) where jupyter/jupyter_core#62 is the PR for fixing the issue.

@n-s-k
Copy link

n-s-k commented Sep 30, 2015

I had the very same issue, using jupyter --version 4.0.6:

jupyter: 'kernelspec' is not a Jupyter command

If I try to Pkg.build('IJulia'):

could not spawn jupyter-kernelspec install --replace --user julia-0.5: no such file or directory (ENOENT).

My understanding is that although Anaconda\Scripts is in the PATH and contains jupyter-kernelspec, this latter is not a windows executable.

As a temporary workaround, I replaced line 101 of build.jl with:

run(`python C:\\Anaconda\\Scripts\\$jupyter-kernelspec install --replace --user $juliakspec`) 

and ran Pkg.build('IJulia') again.

I still don't get it and I'm certain there is a cleaner solution.

@stevengj
Copy link
Member

@n-s-k, does jupyter-kernelspec --version work in run?

@n-s-k
Copy link

n-s-k commented Sep 30, 2015

julia> run(`jupyter --version`)
4.0.6
julia> run(`jupyter-console --version`)
4.0.2
julia> run(`jupyter-notebook --version`)
4.0.5
julia> run(`jupyter-kernelspec --version`)
ERROR: could not spawn `jupyter-kernelspec --version`: no such file or directory (ENOENT)
 in _jl_spawn at process.jl:217 (repeats 2 times)

image

@stevengj
Copy link
Member

What is jupyter-kernelspec? A batch file? (If so, why doesn't it end with .bat?)

Oh, from above I guess it is a Python file? (But doesn't end with .py?)

@stevengj
Copy link
Member

On my Mac, jupyter-kernelspec is

#!/Users/stevenj/anaconda/bin/python
from jupyter_client.kernelspecapp import KernelSpecApp

def main():
    KernelSpecApp.launch_instance()

if __name__ == '__main__':
    main()

but I guess Windows doesn't know how to spawn this.

@n-s-k
Copy link

n-s-k commented Sep 30, 2015

On Windows, jupyter-kernelspec is:

#!C:\Anaconda\python.exe
from jupyter_client.kernelspecapp import KernelSpecApp

def main():
    KernelSpecApp.launch_instance()

if __name__ == '__main__':
    main()

yep... a python script and Windows is clueless.

@stevengj
Copy link
Member

Okay, this should be a straightforward fix. We just need to find the correct path of jupyter-kernelspec and run it with Python.

@stevengj
Copy link
Member

Okay, it should be fixed now. Please do Pkg.checkout("IJulia"); Pkg.build("IJulia") and confirm that it works. Once you confirm, I will tag a new version.

@n-s-k
Copy link

n-s-k commented Sep 30, 2015

Confirmed.

@ericjang
Copy link
Author

This works for me too. Thanks!

On Wed, Sep 30, 2015 at 2:44 PM, n-s-k [email protected] wrote:

Confirmed.


Reply to this email directly or view it on GitHub
#363 (comment)
.

@stevengj
Copy link
Member

Great, tagged as IJulia 1.1.2.

@tkelman
Copy link
Contributor

tkelman commented Oct 4, 2015

I'm hitting this with the latest tag.

INFO: Found Jupyter version 4.0.6: C:\Users\Tony\.julia\v0.4\Conda\deps\usr\Scripts\jupyter
Writing IJulia kernelspec to julia-0.4\kernel.json ...
Installing julia kernelspec julia-0.4
jupyter: 'kernelspec' is not a Jupyter command
C:\Users\Tony\.julia\v0.4\Conda\deps\usr\python.exe: can't open file 'C:\Users\Tony\.julia\v0.4\Conda\deps\usr\Scripts\jupyter-kernelspec': [Errno 2] No such file or directory
===============================[ ERROR: IJulia ]================================

LoadError: failed process: Process(`'C:\Users\Tony\.julia\v0.4\Conda\deps\usr\python.exe' 'C:\Users\Tony\.julia\v0.4\Conda\deps\usr\Scripts\jupyter-kernelspec' install --replace --user julia-0.4`, ProcessExited(2)) [2]
while loading C:\Users\Tony\.julia\v0.4\IJulia\deps\build.jl, in expression starting on line 118

C:\Users\Tony\.julia\v0.4\Conda\deps\usr\Scripts has a jupyter-kernelspec.exe and a jupyter-kernelspec-script.py, but no plain jupyter-kernelspec without an extension. It looks like this may differ depending on anaconda or jupyter version?

@stevengj
Copy link
Member

stevengj commented Oct 5, 2015

Hmm, do we need a similar fix on windows to get notebook() working?

@minrk
Copy link
Contributor

minrk commented Oct 10, 2015

I believe several of these issues (esp #368) were caused by improper packaging of entrypoints in the Jupyter projects on Windows. Most of the entrypoints were fixed relatively promptly during the summer, but jupyter-client never got a release with the fix until 4.1, this week. I thought we had done that a while ago, but we hadn't. Hopefully this will be better behaved with the 4.1 update to jupyter-client.

@stevengj
Copy link
Member

Thanks, @minrk. We will keep the workarounds in for quite some time, to support older installations, but it is great to hear that this has been fixed.

AndyGreenwell added a commit to AndyGreenwell/IJulia.jl that referenced this issue Apr 21, 2016
This proposed change amends and extends the previously included (so-called) hacks for Windows that were added for issue JuliaLang#363 (that are waiting on issue JuliaLang#448 for the jupyter project).  These changes allow for IJulia to work a version of Python that has been downloaded from python.org, where jupyter was pip installed with a version recent enough to include jupyter-kernelspec.exe and jupyter-notebook.exe, and where the end user has set the JUPYTER environment variable either at the system level or in ENV within their Julia session prior to building IJulia via Pkg.build.

If the issues that led to the discussion in JuliaLang#363 and jupyter issue JuliaLang#448 have been addressed, then the changes in this commit and PR can likely be ignored.
stevengj pushed a commit that referenced this issue Apr 25, 2016
* Additional workarounds for jupyter-kernelspec.exe

This proposed change amends and extends the previously included (so-called) hacks for Windows that were added for issue #363 (that are waiting on issue #448 for the jupyter project).  These changes allow for IJulia to work a version of Python that has been downloaded from python.org, where jupyter was pip installed with a version recent enough to include jupyter-kernelspec.exe and jupyter-notebook.exe, and where the end user has set the JUPYTER environment variable either at the system level or in ENV within their Julia session prior to building IJulia via Pkg.build.

If the issues that led to the discussion in #363 and jupyter issue #448 have been addressed, then the changes in this commit and PR can likely be ignored.

* Adding changes based on line note suggestions

Addressing the line notes, #416 (comment) and #416 (comment) added by @stevengj

* Correction based on line note

Updating based on [comment](#416 (comment))
@bsouthwood
Copy link

bsouthwood commented Apr 26, 2016

On Windows 7, 64-bit.
Installed Julia v0.4.5 -> Installed Anaconda (Python 3, 64 bit)
ran Pkg.add("IJulia") and it failed.
I installed Julia v0.5 (unstable version) and it worked.

Here is the error:

INFO: Downloading miniconda installer ...
INFO: Installing miniconda ...
===============================[ ERROR: IJulia ]================================

LoadError: could not spawn `'C:\Users\bsouthwood\.julia\v0.4\Conda\deps\usr\installer.exe' /S /AddToPath=0 /RegisterPython=0 '/D=C:\Users\bsouthwood\.julia\v0.4\Conda\deps\usr'`: unknown error (UNKNOW
N)
while loading C:\Users\bsouthwood\.julia\v0.4\IJulia\deps\build.jl, in expression starting on line 35

@stevengj
Copy link
Member

@bsouthwood, that should be reported at Conda.jl

@bsouthwood
Copy link

Apologiea, i'm a noob.. I checked line 35 of the build.ml file and it contained a jupytyr variable so i thought it was related to this threas.

@hayd
Copy link
Member

hayd commented May 21, 2016

It looks like IJulia.jl is using the globally installed jupyter/ipython (rather than one locally installed from Conda.jl). This means that if you have ipython installed but not jupyter (specifically jupyter_client, though with just that notebook() will just immediately exit) you'll get the error noted above.

@stevengj
Copy link
Member

@bsouthwood, to simplify installation, do ENV["JUPYTER"]=""; Pkg.build("IJulia") ... this will use the Conda Jupyter and will auto-install everything for you.

@bsouthwood
Copy link

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants