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

segfault importing PyCall after importing Julia package with python dependencies / PythonCall.jl #220

Closed
RoyCCWang opened this issue Sep 12, 2022 · 2 comments

Comments

@RoyCCWang
Copy link

RoyCCWang commented Sep 12, 2022

Hi, thanks for developing this package.

Here is my versioninfo():

Julia Version 1.8.1
Commit afb6c60d69a (2022-09-06 15:09 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 16 × AMD Ryzen 7 1700 Eight-Core Processor
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, znver1)
Threads: 1 on 16 virtual cores
I'm using the official generic Linux binaries on Fedora 36.

The Julia package involved is NMRLoadExperiment.jl

It is a minimal wrapper example for my work that uses PythonCall.jl to manage Python dependencies. NMRLoadExperiment.jl uses the nmrglue Python library, which I included in the CondaPkg.toml file in the repo page.

NMRLoadExperiment.jl on its own works as intended in Julia. I have issues when I load NMRLoadExperiment.jl then anything that uses PyCall.jl. For example, from a clean install of Julia, I did the following since I'm used to using Conda.jl to manage my Python tools:

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

Pkg.add(url="https://github.com/AI4DBiological-Systems/NMRLoadExperiment.jl")

If I then do:

import NMRLoadExperiment
import PyCall

or

import PyCall
import NMRLoadExperiment

it would segfault after the second import. Please let me know if you can reproduce this, need the full error report, or if I have done something incorrectly at NMRLoadExperiment.jl

I purposely made it so that NMRLoadExperiment.jl has a more self-contained Python dependency via PythonCall.jl, even though I use Conda.jl with PyCall.jl for development. This is because NMRLoadExperiment.jl is intended for release for public use eventually.

@cjdoris
Copy link
Collaborator

cjdoris commented Sep 14, 2022

On most platforms, you can only use PyCall and PythonCall in the same session if they are using the same Python installation.

See here for your options: https://cjdoris.github.io/PythonCall.jl/stable/pycall/#Tips

@RoyCCWang
Copy link
Author

Thanks for the clarification!

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