Closed BeauJSmith closed 2 years ago
Can you give a hint as to your OS and Julia version. The last commit passed tests on the three main OSes.
Mac Mini M1 2020, macOS Monterey 12.2.1 Julia 1.7.2
Hmm, I wonder if the mac has issues with sympy. It may be.
If you don't mind helping me debug this, would the following commands 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.symbols("x")
PyObject x
Here's what happens:
julia> using PyCall
ImportError: No module named site
Hmm, that seem like an internet issue to me. Does
using PythonCall
work? It has, I believe, a different installation method for the underlying python.
I don't think it's an Internet issue. I'm able to download and include other packages, including PythonCall.
Seems like it sits with PyCall. Mu understanding, which may be way out of date, is that the github CI only tests the newer macs with rosetta emulation, and this may be the issue. Then again, it maybe something else. I see this open issue https://github.com/JuliaPy/PyCall.jl/issues/960 which seems to be similar.
Now, if PythonCall works, you can access much of SymPy directly without this package. (The package does have many conveniences thought). Here is a sample:
using PythonCall
] conda add --pip sympy <-- in package mode
# restart julia <-- it seems necessary, may not be
julia> using PythonCall
CondaPkg Found dependencies: /private/tmp/python_call/CondaPkg.toml
CondaPkg Found dependencies: /Users/verzani/.julia/environments/v1.7/CondaPkg.toml
CondaPkg Found dependencies: /Users/verzani/.julia/packages/PythonCall/Z6DIG/CondaPkg.toml
CondaPkg Dependencies already up to date
julia> sympy = pyimport("sympy")
Python module: <module 'sympy' from '/private/tmp/python_call/.CondaPkg/env/lib/python3.10/site-packages/sympy/__init__.py'>
julia> x = sympy.symbols("x")
Python Symbol: x
julia> sympy.solve(x^2 -2, x)
Python list: [-sqrt(2), sqrt(2)]
julia> sympy.integrate(sympy.exp(x) * sympy.sin(x), x)
Python Add: exp(x)*sin(x)/2 - exp(x)*cos(x)/2
This bumps into warts pretty quickly though, as the right promotion rules aren't defined, etc. However, it can get pretty far with the basics.
It worked, and it does exactly what I need it to do.
Thank you so much!
Great, glad to hear.
Hello, All,
SymPy is giving me a bit of grief. Even though I can add the package, I can't seem to run it. When I type "using SymPy," I get the following stacktrace:
What causes this error, and how can I fix it?
Thank you!