Windows 10: SageMath crashes on start with permission errors, but seems to work if I run "as administrator"

asked 2018-03-21 06:59:32 -0600

cretinsgaccount gravatar image

I think I have a workaround, at least, but thought I'd post this in case there's something I can fix or if someone else comes across the same problem, because I couldn't find any mention of these errors myself.

I'm using the Windows installer 0.3 for SageMath 8.1. It appears to install without issues but when I initially opened it I got this sequence of messages:

/etc/profile: line 111: cd: /home/user: Permission denied
WARNING: Failed attempt to cd into /home/user!
mkdir: cannot create directory ‘/home/user/.sagemath-8.1’: Permission denied
cp: cannot create directory '/home/user/.sagemath-8.1': Permission denied
│ SageMath version 8.1, Release Date: 2017-12-07                     │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
mkdir: cannot create directory ‘/dot_sage’: Permission denied
/opt/sagemath-8.1/local/lib/python2.7/site-packages/IPython/ UserWarning: IPython parent '/dot_sage' is not a writable location, using a temp directory.
  " using a temp directory.".format(parent))

It goes on to say Sage crashed, and asks me to email in the crash report. When I tried opening the shell or Notebook I got similar errors.

Then while groping for something to try I right-clicked and ran "as an administrator" and everything appears to resolve.

I'm not the most savvy at high-level IT stuff but I thought this was strange, as I haven't had to use that feature with anything else I've installed, and there's no shortage of crap I've installed. There's only one account on my computer, there shouldn't be administrator permission issues.

edit retag flag offensive close merge delete


It's difficult exactly to help with something like this without being on the very machine where the problem is. But it sounds likely that there are some permission problems on your home directory; e.g. C:\Users\<Your Username>. I'm unsure though because if that were the case I'd think you'd have other problems. If you go to that directory in Windows explorer and right click on it and select "Properties" from the menu you should be able to get to the "Security" tab and check the permissions on the directory...

Iguananaut gravatar imageIguananaut ( 2018-03-21 08:08:47 -0600 )edit

This is a linux machine answering... Which is exactly the location /home/user on the Windows box running sage and which are the rights for it?! Is it possible to start in the command line (after Win+R and cmd) the "sage shell" via sage -sh and then check via set SAGE the settings for the sage specific environment variables?

dan_fulea gravatar imagedan_fulea ( 2018-03-21 12:58:30 -0600 )edit

@dan_fulea are you sure you're commenting on the correct question? With apologies, your comment doesn't make much sense to me (to be clear, I'm the creator an present maintainer of the Windows release of Sage so I'm not completely reaching around in the dark here). The problem is definitely that the Windows permissions on the user's directories are messed up somehow.

Iguananaut gravatar imageIguananaut ( 2018-03-27 04:06:29 -0600 )edit

Sorry, this was an answer without specific knowledge of the situation, i also have no Win* operating system on the many laptops. Starting from the message

/etc/profile: line 111: cd: /home/user: Permission denied
WARNING: Failed attempt to cd into /home/user!

i assumed that a linux emulation exists in the windows "run sage" call, which was producing the error. On my machine, i would find and edit /etc/profile and give a print of the environment variables, and of the /home/user value. (Possibly Windows performed a system-wide install, and a specific user has no rights to access the systemwide home...)

I'm afraid there is no SAGE_HOME or SAGE_ROOT or ... and/or no sage shell in the windows install, sorry for this misleading point!

dan_fulea gravatar imagedan_fulea ( 2018-03-27 17:27:02 -0600 )edit

That fact that it works when they "Run as administrator" means the Windows permissions are corrupt on the user's home directory.

Iguananaut gravatar imageIguananaut ( 2018-04-11 09:25:59 -0600 )edit

I have the same problem, namely that I am trying to run Sage 8.3 under Windows 10 64 bit, and need to run as administrator for the Sage kernel not to crash. I was seeing 'permission denied' type error messages when Sage was trying to access the .sage file, and the kernel repeatedly tried to restart. Note that this only applies if you install Sage for all users, which means that the install file must be run as administrator. I uninstalled Sage, and re-installed for a single user, then it works normally.

BaglartimusMaximus gravatar imageBaglartimusMaximus ( 2018-09-06 07:47:06 -0600 )edit

@BaglartiumusMaximus Thanks that's useful information. It's still a bit strange since before 8.3 install as admin was the only option and it worked fine for most users. So I don't know why other users have messed up permission bits.

Iguananaut gravatar imageIguananaut ( 2018-09-11 08:35:28 -0600 )edit

i installed sagemath 8.4 on Windows 10. as normal user (no admin rights) when i try to start sagemath 8.4 or sagemath 8.4 Shell or sagemath 8.4 Notebook i get

   mkdir: das Verzeichnis „/home/sage/.sage//R“ kann nicht angelegt werden: Permission denied
    /opt/sagemath-8.4/src/bin/sage-env: Zeile 485: /home/sage/.sage//R/Makevars.user: No such file or directory

when i start as admin than sagemath 8.4 Shell or sagemath 8.4 Notebook dit work. sagemath 8.4 will produce:

--> 136                 os.rename(path, new_path)
    137             else:
    138                 # Otherwise, simply create the new path.
OSError: [Errno 21] Is a directory
pi gravatar imagepi ( 2018-11-27 08:29:51 -0600 )edit