Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Optionally add Sage to native Windows PATH, along with related environment variables #13

Open
embray opened this issue Dec 18, 2017 · 7 comments

Comments

@embray
Copy link
Contributor

embray commented Dec 18, 2017

In playing around with the problem in #12, one thing that I found might be useful would be to add the correct entries to the Windows PATH environment variable for executables installed in Sage to work directly on Windows.

For example, if you try to add Sage's Python interpreter to PyCharm it breaks when PyCharm tries to run it, because the path to the Cygwin DLL (e.g. C:\Program Files\SageMath 8.1\runtime\bin), at the very least, must be on PATH for the executable to even work. If that at a minimum is set, possibly along with the Windows path to $SAGE_LOCAL\bin, then most executables installed in $SAGE_LOCAL can work on the system outside the Sage shell (that is, they can at least execute--in order for them to work correctly additional environment variables may need to be set, such as $SAGE_ROOT, etc.

@PHPirates

@PHPirates
Copy link

I'm not sure what you mean that it would achieve, if I add those to my path PyCharm still won't recognise Sage's python as correct. But it sounds like a step in the right direction, makes sense that other programs should need to know there the executables are.

Cannot set up a python SDK 
at Unknown at C:\Program Files\SageMath 8.0\runtime\opt\sagemath-8.0\local\bin\python.exe (C:\Program Files\SageMath 8.0\runtime\opt\sagemath-8.0\local\bin\python.exe).
The SDK seems invalid.

@embray
Copy link
Contributor Author

embray commented Jan 22, 2018

The error you posted here is because you gave PyCharm a path to a Cygwin symlink (which to native Windows/shell just looks like a normal file that is not a valid executable) hence the error. But even if you give an absolute path to the Python executable that is not sufficient--you need Sage's bin dir to be added to the system PATH environment variable in order for the correct DLLs to be loadable as well. I believe I discussed this in more detail at https://ask.sagemath.org/question/39742/make-pycharm-recognise-the-sage-python-interpreter/

@NavyAdmiral
Copy link

@embray Do you think you'll be adding this soon?

@PHPirates
Copy link

@NavyAdmiral Are you also trying to find a proper IDE for Sage on Windows?

Actually this issue was raised while trying to get Sage to work using PyCharm, but when part of that worked I found that it was (at that time, at least) much too slow: it could take up to 30 seconds for Sage to start and run your code. See the sage-devel google group, in order to run Sage code you have to start up the Sage shell, then convert the code to Python and then run that Python code I think. Something like that.

The next thing I'd try if I had any hopes of succeeding is trying to use vim for windows, as supposedly there are people who have Sage working with vim on linux so it might work better than PyCharm.

Anyway, I think this issue lost relevance by now? @embray

@NavyAdmiral
Copy link

I want to get Sage Intellisense (suggestions, autocompletion, ...) in VSCode.

@PHPirates
Copy link

PHPirates commented Oct 17, 2018

I want to get Sage Intellisense (suggestions, autocompletion, ...) in VSCode.

Yup, that's what I meant. Would be great if you could let people know if you succeeded, when you do :) (you could answer for example on stackoverflow or ask.sagemath.org. )

@embray
Copy link
Contributor Author

embray commented Oct 26, 2018

The link I gave above for how to do this in PyCharm is pretty broadly applicable. At the very least you need to add the correct PATH and SAGE_ROOT set.

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

No branches or pull requests

3 participants