JuliaPy / JuliaPy/PythonCall.jl

Two calls needed to pyimport a module in Julia, the first one crashes

Offen
#681 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Julia
Sterne
1.1k
Forks
86
Ø Merge
1 T. 22 Std.
Gemergte PRs (30 T.)
3

Beschreibung

**Affects:** PythonCall

I installed sagelib using CondaPkg in Julia:
`pkg> conda add sagelib`

But importing it requires two calls for sage.all. Here is a Julia session:

```
┌──(greg㉿ellipse)-[~]
└─$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.11.7 (2025-09-08)
_/ |\__'_|_|_|\__'_| |
|__/ |

julia> using PythonCall

julia> sg=pyimport("sage.all")
ERROR: Python: TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object
Python stacktrace:
[1] signal
@ signal ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.12/signal.py:58
[2] cysignals.pysignals.setsignal
@ cysignals/pysignals.pyx:319
[3] cysignals.pysignals.changesignal.__exit__
@ cysignals/pysignals.pyx:373
[4] init cysignals.pysignals
@ cysignals/pysignals.pyx:488
[5] init sage.interfaces.process (build/cythonized/sage/interfaces/process.c:7112)
@ sage/interfaces/process.pyx:24
[6]
@ ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.12/site-packages/sage/parallel/use_fork.py:22
[7]
@ ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.12/site-packages/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py:33
[8]
@ ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.12/site-packages/sage/dynamics/arithmetic_dynamics/projective_ds.py:66
[9]
@ ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.12/site-packages/sage/dynamics/arithmetic_dynamics/all.py:5
[10]
@ ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.12/site-packages/sage/dynamics/all.py:25
[11]
@ ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.12/site-packages/sage/all.py:127
Stacktrace:
[1] pythrow()
@ PythonCall.Core ~/.julia/packages/PythonCall/mkWc2/src/Core/err.jl:77
[2] errcheck
@ ~/.julia/packages/PythonCall/mkWc2/src/Core/err.jl:10 [inlined]
[3] pyimport(m::String)
@ PythonCall.Core ~/.julia/packages/PythonCall/mkWc2/src/Core/builtins.jl:1458
[4] top-level scope
@ REPL[2]:1

julia> sg=pyimport("sage.all")
Python:

julia> sg.factor(sg.ZZ(376655555555555555554444444444443332346777712))
Python: 2^4 * 53 * 163 * 12391 * 219914853701821004027468433435262943

julia> sg.log(2.3)
Python: 0.832909122935104
```

Kali Linux on WSL
PythonCall v0.9.28
CondaPkg v0.2.33
Python version:
Python: '3.12.11 | packaged by conda-forge | (main, Jun 4 2025, 15:10:57) [GCC 13.3.0]'
sagelib v10.7

I wonder what happens here since in pure Python that works.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start with the pyimport entry point and error-handling paths named in PythonCall.Core/builtins.jl, then reproduce the first and second imports using the reported Julia, PythonCall, CondaPkg, and sagelib versions. Done means the first pyimport("sage.all") succeeds without the signal-handler TypeError and the existing functionality remains usable.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
julia, python
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.