Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error due to libpython issuses #505

Open
JuanKo96 opened this issue Sep 1, 2022 · 1 comment
Open

Error due to libpython issuses #505

JuanKo96 opened this issue Sep 1, 2022 · 1 comment

Comments

@JuanKo96
Copy link

JuanKo96 commented Sep 1, 2022

Hi, this might be an overlapping issue from previous ones but since I couldn't find a way to solve it, I'm leaving it here.

When I'm trying to import Base, it shows the issue below. I am trying to use another python-julia package diffeqpy and I can not use it also because of this issue.

I tried the "workaround" suggested on the page and seemed nothing really helped much.

Any kind of comments would be very helpful.

>>> from julia import Base
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "/Users/juanko/miniconda3/envs/node/lib/python3.9/site-packages/julia/core.py", line 248, in load_module
    elif self.julia.isafunction(juliapath):
  File "/Users/juanko/miniconda3/envs/node/lib/python3.9/site-packages/julia/core.py", line 239, in julia
    self.__class__.julia = julia = Julia()
  File "/Users/juanko/miniconda3/envs/node/lib/python3.9/site-packages/julia/core.py", line 483, in __init__
    raise UnsupportedPythonError(jlinfo)
julia.core.UnsupportedPythonError: It seems your Julia and PyJulia setup are not supported.

Julia executable:
    julia
Python interpreter and libpython used by PyCall.jl:
    /Users/juanko/miniconda3/envs/node/bin/python3
    /Users/juanko/miniconda3/envs/node/lib/libpython3.9.dylib
Python interpreter used to import PyJulia and its libpython.
    /Users/juanko/miniconda3/envs/node/bin/python3
    /Users/juanko/miniconda3/envs/node/lib/libpython3.9.dylib

Your Python interpreter "/Users/juanko/miniconda3/envs/node/bin/python3"
is statically linked to libpython.  Currently, PyJulia does not fully
support such Python interpreter.

The easiest workaround is to pass `compiled_modules=False` to `Julia`
constructor.  To do so, first *reboot* your Python REPL (if this happened
inside an interactive session) and then evaluate:

    >>> from julia.api import Julia
    >>> jl = Julia(compiled_modules=False)

Another workaround is to run your Python script with `python-jl`
command bundled in PyJulia.  You can simply do:

    $ python-jl PATH/TO/YOUR/SCRIPT.py

See `python-jl --help` for more information.

For more information, see:

    https://pyjulia.readthedocs.io/en/latest/troubleshooting.html

Thanks

@mkitti
Copy link
Member

mkitti commented Sep 7, 2022

What is the output after you restart the REPL and run the following in a fresh Python REPL?

from julia.api import Julia
jl = Julia(compiled_modules=False)
from julia import Base

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants