Compatibility Issue with Python 3.12.6
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 30/100
Línea de trabajo
Comienza reproduciendo el ejemplo proporcionado de PySRRegressor con las versiones indicadas de Python, Julia, PySR y juliacall en Windows 11; después, inspecciona el traceback de PythonCall y la información de compatibilidad. Se considera terminado cuando el ejemplo completa model.fit e imprime la mejor ecuación sin el JuliaError indicado, y el comportamiento de compatibilidad relevante está documentado o cubierto por una prueba adecuada.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Compatibility Issue with Python 3.12.6
I encountered a JuliaError when trying to fit the PySRRegressor model using the PythonCall package. The error seems to be related to the compatibility of the PythonCall package with Python version 3.12.6.
Steps to Reproduce:
1- Install Python 3.12.6.
2- Install the pysr package using pip install pysr.
3- Run the following code:
import numpy as np
from pysr import PySRRegressor
Sample data
X = np.random.rand(100, 1) # 100 samples, 1 feature
y = 3.0 * X[:, 0] + 2.0 # Example target
Initialize PySR model
model = PySRRegressor(
niterations=100, # Number of iterations
binary_operators=["+", "-", "*", "/"], # Allowed binary operators
unary_operators=["sin", "exp", "log"], # Allowed unary operators
loss="L2", # Loss function (mean squared error)
populations=10, # Number of populations
procs=4, # Number of CPU cores to use
parsimony=0.01, # Encourages simpler equations
maxsize=20, # Maximum size of the equation
)
Fit the model
model.fit(X, y)
View the best equation
print("Best equation:", model.sympy())
View the Hall of Fame (top equations)
print(model)
.
.
Expected Behavior: The PySRRegressor model should fit the data without any errors, and the best equation should be printed.
Actual Behavior: The following error occurs:
JuliaError Traceback (most recent call last)
Cell In[34], line 22
10 model = PySRRegressor(
11 niterations=100, # Number of iterations
12 binary_operators=["+", "-", "*", "/"], # Allowed binary operators
(...)
18 maxsize=20, # Maximum size of the equation
19 )
21 # Fit the model
---> 22 model.fit(X, y)
24 # View the best equation
25 print("Best equation:", model.sympy())
File c:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\site-packages\pysr\sr.py:2279, in PySRRegressor.fit(self, X, y, Xresampled, weights, variable_names, complexity_of_variables, X_units, y_units, category)
2276 self._checkpoint()
2278 # Perform the search:
-> 2279 self._run(X, y, runtime_params, weights=weights, seed=seed, category=category)
2281 # Then, after fit, we save again, so the pickle file contains
2282 # the equations:
2283 if not self.temp_equation_file:
File c:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\site-packages\pysr\sr.py:1889, in PySRRegressor.run(self, X, y, runtime_params, weights, category, seed)
1886 if isinstance(complexity_of_variables, list):
1887 complexity_of_variables = jl_array(complexity_of_variables)
...
@ PythonCall.JlWrap C:\Users\Administrator.julia\packages\PythonCall\Nr75f\src\JlWrap\module.jl:13
[5] pyjl_callmethod(f::Any, self::Ptr{PythonCall.C.PyObject}, args::Ptr{PythonCall.C.PyObject}, nargs::Int64)
@ PythonCall.JlWrap C:\Users\Administrator.julia\packages\PythonCall\Nr75f\src\JlWrap\base.jl:67
[6] _pyjl_callmethod(o::Ptr{PythonCall.C.PyObject}, args::Ptr{PythonCall.C.PyObject})
@ PythonCall.JlWrap.Cjl C:\Users\Administrator.julia\packages\PythonCall\Nr75f\src\JlWrap\C.jl:63
.
.
.
.
Environment:
-Python version: 3.12.6
-julia version: 1.11.2
-pysr version: 1.3.1
-juliacall version: 0.9.23
-Operating System: [Windows 11 64-bit]
.
.
.
julia> Base.versioninfo()
ERROR: UndefVarError: versioninfo not defined in Base
Suggestion: check for spelling errors or missing imports.
Stacktrace:
[1] getproperty(x::Module, f::Symbol)
@ Base .\Base.jl:42
[2] top-level scope
@ REPL[1]:1
.
.
.
julia> Pkg.status()
ERROR: UndefVarError: Pkg not defined in Main
Suggestion: check for spelling errors or missing imports.
Stacktrace:
[1] top-level scope
@ REPL[2]:1
.
.
.
julia> versioninfo()
Julia Version 1.11.2
Commit 5e9a32e7af (2024-12-01 20:02 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 16 × AMD Ryzen 7 4800H with Radeon Graphics
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, znver2)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)
Environment:
JULIA_PATH = "D:\Backup\Downloads\julia-1.11.2-win64.exe"
.
.
.
Additional Information: I have verified that the JULIA_PATH environment variable is set correctly and that Julia is accessible from the command line. The issue seems to be specific to the compatibility of the PythonCall package with Python 3.12.6.
- Lenguaje dominante
- Julia
- Estrellas
- 1.1k
- Forks
- 89
- Merge medio
- 2 d 15 h
- PR fusionados (30 d)
- 7
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de JuliaPy/PythonCall.jl
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
JuliaPy/PythonCall.jl#828 · 7 comentarios ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
JuliaPy/PythonCall.jl#809 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Locking julia dependenciesAbiertoenhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
JuliaPy/PythonCall.jl#805 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
JuliaPy/PythonCall.jl#796 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
JuliaPy/PythonCall.jl#790 ·
Los mantenedores suelen responder en 1 día
Todos los issues de JuliaPy/PythonCall.jl
Issues similares
-
Chains resumed from `initial_state` take `num_warmup + 1` warm-up stepsPosiblemente ocupada @thevolatilebit la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
TuringLang/AbstractMCMC.jl#220 ·
-
found-by-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
exanauts/SparseDirectSolver.jl#92 ·
Los mantenedores suelen responder en 1 día
-
`inv` of a dense matrix fails for arrays whose `parent` is not an array of the same kindPosiblemente ocupada @devmotion la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
JuliaLang/LinearAlgebra.jl#1740 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
NumericalEarth/Breeze.jl#1051 ·
Los mantenedores suelen responder en 1 día