Loading GAP packages in Sagemath Cloud - sage

I'm trying to load some GAP packages in a Sagemath Cloud terminal session without sucesss. For example, when I try to load the SCSCP package I get the following error:
sage: gap.load_package( "SCSCP" )
-----------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-37-249a04a6b510> in <module>()
----> 1 gap.load_package( "SCSCP" )
/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/interfaces/gap.pyc in load_package(self, pkg, verbose)
506 if x == 'fail':
507 raise RuntimeError("Error loading Gap package "+str(pkg)+". "+
--> 508 "You may want to install the gap_packages SPKG.")
509
510 def eval(self, x, newlines=False, strip=True, split_lines=True, **kwds):
RuntimeError: Error loading Gap package SCSCP. You may want to install the gap_packages SPKG.
I thought it would be possible to at least load packages by starting a GAP session using gap.console() but this also fails.
sage: gap.console()
┌───────┐ GAP, Version 4.7.5 of 24-May-2014 (free software, GPL)
│ GAP │ http://www.gap-system.org
└───────┘ Architecture: x86_64-unknown-linux-gnu-gcc-default64
Libs used: gmp, readline
Loading the library and packages ...
Components: trans 1.0, prim 2.1, small* 1.0, id* 1.0
Packages: Alnuth 3.0.0, AtlasRep 1.5.0, AutPGrp 1.6, CTblLib 1.2.2, FactInt 1.5.3, GAPDoc 1.5.1, LAGUNA 3.6.4, Polycyclic 2.11, TomLib 1.2.4
Try '?help' for help. See also '?copyright' and '?authors'
gap> LoadPackage( "IO" );
fail
gap> LoadPackage( "SCSCP" );
fail
gap>

Related

error when starting spyder on ubuntu 22.04

I have just upgrade my ubuntu. I have this error on spyder:
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Traceback (most recent call last):
File "/usr/bin/spyder", line 33, in <module>
sys.exit(load_entry_point('spyder==4.2.1', 'gui_scripts', 'spyder')())
File "/usr/lib/python3/dist-packages/spyder/app/start.py", line 213, in main
mainwindow.main(options, args)
File "/usr/lib/python3/dist-packages/spyder/app/mainwindow.py", line 3624, in main
mainwindow = create_window(app, splash, options, args)
File "/usr/lib/python3/dist-packages/spyder/app/mainwindow.py", line 3482, in create_window
main.setup()
File "/usr/lib/python3/dist-packages/spyder/app/mainwindow.py", line 803, in setup
self.completions = CompletionManager(self)
File "/usr/lib/python3/dist-packages/spyder/plugins/completion/plugin.py", line 97, in __init__
plugin_client = Plugin(self.main)
File "/usr/lib/python3/dist-packages/spyder/plugins/completion/kite/plugin.py", line 50, in __init__
self.installer = KiteInstallerDialog(
File "/usr/lib/python3/dist-packages/spyder/plugins/completion/kite/widgets/install.py", line 287, in __init__
self._integration_widget = KiteIntegrationInfo(self)
File "/usr/lib/python3/dist-packages/spyder/plugins/completion/kite/widgets/install.py", line 58, in __init__
image = image.scaled(image_width, image_height, Qt.KeepAspectRatio,
TypeError: arguments did not match any overloaded call:
scaled(self, int, int, aspectRatioMode: Qt.AspectRatioMode = Qt.IgnoreAspectRatio, transformMode: Qt.TransformationMode = Qt.FastTransformation): argument 1 has unexpected type 'float'
scaled(self, QSize, aspectRatioMode: Qt.AspectRatioMode = Qt.IgnoreAspectRatio, transformMode: Qt.TransformationMode = Qt.FastTransformation): argument 1 has unexpected type 'float'
All the solution that I have found deal with specific application developed my different user and not for probel related to upgrade or ubuntu.
As a quick workaround just comment out the lines in File:
/usr/lib/python3/dist-packages/spyder/plugins/completion/kite/widgets/install.py
58
#image = image.scaled(image_width, image_height, Qt.KeepAspectRatio, Qt.SmoothTransformation)
143
#install_gif.setScaledSize(QSize(image_width, image_height))
244-247
#copilot_label.setPixmap(
# copilot_image.scaled(image_width, image_height,
# Qt.KeepAspectRatio,
# Qt.SmoothTransformation))
(Spyder maintainer here) The Spyder package provided by Ubuntu 22.04 (4.2.1, released in December 2020) is broken with the Python version that comes with it (3.10).
However, this error was fixed in any Spyder version released after 5.3.0, released in March 2022. So, to solve this problem please uninstall the Spyder that comes with Ubuntu and install it with pip in a virtualenv, as explained in our documentation.
I had the exact same problem, did a search with the following two items :
"spyder" + "mainwindow.py, line 3624" # aka a piece of the error message
I found the bug report #16571 on spyder's github : "TypeError in Tour with Python 3.10", which identified python 3.10 as the culprit.
In Debian + aptitude I downgraded python 3 from 3.10 to the 3.9 version, launched Spyder again and...problem solved !

cuxfilter.dashboard.DashBoard.preview keeps throwing "NameError: name 'launch' is not defined" at me

TLDR:
await d.preview() # throws "NameError: name 'launch' is not defined"
# d.preview() # does not throw "NameError: name 'launch' is not defined"; however, it still does not produce the desired image in a jupyter notebook... It's __repr__ prints <coroutine object DashBoard.preview at 0x7f44013aaa70>`
I'm trying to preview a rapids dashboard that is correctly rendering in a separate browser window. However, when I try to preview a rasterized screengrab of the dashboard using the convenient looking plotly method, d.preview(), I keep getting this paradoxical exception, "NameError: name 'launch' is not defined".
await d.preview() works in the documentation here:
https://docs.rapids.ai/api/cuxfilter/stable/themes/Themes.html
I am running rapids21.08 in python3.7 on ubuntu (Pop!_OS 20.10) using an RTX2080 GPU using a jupyter notebook with the default jupyter theme made using $ jt -r, and I am not using any matplotlib funny business. I have run the very common import matplotlib.pyplot as plt command.
This seems like a really common problem which I'm surprised isn't just working... Maybe there's something obvious I'm just missing... Please help me!
The full exception can be found postscript.
Thank you for your time,
Tim
P.S.
# d = some cuxfilter.dashboard.DashBoard instance that apparently works with d.show()
await d.preview() # throws NameError: name 'launch' is not defined
throws
NameError: name 'launch' is not defined
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
/tmp/ipykernel_8654/2723113380.py in async-def-wrapper()
~/anaconda3/envs/pyenv_ub/lib/python3.7/site-packages/cuxfilter/dashboard.py in preview(self)
507 port=port, websocket_origin=url, show=False, start=True
508 )
--> 509 await screengrab("http://" + url)
510 self.stop()
511
~/anaconda3/envs/pyenv_ub/lib/python3.7/site-packages/cuxfilter/assets/screengrab.py in screengrab(url)
6
7 async def screengrab(url):
----> 8 browser = await launch({"slowMo": 5}, args=["--no-sandbox"])
9 page = await browser.newPage()
10 await page.setViewport(
NameError: name 'launch' is not defined
This is probably due to the missing pyppeteer package. Installing this in the conda env should resolve the issue:
conda install -c conda-forge pyppeteer>=0.2.6
cuxfilter=21.10 won't have this issue, as the dependency has been added to it.

cabal install djinn-lib with GHC 8.4?

I'm trying to install djinn-lib with GHC 8.4.1 (from Ubuntu 16.04 apt-get).
$ cabal install djinn-lib
But I get an error about ambiguity in the <> operator as shown at the bottom.
Does anyone know how to go about fixing it?
The cabal version I used was:
$ cabal --version
cabal-install version 2.2.0.0
compiled using version 2.2.0.0 of the Cabal library
The error message is:
$ cabal install djinn-lib
Resolving dependencies...
Configuring djinn-lib-0.0.1.2...
Preprocessing library for djinn-lib-0.0.1.2..
Building library for djinn-lib-0.0.1.2..
[1 of 4] Compiling Djinn.LJTFormula ( src/Djinn/LJTFormula.hs, dist/build/Djinn/LJTFormula.o )
[2 of 4] Compiling Djinn.LJT ( src/Djinn/LJT.hs, dist/build/Djinn/LJT.o )
[3 of 4] Compiling Djinn.HTypes ( src/Djinn/HTypes.hs, dist/build/Djinn/HTypes.o )
src/Djinn/HTypes.hs:242:29: error:
Ambiguous occurrence ‘<>’
It could refer to either ‘Prelude.<>’,
imported from ‘Prelude’ at src/Djinn/HTypes.hs:5:8-19
(and originally defined in ‘GHC.Base’)
or ‘Text.PrettyPrint.HughesPJ.<>’,
imported from ‘Text.PrettyPrint.HughesPJ’ at src/Djinn/HTypes.hs:36:67-70
|
242 | ppPat _ (HPAt s p) = text s <> text "#" <> ppPat 10 p
| ^^
src/Djinn/HTypes.hs:242:41: error:
Ambiguous occurrence ‘<>’
It could refer to either ‘Prelude.<>’,
imported from ‘Prelude’ at src/Djinn/HTypes.hs:5:8-19
(and originally defined in ‘GHC.Base’)
or ‘Text.PrettyPrint.HughesPJ.<>’,
imported from ‘Text.PrettyPrint.HughesPJ’ at src/Djinn/HTypes.hs:36:67-70
|
242 | ppPat _ (HPAt s p) = text s <> text "#" <> ppPat 10 p
| ^^
Failed to install djinn-lib-0.0.1.2
cabal: Error: some packages failed to install:
djinn-lib-0.0.1.2-72XYG7inpNR6A7gk4acAK4 failed during the building phase. The
exception was:
ExitFailure 1
The identifier <> was added to the prelude and it clashes with the existing one from HughesPJ. You can add the line import Prelude hiding((<>>)) to the imports section of the files in question to fix this...

Error in pyomo expression generation with sum using python 3.6

I am using pyomo Pyomo 5.1.1 (CPython 3.6.0 on Linux 3.16.0-4-amd64)
under Python 3.6, and I get an error message when I want to build an Expression in a model using a summation.
Here is a minimal example :
from pyomo.environ import *
from pyomo.opt import SolverFactory
model=ConcreteModel()
model.H=RangeSet(0,23)
model.x=Var(model.H)
E=summation(model.x)
I get the following error :
"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/b67777/anaconda3/lib/python3.6/site-packages/pyomo/core/base/util.py", line 86, in summation
ans += item
File "/home/b67777/anaconda3/lib/python3.6/site-packages/pyomo/core/base/numvalue.py", line 537, in __iadd__
return generate_expression(_iadd,self,other)
File "/home/b67777/anaconda3/lib/python3.6/site-packages/pyomo/core/base/expr_coopr3.py", line 977, in generate_expression
_self = _generate_expression__clone_if_needed(_self, 1)
File "/home/b67777/anaconda3/lib/python3.6/site-packages/pyomo/core/base/expr_coopr3.py", line 918, in _generate_expression__clone_if_needed
% ( getrefcount(obj) - UNREFERENCED_EXPR_COUNT, ))
RuntimeError: Expression entered generate_expression() with too few references (0<0); this is indicative of a SERIOUS ERROR in the expression reuse detection scheme.
"
I get the same error if I replaced the "summation" by a loop over h in model.H.
The bug has been noticed also here : https://github.com/Pyomo/pyomo/issues/103
Is there a simple way to fix this, other than stepping back to older version of Python ?
Thank you very much for your help,
Paulin
Pyomo only supports Python 2.6, 2.7, 3.3, 3.4, and 3.5.
Python 3.6 changed the internal call stack, which invalidated the internal "magic numbers" that Pyomo uses for detecting when an expression is being pointed to by extra variables (i.e., it is potentially being reused in multiple expressions - something that is not allowed by the Pyomo expression trees). The developers are working on a fix (in the pyomo4-expressions branch). Until that fix is merged back into master and released, the only alternative is to install one of the supported Python versions.
Update [3 April 17]: The fix was merged back into master on 7 March 2017. Pyomo should support Python 3.6 in the next patch release.
Update [14 May 17]: Pyomo 5.2 has been released, which provides full support for Python 3.6

IPython notebook and rmagic/rpy2: cannot find module ri2py (OSX 10.8.5, python 2.7, R 3.1)

I'm trying to use the rmagic extension for the IPython notebook, using Python 2.7.6 via Enthought Canopy.
When I try the following example:
import numpy as np
import pylab
X = np.array([0,1,2,3,4])
Y = np.array([3,5,4,6,7])
pylab.scatter(X, Y)
%Rpush X Y
%R lm(Y~X)$coef
I get an error:
AttributeError Traceback (most recent call last)
<ipython-input-7-96dff2c70ba0> in <module>()
1 get_ipython().magic(u'Rpush X Y')
----> 2 get_ipython().magic(u'R lm(Y~X)$coef')
…
/Users/hrob/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/extensions/rmagic.pyc in eval(self, line)
212 res = ro.r("withVisible({%s})" % line)
213 value = res[0] #value (R object)
--> 214 visible = ro.conversion.ri2py(res[1])[0] #visible (boolean)
215 except (ri.RRuntimeError, ValueError) as exception:
216 warning_or_other_msg = self.flush() # otherwise next return seems to have copy of error
AttributeError: 'module' object has no attribute 'ri2py'
I can't find anyone else who's had the same problem and don't know enough to solve it myself. There is no definition for ri2py in conversion.py though.
I initially had installed Anaconda and was running python notebook through that, with exactly the same results.
rpy2 (version 2.4.0) installed successfully but when I test it I get 1 expected failure as follows:
python -m 'rpy2.robjects.tests.__init__'
…
testNewWithTranslation (testFunction.SignatureTranslatedFunctionTestCase) ... expected failure
I don't know if that's related.
Can anyone suggest what the problem might be and how I might fix it? Are the versions of python, R, etc. that I'm using compatible or do I need to re-install/update something?
Are you using %load_ext rmagic?
If so, try using %load_ext rpy2.ipython instead.
This is one of the new features in version 2.4.0.

Resources