You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-3Lines changed: 2 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,9 +40,8 @@ In this example we use the Python module JuliaCall from an IPython notebook to t
40
40
41
41
## What about PyCall?
42
42
43
-
The existing package [PyCall](https://github.com/JuliaPy/PyCall.jl) is another similar interface to Python. Here we note some key differences, but a more detailed comparison is in the documentation.
43
+
The existing package [PyCall](https://github.com/JuliaPy/PyCall.jl) is another similar interface to Python. Here we note some key differences:.
44
44
- PythonCall supports a wider range of conversions between Julia and Python, and the conversion mechanism is extensible.
45
45
- PythonCall by default never copies mutable objects when converting, but instead directly wraps the mutable object. This means that modifying the converted object modifies the original, and conversion is faster.
46
46
- PythonCall does not usually automatically convert results to Julia values, but leaves them as Python objects. This makes it easier to do Pythonic things with these objects (e.g. accessing methods) and is type-stable.
47
-
- PythonCall installs dependencies into a separate Conda environment for each Julia project. This means each Julia project can have an isolated set of Python dependencies.
48
-
- PythonCall supports Julia 1.6.1+ and Python 3.8+ whereas PyCall supports Julia 0.7+ and Python 2.7+.
47
+
- PythonCall installs dependencies into a separate Conda environment for each Julia project using [CondaPkg](https://github.com/JuliaPy/CondaPkg.jl). This means each Julia project can have an isolated set of Python dependencies.
Copy file name to clipboardExpand all lines: docs/src/faq.md
+20-15Lines changed: 20 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,27 @@
1
1
# FAQ & Troubleshooting
2
2
3
+
## Can I use PythonCall and PyCall together?
4
+
5
+
Yes, you can use both PyCall and PythonCall in the same Julia session. This is platform-dependent:
6
+
- On most systems the Python interpreter used by PythonCall and PyCall must be the same (see below).
7
+
- On Windows it appears to be possible for PythonCall and PyCall to use different interpreters.
8
+
9
+
To force PythonCall to use the same Python interpreter as PyCall, set the environment variable [`JULIA_PYTHONCALL_EXE`](@ref pythoncall-config) to `"@PyCall"`. Note that this will opt out of automatic dependency management using CondaPkg.
10
+
11
+
Alternatively, to force PyCall to use the same interpreter as PythonCall, set the environment variable `PYTHON` to [`PythonCall.python_executable_path()`](@ref) and then `Pkg.build("PyCall")`. You will need to do this each time you change project, because PythonCall by default uses a different Python for each project.
12
+
3
13
## Is PythonCall/JuliaCall thread safe?
4
14
5
-
No.
6
-
7
-
Some rules if you are writing multithreaded code:
8
-
- Only call Python functions from the first thread.
9
-
- You probably also need to call `PythonCall.GC.disable()` on the main thread before any
10
-
threaded block of code. Remember to call `PythonCall.GC.enable()` again afterwards.
11
-
(This is because Julia finalizers can be called from any thread.)
12
-
- Julia intentionally causes segmentation faults as part of the GC safepoint mechanism.
13
-
If unhandled, these segfaults will result in termination of the process. To enable signal handling,
14
-
set `PYTHON_JULIACALL_HANDLE_SIGNALS=yes` before any calls to import juliacall. This is equivalent
15
-
to starting julia with `julia --handle-signals=yes`, the default behavior in Julia.
16
-
See discussion [here](https://github.com/JuliaPy/PythonCall.jl/issues/219#issuecomment-1605087024) for more information.
17
-
- You may still encounter problems.
18
-
19
-
Related issues: [#201](https://github.com/JuliaPy/PythonCall.jl/issues/201), [#202](https://github.com/JuliaPy/PythonCall.jl/issues/202)
15
+
Yes, as of v0.9.22, provided you handle the GIL correctly. See the guides for
16
+
[PythonCall](@ref jl-multi-threading) and [JuliaCall](@ref py-multi-threading).
17
+
18
+
Before, tricks such as disabling the garbage collector were required. See the
0 commit comments