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

"Python exited unexpectedly" when using external conda environment #85

Closed
charstnut opened this issue Dec 14, 2021 · 6 comments
Closed
Labels
bug Something isn't working priority Should be fixed or implemented soon

Comments

@charstnut
Copy link

charstnut commented Dec 14, 2021

Thank you for this great package!

I've come across this warning after configuring PythonCall to use the PyCall environment. It does not seem to interfere with usage though. When using "Ctrl + D" for exit this results in segmentation fault but still exits.

MWE after starting julia:

julia > ENV["JULIA_PYTHONCALL_EXE"] = "@PyCall"
julia > using PythonCall
julia> exit()
┌ Warning: Python exited unexpectedly
└ @ PythonCall.C ~/.julia/packages/PythonCall/zJpsh/src/cpython/context.jl:179
@cjdoris
Copy link
Collaborator

cjdoris commented Dec 15, 2021

Thanks. The issue is that both PythonCall and PyCall act like they "own" the Python interpreter instance, which is a bug.

I'm rewriting the initialisation part of PythonCall soon so I'll make sure this bug is fixed as part of that.

@cjdoris cjdoris added bug Something isn't working priority Should be fixed or implemented soon labels Dec 15, 2021
@cjdoris
Copy link
Collaborator

cjdoris commented Dec 16, 2021

I believe this is fixed now on the master branch. Can you check please?

@charstnut
Copy link
Author

I checked from the python side and it works without any problem.

(Just a note, it is probably necessary to run Pkg.resolve() inside the julia_env folder in the custom conda environment after reinstalling the python package if the dependencies change.)

For the julia side, it still exits with this warning. I assume updating the package using Pkg.up() would be sufficient?

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.7.0 (2021-11-30)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using PythonCall

julia> exit()
┌ Warning: Python exited unexpectedly
└ @ PythonCall.C ~/.julia/packages/PythonCall/zJpsh/src/cpython/context.jl:179

@cjdoris
Copy link
Collaborator

cjdoris commented Dec 16, 2021

Aha I missed a case, I can make that warning go away. Thanks for checking.

Yeah the resolve thing you mentioned only affects people running the development version.

@cjdoris
Copy link
Collaborator

cjdoris commented Jan 7, 2022

Pretty sure this is correct on main now. Let me know if not.

@cjdoris cjdoris closed this as completed Jan 7, 2022
@charstnut
Copy link
Author

Thanks! Confirmed this is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority Should be fixed or implemented soon
Projects
None yet
Development

No branches or pull requests

2 participants