Error message report

I am encountering a program crash with the following error message:

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ffd31cebf5e – DllCanUnloadNow at C:\Users\zhouz\anaconda3\envs\causaldis\DLLs_ctypes.pyd (unknown line)
in expression starting at none:0
DllCanUnloadNow at C:\Users\zhouz\anaconda3\envs\causaldis\DLLs_ctypes.pyd (unknown line)
unknown function (ip: 00007ffd31ce6f11)
PyObject_MakeTpCall at C:\Users\zhouz\anaconda3\envs\causaldis\python312.dll (unknown line)
PyObject_Vectorcall at C:\Users\zhouz\anaconda3\envs\causaldis\python312.dll (unknown line)
PyEval_EvalFrameDefault at C:\Users\zhouz\anaconda3\envs\causaldis\python312.dll (unknown line)
PyEval_EvalCode at C:\Users\zhouz\anaconda3\envs\causaldis\python312.dll (unknown line)
PyRun_FileExFlags at C:\Users\zhouz\anaconda3\envs\causaldis\python312.dll (unknown line)
PyRun_FileExFlags at C:\Users\zhouz\anaconda3\envs\causaldis\python312.dll (unknown line)
PyRun_StringFlags at C:\Users\zhouz\anaconda3\envs\causaldis\python312.dll (unknown line)
PyRun_SimpleFileObject at C:\Users\zhouz\anaconda3\envs\causaldis\python312.dll (unknown line)
PyRun_AnyFileObject at C:\Users\zhouz\anaconda3\envs\causaldis\python312.dll (unknown line)
Py_gitidentifier at C:\Users\zhouz\anaconda3\envs\causaldis\python312.dll (unknown line)
Py_gitidentifier at C:\Users\zhouz\anaconda3\envs\causaldis\python312.dll (unknown line)
Py_RunMain at C:\Users\zhouz\anaconda3\envs\causaldis\python312.dll (unknown line)
Py_Main at C:\Users\zhouz\anaconda3\envs\causaldis\python312.dll (unknown line)
OPENSSL_Applink at C:\Users\zhouz\anaconda3\envs\causaldis\python.exe (unknown line)
BaseThreadInitThunk at C:\Windows\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\Windows\SYSTEM32\ntdll.dll (unknown line)
Allocations: 408549740 (Pool: 408545602; Big: 4138); GC: 584

Process finished with exit code 1

Is there any idea how to fix this problem?

1 Like

Welcome to the community!

What is the output of

versioninfo()

What is the output of:

using Pkg
Pkg.status()

?

Hi!
The output of versioninfo() is:

julia> versioninfo()
Julia Version 1.10.1
Commit 7790d6f064 (2024-02-13 20:41 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 12 × 11th Gen Intel(R) Core(TM) i5-11600K @ 3.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, rocketlake)
Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)

The output of Pkg.status() is:

julia> Pkg.status()
Status `C:\Users\zhouz\.julia\environments\v1.10\Project.toml`
  [8f5d6c58] EzXML v1.2.0      
  [aa1b3936] GraphIO v0.7.0    
  [a2cc645c] GraphPlot v0.5.2  
  [86223c79] Graphs v1.9.0     
  [093fc24a] LightGraphs v1.3.5
  [70f5e60a] LinkedLists v0.1.1
  [91a5bcdd] Plots v1.40.1     
  [438e738f] PyCall v1.96.4    
  [72c71f33] XML v0.3.2   
1 Like

Apart from some precompilation warnings I could add these packages to a new project on Linux, so the packages are nor broken.

You are using PyCall, which might use your local Python installation (outside of Julia), which could cause issues.

To do a fresh Python installation specific for Julia, please try:

ENV["PYTHON"]=""
Pkg.build("PyCall")

restart Julia, and try:

using PyPlot

Does that work?

I am calling Julia functions from Python using Pyjulia. After doing the code you mentioned, I could not launch Julia from Python with this error:

Traceback (most recent call last):
  File "C:\Users\zhouz\Purdue\CausalML\proj\Sample Efficient\RootPicking.py", line 8, in <module>
    from julia import Main
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 921, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 813, in module_from_spec
  File "C:\Users\zhouz\anaconda3\envs\causaldis\Lib\site-packages\julia\core.py", line 253, in create_module
    JuliaMainModule(self, fullname))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\zhouz\anaconda3\envs\causaldis\Lib\site-packages\julia\core.py", line 151, in __init__
    self._julia = loader.julia
                  ^^^^^^^^^^^^
  File "C:\Users\zhouz\anaconda3\envs\causaldis\Lib\site-packages\julia\core.py", line 242, in julia
    self.__class__.julia = julia = Julia()
                                   ^^^^^^^
  File "C:\Users\zhouz\anaconda3\envs\causaldis\Lib\site-packages\julia\core.py", line 495, 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:
    C:\Users\zhouz\.julia\conda\3\x86_64\python.exe
    C:\Users\zhouz\.julia\conda\3\x86_64\python310.dll
Python interpreter used to import PyJulia and its libpython.
    C:\Users\zhouz\anaconda3\envs\causaldis\python.exe
    C:\Users\zhouz\anaconda3\envs\causaldis\python312.dll

In Julia >= 0.7, above two paths to `libpython` have to match exactly
in order for PyJulia to work out-of-the-box.  To configure PyCall.jl to use
Python interpreter "C:\Users\zhouz\anaconda3\envs\causaldis\python.exe",
run the following code in the Python REPL:

    >>> import julia
    >>> julia.install()

For more information, see:

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


Process finished with exit code 1

It is not really clear to me what you actually want to do.

  • do you want to use Python from Julia, e.g. by using PyPlot?
  • do you want to use Julia from Python?
  • do you want to use both?

Doing one of these things should be easy, doing both is not easy… You then need either two different Python environments, or you need to use only packages for both scenarios that are compatible…

Can you explain in more detail what you actually want to do, and which Python packages and which Python environment(s) you want to use?

I just want to call Julia functions from Python by using Pyjulia. The Julia repo I am using is: CliquePicking/aaai_experiments at master · mwien/CliquePicking · GitHub. I am using conda for Python, the result of conda list is:

(causaldis) C:\Users\zhouz>conda list
# packages in environment at C:\Users\zhouz\anaconda3\envs\causaldis:
#
# Name                    Version                   Build  Channel
bzip2                     1.0.8                he774522_0
ca-certificates           2023.12.12           haa95532_0
colorama                  0.4.6                    pypi_0    pypi
contourpy                 1.2.0                    pypi_0    pypi
cycler                    0.12.1                   pypi_0    pypi
einops                    0.7.0                    pypi_0    pypi
expat                     2.5.0                hd77b12b_0
filelock                  3.13.1                   pypi_0    pypi
fonttools                 4.48.1                   pypi_0    pypi
fsspec                    2024.2.0                 pypi_0    pypi
graphical-models          0.1a19                   pypi_0    pypi
jinja2                    3.1.3                    pypi_0    pypi
joblib                    1.3.2                    pypi_0    pypi
julia                     0.6.2                    pypi_0    pypi
kiwisolver                1.4.5                    pypi_0    pypi
libffi                    3.4.4                hd77b12b_0
markupsafe                2.1.5                    pypi_0    pypi
matplotlib                3.8.2                    pypi_0    pypi
mpmath                    1.3.0                    pypi_0    pypi
networkx                  3.2.1                    pypi_0    pypi
numpy                     1.26.4                   pypi_0    pypi
openssl                   3.0.13               h2bbff1b_0
opt-einsum                3.3.0                    pypi_0    pypi
packaging                 23.2                     pypi_0    pypi
pandas                    2.2.0                    pypi_0    pypi
patsy                     0.5.6                    pypi_0    pypi
pgmpy                     0.1.24                   pypi_0    pypi
pillow                    10.2.0                   pypi_0    pypi
pip                       23.3.1          py312haa95532_0
pyagrum                   1.12.1                   pypi_0    pypi
pydot                     2.0.0                    pypi_0    pypi
pyparsing                 3.1.1                    pypi_0    pypi
python                    3.12.1               h1d929f7_0
python-dateutil           2.8.2                    pypi_0    pypi
pytz                      2024.1                   pypi_0    pypi
scikit-learn              1.4.0                    pypi_0    pypi
scipy                     1.12.0                   pypi_0    pypi
setuptools                68.2.2          py312haa95532_0
six                       1.16.0                   pypi_0    pypi
sqlite                    3.41.2               h2bbff1b_0
statsmodels               0.14.1                   pypi_0    pypi
sympy                     1.12                     pypi_0    pypi
threadpoolctl             3.2.0                    pypi_0    pypi
tk                        8.6.12               h2bbff1b_0
torch                     2.2.0                    pypi_0    pypi
tqdm                      4.66.2                   pypi_0    pypi
typing-extensions         4.9.0                    pypi_0    pypi
tzdata                    2024.1                   pypi_0    pypi
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
wheel                     0.41.2          py312haa95532_0
xgboost                   2.0.3                    pypi_0    pypi
xz                        5.4.5                h8cc25b3_0
zlib                      1.2.13               h8cc25b3_0

Please read: Is PyJulia org, e.g. juliacall (or pyjulia) Python packages maintained?

In theory you can use either PyJulia, or juliacall for this purpose. PyJulia is the old way of doing it (and might break easily), and juliacall the new way of doing it, but I never used any of these two packages, so I cannot give any advice on this topic.

You can undo this:

ENV["PYTHON"]=""
Pkg.build("PyCall")

by restarting Julia and running:

Pkg.build("PyCall")

But if that helps you to fix your current problem, I don’t know. I never used Julia from Python, only the other way round…

From the conda environment you sent me it seems you have a mix of packages from pypi and conda.

You might try building the environment completely from conda-forge components. Specify -c conda-forge when creating a new environment.

I recommend going with juliacall rather than pyjulia.

I will try to use juliacall instead, thank you for your help.

I am using juliacall instead now. Seems like this fixes the problem.

1 Like