Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

`pyimport_conda` yields `PyObject NULL`

Aperta
#301 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
julia, python
Ambito
backend

Direzione di ricerca

Inizia riproducendo l'esempio in un ambiente fresco e ispeziona src/symbolic.jl, soprattutto la configurazione di pyimport_conda("sympy.stats", "sympy"). Confrontala con il modulo standalone funzionante e con gli avvisi sui moduli chiusi; è completato quando Soss.stats restituisce un oggetto utilizzabile senza segfault.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hi,

I'm hitting a bug I'm having some trouble replicating, hope you might be able to steer me in the right direction.

At a very high level, the problem happens when I

  1. Import sympy.stats in the standard way within my package
  2. using Soss (my package) externally
  3. Make a call involving stats

Result:

julia> Soss.stats
PyObject NULL

In some cases, this triggers a segfault.


For context, I've tried this in both Julia 1.2 and 1.3.

Also, the following works with no trouble:

# in a file
module M
import PyCall
import SymPy
using SymPy: Sym, sympy, symbols

export SymPy, stats, symbols

stats = PyCall.pyimport_conda("sympy.stats", "sympy")
SymPy.import_from(stats)

import Distributions.Normal
export Normal
Normal(μ::Sym, σ::Sym) = stats.Normal(:Normal, μ,σ) |> SymPy.density
Normal(μ,σ) = Normal(promote(μ,σ)...)
end

using Distributions
using .M

stats.Normal(:Normal, symbols(:μ),1) |> SymPy.density
Normal(symbols(:μ),1)

# in the REPL
julia> stats.Normal(:Normal, symbols(:μ),1) |> SymPy.density
NormalDistribution(μ, 1)

julia> Normal(symbols(:μ),1)
NormalDistribution(μ, 1)

The code in symbolic.jl takes this same approach. But when I try from a fresh environment, ...

(Soss#dev) pkg> add Soss#dev
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
  Updating git-repo `https://github.com/cscherrer/Soss.jl.git`
 Resolving package versions...
  Updating `~/Soss#dev/Project.toml`
  [8ce77f84] + Soss v0.6.0 #dev (https://github.com/cscherrer/Soss.jl.git)
  Updating `~/Soss#dev/Manifest.toml`
  ... (other dependencies)
  [8f4d0f93] + Conda v1.3.0
  [24249f21] + SymPy v1.0.7

julia> using Soss
[ Info: Recompiling stale cache file /home/chad/.julia/compiled/v1.2/Soss/vXX0U.ji for Soss [8ce77f84-9b61-11e8-39ff-d17a774bf41c]

# *LOTS* OF THESE
WARNING: eval into closed module SymPy:
Expr(:block, #= Symbol("/home/chad/.julia/packages/SymPy/1Cwgd/src/utils.jl"):252 =#, Expr(:call, :P, Expr(:parameters, Expr(:..., :kwargs)), Expr(:::, :ex, :SymbolicObject), Expr(:..., :args)) = Expr(:block, #= Symbol("/home/chad/.julia/packages/SymPy/1Cwgd/src/utils.jl"):252 =#, Expr(:call, Expr(:call, :getproperty, PyCall.PyObject(o=0x00007f6c2c085778), "P"), Expr(:parameters, Expr(:..., :kwargs)), :ex, Expr(:..., :args))))
  ** incremental compilation may be fatally broken for this module **

julia> Soss.stats
PyObject NULL

Any ideas?

Lingua principale
Julia
Stelle
282
Fork
59
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di JuliaPy/SymPy.jl

Tutte le issue di JuliaPy/SymPy.jl

Issue simili

Altre issue su Julia

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.