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

[BUG] Hard crash due to Mac System Integrity Protection (SIP) Security Protocol Activation #531

Open
ev-watson opened this issue Jul 29, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@ev-watson
Copy link

ev-watson commented Jul 29, 2024

Affects: PythonCall

Describe the bug
Setting the PYTHON_JULIACALL_HANDLE_SIGNALS environment variable manually and then importing juliacall triggers the disk security protocol on MacOS

Meanwhile just importing juliacall works fine

ANY VERSIONS

Reproduce script:

import os

os.environ["PYTHON_JULIACALL_HANDLE_SIGNALS"] = os.environ.get("PYTHON_JULIACALL_HANDLE_SIGNALS", "yes")

import juliacall

For clarity: importing juliacall works fine, but if you set environment variable first, it triggers SIP

Your system
Please provide detailed information about your system:

  • MacOS
  • Any versions

Additional context
First seen at MilesCranmer/PySR#682

@ev-watson ev-watson added the bug Something isn't working label Jul 29, 2024
@MilesCranmer
Copy link
Contributor

@cjdoris wondering if you have any guesses for this one?

@ev-watson could you also provide detailed info about your Python installation, such as how you installed it, and what version number it is? (I think you might have shared this in the other thread, so maybe just copy it over)

@MilesCranmer
Copy link
Contributor

Also, could you try installing juliacall in a fresh environment, and seeing if it still has the crash? Unfortunately I can't find any way to reproduce this so will be relying on your executions here.

@ev-watson
Copy link
Author

ev-watson commented Jul 30, 2024

This project I am doing through PyCharm, i have it make its own virtual environment and so thats how i have it done, it does not use conda, python version 3.9.6, this could be a PyCharm issue, maybe it does not have permissions

Different crash in fresh new python environment not through pycharm, python version 3.12.3, juliacall version 0.9.21
script:

import os

os.environ["PYTHON_JULIACALL_HANDLE_SIGNALS"] = os.environ.get("PYTHON_JULIACALL_HANDLE_SIGNALS", "yes")

import juliacall

command:

python -m trace -t testing.py

Traceback:

 --- modulename: __init__, funcname: __getitem__
__init__.py(397):         func = self._FuncPtr((name_or_ordinal, self))
__init__.py(398):         if not isinstance(name_or_ordinal, int):
__init__.py(399):             func.__name__ = name_or_ordinal
__init__.py(400):         return func
__init__.py(393):         setattr(self, name, func)
__init__.py(394):         return func
__init__.py(186):     jl_parse_opts.argtypes = [c.c_void_p, c.c_void_p]
__init__.py(187):     jl_parse_opts.restype = None
__init__.py(188):     jl_parse_opts(c.pointer(argc), c.pointer(argv))
__init__.py(189):     assert argc.value == 0
__init__.py(192):     try:
__init__.py(193):         jl_init = lib.jl_init_with_image__threading
 --- modulename: __init__, funcname: __getattr__
__init__.py(390):         if name.startswith('__') and name.endswith('__'):
__init__.py(392):         func = self.__getitem__(name)
 --- modulename: __init__, funcname: __getitem__
__init__.py(397):         func = self._FuncPtr((name_or_ordinal, self))
__init__.py(398):         if not isinstance(name_or_ordinal, int):
__init__.py(399):             func.__name__ = name_or_ordinal
__init__.py(400):         return func
__init__.py(393):         setattr(self, name, func)
__init__.py(394):         return func
__init__.py(196):     jl_init.argtypes = [c.c_char_p, c.c_char_p]
__init__.py(197):     jl_init.restype = None
__init__.py(198):     jl_init(
__init__.py(199):         (default_bindir if bindir is None else bindir).encode('utf8'),
__init__.py(200):         None if sysimg is None else sysimg.encode('utf8'),
__init__.py(198):     jl_init(
ERROR: could not load library "libjulia.1.dylib"
dlopen(libjulia.1.dylib, 0x0001): tried: 'libjulia.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibjulia.1.dylib' (no such file), '/Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia.1.dylib' (no such file), '/opt/homebrew/Caskroom/miniforge/base/bin/../lib/libjulia.1.dylib' (no such file), '/usr/lib/libjulia.1.dylib' (no such file, not in dyld cache), 'libjulia.1.dylib' (no such file), '/usr/local/lib/libjulia.1.dylib' (no such file), '/usr/lib/libjulia.1.dylib' (no such file, not in dyld cache)

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

No branches or pull requests

2 participants