Problem using SymPy

Hi everybody, I am new to Julia and I would like to use the sympy functionalities.
I have Julia 1.8 installed on Mac OS, with python 3.
The SymPy package throws the error below.
Any clue?
Thanks
Joe

julia> using SymPy

ERROR: InitError: KeyError: key :pi not found

Stacktrace:

[1] __getproperty

@ ~/.julia/packages/PyCall/twYvK/src/PyCall.jl:313 [inlined]

[2] getproperty(o::PyCall.PyObject, s::Symbol)

@ PyCall ~/.julia/packages/PyCall/twYvK/src/PyCall.jl:318

[3] init()

@ SymPy ~/.julia/packages/SymPy/gkr7m/src/SymPy.jl:131

[4] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})

@ Base ./loading.jl:831

[5] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt64)

@ Base ./loading.jl:1039

[6] _require(pkg::Base.PkgId)

@ Base ./loading.jl:1315

[7] _require_prelocked(uuidkey::Base.PkgId)

@ Base ./loading.jl:1200

[8] macro expansion

@ ./loading.jl:1180 [inlined]

[9] macro expansion

@ ./lock.jl:223 [inlined]

[10] require(into::Module, mod::Symbol)

@ Base ./loading.jl:1144

during initialization of module SymPy

Does something like this work?

julia> using PyCall

julia> sympy = PyCall.pyimport_conda("sympy", "sympy")
PyObject <module 'sympy' from '/Users/verzani/.julia/conda/3/lib/python3.7/site-packages/sympy/__init__.py'>

julia> sympy.pi
PyObject pi

Hi, thanks for your reply. Unfortunately, it does not work:

**julia>** using PyCall

**julia>** sympy = PyCall.pyimport_conda("sympy", "sympy")

PyObject <module 'sympy' (<_frozen_importlib_external._NamespaceLoader object at 0x136533970>)>

**julia>** sympy.pi

**ERROR:** KeyError: key :pi not found

Stacktrace:

[1] **__getproperty**

@ ~/.julia/packages/PyCall/twYvK/src/PyCall.jl:313 [inlined]

[2] **getproperty(**o::PyObject, s::Symbol**)**

@ PyCall ~/.julia/packages/PyCall/twYvK/src/PyCall.jl:318

[3] top-level scope

@ REPL[3]:1

**julia>**

Edt: could it possibly be a clash between homebrew python and conda python?

anything is possible!

Hi, I upgraded my installation to 1.9. I also removed the brew installation of python and left only conda in my system. Conda and brew are know to be not working well together. Now Pycall works.

julia> using PyCall
julia> sympy = PyCall.pyimport_conda("sympy", "sympy")
PyObject <module 'sympy' from '/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/sympy/__init__.py'>
julia> sympy.pi
PyObject pi

The SymPy package also works flawlessly:

julia> using SymPy

julia> x = symbols("x")
x

julia> y = sin(pi*x)
sin(π⋅x)

julia> y(1)   
0

I think it was a conda+brew problem, a problem that users should be warned about.