Opened 3 years ago
Last modified 3 months ago
#28754 new enhancement
Make sage run in Julia's python-jl
Reported by: | mkoeppe | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-9.7 |
Component: | porting | Keywords: | conda, julia, signals |
Cc: | embray, jdemeyer, dimpase, isuruf, saraedum, slelievre | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
I installed Julia 1.0.3 and Sage 8.8 in conda on Mac OS X Mojave
using the following file environment-sage-julia.yml
:
name: sage-julia channels: - conda-forge - defaults dependencies: - python=3 - sage=8.9 - julia - pip - pip: - julia # python interface to julia, see https://github.com/JuliaPy/pyjulia
and the commands:
conda env create -f environment-sage-julia.yml conda activate sage-julia
This gives a working sage
:
$ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 8.9, Release Date: 2019-09-29 │ │ Using Python 3.7.3. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage:
Next, I initialize "PyJulia?", following the example here: https://github.com/JuliaPy/pyjulia
python -c 'import julia; julia.install();'
Now I can usepython-jl
, a julia-enabled python:
python-jl -c 'import julia; from julia import Base; print(julia.Base.VERSION); import sage.env; print(sage.env.SAGE_VERSION)'
So far this works, giving:
<PyCall.jlwrap 1.0.3> 8.8
But then I try this, which just loads a few more millions of lines of code:
python-jl -c 'from sage.all import *'
And it fails:
Traceback (most recent call last): File "/Users/mkoeppe/miniconda3/envs/sage-cgf-tf2/lib/python3.7/site-packages/julia/pseudo_python_cli.py", line 308, in main python(**vars(ns)) File "/Users/mkoeppe/miniconda3/envs/sage-cgf-tf2/lib/python3.7/site-packages/julia/pseudo_python_cli.py", line 52, in python exec(command, scope) File "<string>", line 1, in <module> File "/Users/mkoeppe/miniconda3/envs/sage-cgf-tf2/lib/python3.7/site-packages/sage/all.py", line 84, in <module> from sage.misc.all import * # takes a while File "/Users/mkoeppe/miniconda3/envs/sage-cgf-tf2/lib/python3.7/site-packages/sage/misc/all.py", line 84, in <module> from .functional import (additive_order, File "/Users/mkoeppe/miniconda3/envs/sage-cgf-tf2/lib/python3.7/site-packages/sage/misc/functional.py", line 27, in <module> from sage.rings.complex_double import CDF File "sage/rings/integer.pxd", line 7, in init sage.rings.complex_double (build/cythonized/sage/rings/complex_double.c:23709) cdef class Integer(EuclideanDomainElement): File "sage/rings/rational.pxd", line 8, in init sage.rings.integer (build/cythonized/sage/rings/integer.c:51965) cdef class Rational(sage.structure.element.FieldElement): File "sage/rings/rational.pyx", line 81, in init sage.rings.rational (build/cythonized/sage/rings/rational.c:39473) from .integer_ring import ZZ File "sage/rings/integer_ring.pyx", line 58, in init sage.rings.integer_ring (build/cythonized/sage/rings/integer_ring.c:17410) import sage.rings.ideal File "/Users/mkoeppe/miniconda3/envs/sage-cgf-tf2/lib/python3.7/site-packages/sage/rings/ideal.py", line 36, in <module> from sage.interfaces.singular import singular as singular_default File "/Users/mkoeppe/miniconda3/envs/sage-cgf-tf2/lib/python3.7/site-packages/sage/interfaces/singular.py", line 332, in <module> from .expect import Expect, ExpectElement, FunctionElement, ExpectFunction File "/Users/mkoeppe/miniconda3/envs/sage-cgf-tf2/lib/python3.7/site-packages/sage/interfaces/expect.py", line 59, in <module> from sage.interfaces.sagespawn import SageSpawn File "sage/interfaces/process.pxd", line 1, in init sage.interfaces.sagespawn (build/cythonized/sage/interfaces/sagespawn.c:4733) cdef class ContainChildren(object): File "sage/interfaces/process.pyx", line 25, in init sage.interfaces.process (build/cythonized/sage/interfaces/process.c:5123) from cysignals.pysignals import changesignal File "src/cysignals/pysignals.pyx", line 488, in init cysignals.pysignals File "src/cysignals/pysignals.pyx", line 372, in cysignals.pysignals.changesignal.__exit__ File "src/cysignals/pysignals.pyx", line 318, in cysignals.pysignals.setsignal File "/Users/mkoeppe/miniconda3/envs/sage-cgf-tf2/lib/python3.7/signal.py", line 47, in signal handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler)) TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object
Change History (12)
comment:1 follow-up: ↓ 3 Changed 3 years ago by
comment:2 Changed 3 years ago by
- Description modified (diff)
comment:3 in reply to: ↑ 1 Changed 3 years ago by
comment:4 Changed 2 years ago by
- Milestone changed from sage-9.0 to sage-9.1
Ticket retargeted after milestone closed
comment:5 Changed 2 years ago by
- Milestone changed from sage-9.1 to sage-9.2
pushing these forward to 9.2
comment:6 Changed 22 months ago by
- Milestone changed from sage-9.2 to sage-9.3
comment:7 Changed 21 months ago by
- Cc slelievre added
- Description modified (diff)
- Keywords signals added
comment:8 Changed 16 months ago by
- Milestone changed from sage-9.3 to sage-9.4
comment:9 Changed 15 months ago by
The cysignals problems you mention may be related to the notes here.
comment:10 Changed 10 months ago by
- Milestone changed from sage-9.4 to sage-9.5
comment:11 Changed 5 months ago by
- Milestone changed from sage-9.5 to sage-9.6
comment:12 Changed 3 months ago by
- Milestone changed from sage-9.6 to sage-9.7
Note: See
TracTickets for help on using
tickets.
Does
python -c 'from sage.all import *'
work?