0

I wanted to have Sagemath notebooks open on double click. I installed nbopen, then I had to manually add the Sagemath kernel to Jupyter (How to install SageMath kernel in Anaconda?), and when I finally managed to start notebooks on double click, I still ran into issues. Namely, running sys.path gives this.

['',
 '/home/sage/.local/share/jupyter/kernels/sagemath',
 '/home/sage/C',
 '/home/sage/\\Users\\<user>\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python37\\Scripts;C',
 '/home/sage/\\Program Files\\SageMath 9.0\\runtime\\opt\\sagemath-9.0\\src;C',
 '/home/sage/\\Program Files\\SageMath 9.0\\runtime\\opt\\sagemath-9.0\\src\\sage;',
 '/opt/sagemath-9.0/local/lib/python37.zip',
 '/opt/sagemath-9.0/local/lib/python3.7',
 '/opt/sagemath-9.0/local/lib/python3.7/lib-dynload',
 '/home/sage/C:\\Users\\<user>\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\\LocalCache\\local-packages/lib/python3.7/site-packages',
 '/opt/sagemath-9.0/local/lib/python3.7/site-packages',
 '/opt/sagemath-9.0/local/lib/python3.7/site-packages/win32',
 '/opt/sagemath-9.0/local/lib/python3.7/site-packages/win32\\lib',
 '/opt/sagemath-9.0/local/lib/python3.7/site-packages/Pythonwin',
 '/opt/sagemath-9.0/local/lib/python3.7/site-packages/IPython/extensions',
 '/home/sage/.sage/ipython-5.0.0']

How do I fix sys.path?

Sasha
  • 23
  • 4
  • Exactly what steps did you take, and what exactly were the issues you ran into? I can say for sure you have some `sys.path` entries that are broken (`/home/sage/C` as well as all the other ones containing mixed unix and windows paths). These directories don't even exist though so it won't necessarily outright break anything, but it does suggest a configuration error somewhere). – Iguananaut Jul 28 '20 at 16:28
  • Actually I think I understand now, if you followed the steps in the answer you linked it should work. I' not sure how nbopen works though. It looks like it's somehow passing a Windows-style PYTHONPATH to Sage's Python, which is being interpreted wildly incorrectly. What does `os.environ.get('PYTHONPATH')` return? – Iguananaut Jul 28 '20 at 16:34
  • I did a uninstall and reinstall since I posted the question. Anyway, `os.environ.get('PYTHONPATH')` returns `'C:\\Program Files\\SageMath 9.0\\runtime\\opt\\sagemath-9.0\\src'`. I tried on VSCode and I think the issue is that something is interpreting `:` as separator instead of `;`. – Sasha Jul 29 '20 at 17:13

0 Answers0