Installing the optional python3 package seems to break Sage

168 views
Skip to first unread message

Emmanuel Charpentier

unread,
Oct 21, 2015, 7:30:31 AM10/21/15
to sage-support
This is probably related to Trac#18521, but on Linux (Debian testing) : Installing the optional python3 package breaks my Sage installation. After installing it, I get :

charpent@SAP5057241:~$ sage
/usr/local/sage/src/bin/sage-env : ligne 423 :  3485 Abandon                 "$SAGE_ROOT/local/bin/python" -c 'import pkg_resources; pkg_resources.get_distribution("matplotlib").version' 2> /dev/null
┌────────────────────────────────────────────────────────────────────┐
│ SageMath Version 6.9, Release Date: 2015-10-10                     │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
Fatal Python error: Py_Initialize: Unable to get the locale encoding
  File "/usr/local/sage/local/lib/python/encodings/__init__.py", line 123
    raise CodecRegistryError,\
                            ^
SyntaxError: invalid syntax
/usr/local/sage/src/bin/sage : ligne 388 :  3493 Abandon                 sage-location


After this, my Sage installation is broken real good : I can't even make...

Shouldn't we displace python3 in "experimental" packages ?

HTH,

--
Emmanuel Charpentier

R. Andrew Ohana

unread,
Oct 21, 2015, 3:48:14 PM10/21/15
to sage-support

There are a number of ways in which sage assumes you only have a single version of python installed. The main reason for introducing the python3 package was so developers interested in porting sage to python 3 could easily try building sage with python 3 instead of python 2.

William Stein

unread,
Oct 21, 2015, 4:53:23 PM10/21/15
to sage-support
I think by definition optional packages shouldn't destroy an existing
Sage install beyond all repair. In my experience many enthusiastic
users will try to install all optional packages. It's a pretty
standard thing to do given the option.

The OP's question is 'Shouldn't we displace python3 in "experimental"
packages ?', and I think the answer should be YES!

William


--
William (http://wstein.org)

The Geeko

unread,
Aug 10, 2016, 4:13:14 AM8/10/16
to sage-support
I just encountered this problem.... sage -i py3 ( to install python3)... broke my whole system... Is there a single "undo" operation so that I can return to my working copy?

Dima Pasechnik

unread,
Aug 10, 2016, 4:22:46 AM8/10/16
to sage-support


On Wednesday, August 10, 2016 at 9:13:14 AM UTC+1, The Geeko wrote:
I just encountered this problem.... sage -i py3 ( to install python3)... broke my whole system... Is there a single "undo" operation so that I can return to my working copy?

do you mean 

sage -i python3 

IMHO Sage does not have a package named py3

Dima Pasechnik

unread,
Aug 10, 2016, 4:34:59 AM8/10/16
to sage-support


On Wednesday, August 10, 2016 at 9:22:46 AM UTC+1, Dima Pasechnik wrote:


On Wednesday, August 10, 2016 at 9:13:14 AM UTC+1, The Geeko wrote:
I just encountered this problem.... sage -i py3 ( to install python3)... broke my whole system... Is there a single "undo" operation so that I can return to my working copy?

do you mean 

sage -i python3 

this breaks sage, as it makes the symbolic link 'python' to point to 'python3' in SAGE_LOCAL/bin.
To fix, it suffices to make it point to python2 instead:

cd SAGE_ROOT # where your Sage is installed
cd local/bin
ln -sf python2 python

Then everything works as before
(and you may also use python3 script from 'sage -sh')

Perhaps a proper fix would be to leave python symbolic link as it is.

Dima

Dima Pasechnik

unread,
Aug 10, 2016, 4:40:50 AM8/10/16
to sage-support

leif

unread,
Aug 10, 2016, 5:39:44 AM8/10/16
to sage-s...@googlegroups.com
Dima Pasechnik wrote:
> this is now https://trac.sagemath.org/ticket/21199

Is it at all supposed to be used that way? (I don't think so. IMHO
it's an optional package to use *instead* just like GMP vs. MPIR at Sage
*configure* time, not to be installed afterwards.)

Still, as is it's presumably confusing and dangerous.


-leif

> On Wednesday, August 10, 2016 at 9:34:59 AM UTC+1, Dima Pasechnik wrote:
>
>
>
> On Wednesday, August 10, 2016 at 9:22:46 AM UTC+1, Dima Pasechnik wrote:
>
>
>
> On Wednesday, August 10, 2016 at 9:13:14 AM UTC+1, The Geeko wrote:
>
> I just encountered this problem.... sage -i py3 ( to install
> python3)... broke my whole system... Is there a single
> "undo" operation so that I can return to my working copy?
>
>
> do you mean
>
> sage -i python3
>
>
> this breaks sage, as it makes the symbolic link 'python' to point to
> 'python3' in SAGE_LOCAL/bin.
> To fix, it suffices to make it point to python2 instead:
>
> cd SAGE_ROOT # where your Sage is installed
> cd local/bin
> ln -sf python2 python
>
> Then everything works as before
> (and you may also use python3 script from 'sage -sh')
>
> Perhaps a proper fix would be to leave python symbolic link as it is.
>
> Dima
>
>
> IMHO Sage does not have a package named py3
>
>
>
>
> On Wednesday, October 21, 2015 at 6:30:31 AM UTC-5, Emmanuel
> Charpentier wrote:
>
> This is probably related to Trac#18521
> <http://trac.sagemath.org/ticket/18521>, but on Linux

Dima Pasechnik

unread,
Aug 10, 2016, 6:18:31 AM8/10/16
to sage-support


On Wednesday, August 10, 2016 at 10:39:44 AM UTC+1, leif wrote:
Dima Pasechnik wrote:
> this is now https://trac.sagemath.org/ticket/21199

Is it at all supposed to be used that way?  (I don't think so.  IMHO
it's an optional package to use *instead* just like GMP vs. MPIR at Sage
*configure* time, not to be installed afterwards.)

I cannot see how this can be an optional package this way; in this way it would require all the tests passing!
(i.e. full python3 support for  Sage :-))

leif

unread,
Aug 10, 2016, 6:53:35 AM8/10/16
to sage-s...@googlegroups.com
Dima Pasechnik wrote:
> On Wednesday, August 10, 2016 at 10:39:44 AM UTC+1, leif wrote:
>
> Dima Pasechnik wrote:
> > this is now https://trac.sagemath.org/ticket/21199
> <https://trac.sagemath.org/ticket/21199>
>
> Is it at all supposed to be used that way? (I don't think so. IMHO
> it's an optional package to use *instead* just like GMP vs. MPIR at
> Sage
> *configure* time, not to be installed afterwards.)
>
>
> I cannot see how this can be an optional package this way; in this way
> it would require all the tests passing!
> (i.e. full python3 support for Sage :-))

And that's the reason we don't have a 'configure' option
'--with-python=...' yet (just the env var SAGE_PYTHON3 which is looked
at when configuring Sage). ;-)

But we don't have a package type 'alternative' either (which would make
sense for Python2/Python3, MPIR/GMP), just 'standard' and 'optional' in
this case. Hence these packages are explicitly treated specifically in
the build system ('configure' and Makefiles); in fact, the choice made
at *configure* time gets hardcoded into the generated Makefile.


-leif

Dima Pasechnik

unread,
Aug 10, 2016, 10:09:50 AM8/10/16
to sage-support


On Wednesday, August 10, 2016 at 9:34:59 AM UTC+1, Dima Pasechnik wrote:


On Wednesday, August 10, 2016 at 9:22:46 AM UTC+1, Dima Pasechnik wrote:


On Wednesday, August 10, 2016 at 9:13:14 AM UTC+1, The Geeko wrote:
I just encountered this problem.... sage -i py3 ( to install python3)... broke my whole system... Is there a single "undo" operation so that I can return to my working copy?

do you mean 

sage -i python3 

this breaks sage, as it makes the symbolic link 'python' to point to 'python3' in SAGE_LOCAL/bin.
To fix, it suffices to make it point to python2 instead:

cd SAGE_ROOT # where your Sage is installed
cd local/bin
ln -sf python2 python

Then everything works as before
(and you may also use python3 script from 'sage -sh')

in fact, it turned out that I also needed to rebuild python2 package, and then run make.

sage -f python2
make

otherwise ipython, doctesting, and some stuff related to dictionaries didn't quite work.
So this is not that trivial, apparently, and needs further investigation.

William Stein

unread,
Aug 10, 2016, 1:56:31 PM8/10/16
to sage-support
I was really surprised when I started Sage that people would often try
to **install all optional packages**, then report anything that went
wrong. I bet people still try to do this...
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.



--
William (http://wstein.org)

Jori Mäntysalo

unread,
Aug 11, 2016, 2:55:47 AM8/11/16
to sage-support
On Wed, 10 Aug 2016, William Stein wrote:

> I was really surprised when I started Sage that people would often try
> to **install all optional packages**, then report anything that went
> wrong. I bet people still try to do this...

Isn't it supposed to work... And on the servers I would like to have good
coverage of features. This is not sage-specific: I can guess that some
users here will use R and some might use Octave, so why not install both
of them? (Well, nowadays I can just forward them to our Sage-server.)

Of course I will not install all packages for, say, Ubuntu Linux, but Sage
has not that many available.

--
Jori Mäntysalo

leif

unread,
Aug 11, 2016, 3:28:36 AM8/11/16
to sage-s...@googlegroups.com
Jori Mäntysalo wrote:
> On Wed, 10 Aug 2016, William Stein wrote:
>
>> I was really surprised when I started Sage that people would often try
>> to **install all optional packages**, then report anything that went
>> wrong. I bet people still try to do this...

Well, it's good if people test they're still working, and not rottening.

The dependencies of (also optional) "new-style" packages at least are
handled automatically now. (And cleaning up / converting old-style
packages is just happening once again.)


> Isn't it supposed to work... And on the servers I would like to have
> good coverage of features. This is not sage-specific: I can guess that
> some users here will use R and some might use Octave, so why not install
> both of them? (Well, nowadays I can just forward them to our Sage-server.)
>
> Of course I will not install all packages for, say, Ubuntu Linux, but
> Sage has not that many available.

As mentioned on the ticket Dima created, the python3 package should
still have type "experimental" at this point.


-leif


Reply all
Reply to author
Forward
0 new messages