sagemath / sage-windows

Build tools for the Sagemath Windows installer
350 stars 47 forks source link

SageMath kernel folder not found while installing it to Jupyter environment #63

Open Booodaness opened 3 years ago

Booodaness commented 3 years ago

I was recently trying to install SageMath kernel into the global version of Jupyter using this command,

jupyter kernelspec install $SAGE_ROOT\local\share\jupyter\kernels\sagemath

Where $SAGE_ROOT is the default installation prefix of Sage. However, the above gave the error:

Traceback (most recent call last):
  File "c:\users\booodaness\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\booodaness\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Booodaness\AppData\Local\Programs\Python\Python39\Scripts\jupyter-kernelspec.EXE\__main__.py", line 7, in <module>
  File "c:\users\booodaness\appdata\local\programs\python\python39\lib\site-packages\traitlets\config\application.py", line 845, in launch_instance
    app.start()
  File "c:\users\booodaness\appdata\local\programs\python\python39\lib\site-packages\jupyter_client\kernelspecapp.py", line 266, in start
    return self.subapp.start()
  File "c:\users\booodaness\appdata\local\programs\python\python39\lib\site-packages\jupyter_client\kernelspecapp.py", line 132, in start
    self.kernel_spec_manager.install_kernel_spec(self.sourcedir,
  File "c:\users\booodaness\appdata\local\programs\python\python39\lib\site-packages\jupyter_client\kernelspec.py", line 340, in install_kernel_spec
    shutil.copytree(source_dir, destination)
  File "c:\users\booodaness\appdata\local\programs\python\python39\lib\shutil.py", line 555, in copytree
    with os.scandir(src) as itr:
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Program'

Jupyter and SageMath are installed properly on my system (Windows 10). Just in case this helps, the version of Sage installed on my system is 9.1. There were some plotting issues in more recent versions, so this was the best I could do for now, as an amateur.

How do I fix this error?

embray commented 3 years ago

Someone has tried to do this before but it wasn't simple, because it does not recognized Windows style paths. I wrote about it here some time ago but I don't recall if the solution works: https://stackoverflow.com/questions/51300460/how-to-install-sagemath-kernel-in-anaconda/51308972#51308972

Booodaness commented 3 years ago

Someone has tried to do this before but it wasn't simple, because it does not recognized Windows style paths. I wrote about it here some time ago but I don't recall if the solution works: https://stackoverflow.com/questions/51300460/how-to-install-sagemath-kernel-in-anaconda/51308972#51308972

Thanks a lot!! That looks really helpful!!

Booodaness commented 3 years ago

@embray Couldn't resolve the issue in the way you described :( but still thanks, it helped me understand the issue even as a very new programmer.

Btw, can we install the SageMath kernel to Jupyter from the Sage command line? Using SageKernelSpec (http://www2.math.ritsumei.ac.jp/doc/static/reference/repl/sage/repl/ipython_kernel/install.html)? I didn't understand which command can do that, in the documentation.

embray commented 3 years ago

@Booodaness By the way, that's some unofficial mirror of the sage docs for a fairly old version; The up-to-date version is here: https://doc.sagemath.org/html/en/reference/repl/sage/repl/ipython_kernel/install.html

However, I don't think anything on there is going to help you.

It's been long enough since I last looked at this issue that I don't recall what all the problems are. One of the biggest problems was simply the path issue, which will need to be fixed, I think in Sage. The other is the poller issue. I think this will require some fixes before it can really work easily (which I would indeed like it to). Then I can add instructions or even a command to make this simpler to do.

Booodaness commented 2 years ago

@embray Thank you for sending the updated version!

Thank you.

embray commented 2 years ago

Please keep this issue open. I think it's worth having a clean resolution (which may require some upstream fixes to Sage and/or Jupyter)