From 69c094014c9838cd001578676a0965bb4b315a3b Mon Sep 17 00:00:00 2001 From: Daniel Ingraham Date: Fri, 10 Feb 2023 20:53:13 -0500 Subject: [PATCH] Add docs for issue #255 --- docs/src/faq.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/src/faq.md b/docs/src/faq.md index 59e377c9..3d08da37 100644 --- a/docs/src/faq.md +++ b/docs/src/faq.md @@ -11,3 +11,27 @@ Python(65251,0x104cf8580) malloc: *** set a breakpoint in malloc_error_break to ``` A solution is to ensure that `juliacall` is imported before `torch`. + +## `ccall requries the compiler` error when importing some Python libraries +On some systems, you may see an error like the following when import e.g. `matplotlib` before `juliacall`: + +``` +ERROR: `ccall` requires the compilerTraceback (most recent call last): + File "/home/dingraha/projects/pythoncall_import_error/run.py", line 2, in + from foo import Foo + File "/home/dingraha/projects/pythoncall_import_error/foo.py", line 4, in + import juliacall; jl = juliacall.newmodule("FooModule") + File "/home/dingraha/projects/pythoncall_import_error/venv/lib/python3.9/site-packages/juliacall/__init__.py", line 218, in + init() + File "/home/dingraha/projects/pythoncall_import_error/venv/lib/python3.9/site-packages/juliacall/__init__.py", line 214, in init + raise Exception('PythonCall.jl did not start properly') +Exception: PythonCall.jl did not start properly +``` + +As described in [issue 255](https://github.com/cjdoris/PythonCall.jl/issues/255), the likely problem is that the "other" Python library (`matplotlib`, whatever) is loading the system `libstdc++.so`, which isn't compatible with the `libstdc++.so` that Julia ships with. +Linux distributions with older `libstdc++` versions seem more likely to suffer from this issue. +The solution is to either: + + * use a Linux distribution with a more recent `libstdc++` + * import `juliacall` before the other Python library, so that Julia's `libstdc++` is loaded + * use a Python from a conda environment, which will have a newer `libstdc++` that is compatible with Julia's