# Cannot access file in python "unsafe use of relative rpath"

**URL:** <https://root-forum.cern.ch/t/cannot-access-file-in-python-unsafe-use-of-relative-rpath/26565>\
**Category:** ROOT\
**Created:** [October 13, 2017, 7:32am UTC](https://root-forum.cern.ch/t/cannot-access-file-in-python-unsafe-use-of-relative-rpath/26565 "2017-10-13T07:32:32Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![mwilkins](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mwilkins/32/28332_2.png) [@mwilkins](https://root-forum.cern.ch/u/mwilkins)\
**Post date:** [October 17, 2017, 11:33am UTC](https://root-forum.cern.ch/t/cannot-access-file-in-python-unsafe-use-of-relative-rpath/26565/16 "2017-10-17T11:33:16Z")

</div>

Okay so I found on [this thread](https://root-forum.cern.ch/t/trouble-importing-pyroot-on-osx-10-9-mavericks/17287) that python quitting is due to conflicting python versions. The same thread recommends sticking with the system build though.

I think this is a legitimate bug related to Apple’s introduction of [System Integrity Protection](https://support.apple.com/en-us/HT204899). I was able to fix it using install\_name\_tool. Unfortunately, there were several such links so it needed to be done multiple times; there’s a suggestion [here](https://stackoverflow.com/questions/31343299/mysql-improperly-configured-reason-unsafe-use-of-relative-path) for doing it automatically, but I just did it manually:

```bash
$ install_name_tool -change libXrdUtils.2.dylib /Applications/root_build/lib/libXrdUtils.2.dylib /Applications/root_build/lib/libNetxNG.so
$ python
Python 2.7.10 (default, Jul 15 2017, 17:16:57) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ROOT import TFile
>>> f = TFile.Open("root://eoslhcb.cern.ch//eos/lhcb/user/m/mwilkins/bfractions_fromGanga/data/Down16/548.100/DVnTuples.root")
cling::DynamicLibraryManager::loadLibrary(): dlopen(/Applications/root_build/lib/libNetxNG.so, 9): Library not loaded: libXrdCl.2.dylib
  Referenced from: /Applications/root_build/lib/libNetxNG.so
  Reason: unsafe use of relative rpath libXrdCl.2.dylib in /Applications/root_build/lib/libNetxNG.so with restricted binary
Error in <TInterpreter::TCling::AutoLoad>: failure loading library libNetxNG.so for TNetXNGSystem
cling::DynamicLibraryManager::loadLibrary(): dlopen(/Applications/root_build/lib/libNetxNG.so, 9): Library not loaded: libXrdCl.2.dylib
  Referenced from: /Applications/root_build/lib/libNetxNG.so
  Reason: unsafe use of relative rpath libXrdCl.2.dylib in /Applications/root_build/lib/libNetxNG.so with restricted binary
cling::DynamicLibraryManager::loadLibrary(): dlopen(/Applications/root_build/lib/libNetxNG.so, 9): Library not loaded: libXrdCl.2.dylib
  Referenced from: /Applications/root_build/lib/libNetxNG.so
  Reason: unsafe use of relative rpath libXrdCl.2.dylib in /Applications/root_build/lib/libNetxNG.so with restricted binary
Error in <TInterpreter::TCling::AutoLoad>: failure loading library libNetxNG.so for TNetXNGFile
cling::DynamicLibraryManager::loadLibrary(): dlopen(/Applications/root_build/lib/libNetxNG.so, 9): Library not loaded: libXrdCl.2.dylib
  Referenced from: /Applications/root_build/lib/libNetxNG.so
  Reason: unsafe use of relative rpath libXrdCl.2.dylib in /Applications/root_build/lib/libNetxNG.so with restricted binary
>>> ^D
$ install_name_tool -change libXrdCl.2.dylib /Applications/root_build/lib/libXrdCl.2.dylib /Applications/root_build/lib/libNetxNG.so
$ python
Python 2.7.10 (default, Jul 15 2017, 17:16:57) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ROOT import TFile ; f = TFile.Open("root://eoslhcb.cern.ch//eos/lhcb/user/m/mwilkins/bfractions_fromGanga/data/Down16/548.100/DVnTuples.root")
cling::DynamicLibraryManager::loadLibrary(): dlopen(/Applications/root_build/lib/libNetxNG.so, 9): Library not loaded: libXrdXml.2.dylib
  Referenced from: /Applications/root_build/lib/libXrdCl.2.dylib
  Reason: unsafe use of relative rpath libXrdXml.2.dylib in /Applications/root_build/lib/libXrdCl.2.dylib with restricted binary
Error in <TInterpreter::TCling::AutoLoad>: failure loading library libNetxNG.so for TNetXNGSystem
cling::DynamicLibraryManager::loadLibrary(): dlopen(/Applications/root_build/lib/libNetxNG.so, 9): Library not loaded: libXrdXml.2.dylib
  Referenced from: /Applications/root_build/lib/libXrdCl.2.dylib
  Reason: unsafe use of relative rpath libXrdXml.2.dylib in /Applications/root_build/lib/libXrdCl.2.dylib with restricted binary
cling::DynamicLibraryManager::loadLibrary(): dlopen(/Applications/root_build/lib/libNetxNG.so, 9): Library not loaded: libXrdXml.2.dylib
  Referenced from: /Applications/root_build/lib/libXrdCl.2.dylib
  Reason: unsafe use of relative rpath libXrdXml.2.dylib in /Applications/root_build/lib/libXrdCl.2.dylib with restricted binary
Error in <TInterpreter::TCling::AutoLoad>: failure loading library libNetxNG.so for TNetXNGFile
cling::DynamicLibraryManager::loadLibrary(): dlopen(/Applications/root_build/lib/libNetxNG.so, 9): Library not loaded: libXrdXml.2.dylib
  Referenced from: /Applications/root_build/lib/libXrdCl.2.dylib
  Reason: unsafe use of relative rpath libXrdXml.2.dylib in /Applications/root_build/lib/libXrdCl.2.dylib with restricted binary
>>> ^D
$ install_name_tool -change libXrdXml.2.dylib /Applications/root_build/lib/libXrdXml.2.dylib /Applications/root_build/lib/libXrdCl.2.dylib
...

```

etc.

Now I’ve got a new problem:

```python
$ python
Python 2.7.10 (default, Jul 15 2017, 17:16:57) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ROOT import TFile
>>> f = TFile.Open("root://eoslhcb.cern.ch//eos/lhcb/user/m/mwilkins/bfractions_fromGanga/data/Down16/548.100/DVnTuples.root")
Error in <TNetXNGFile::Open>: [FATAL] Auth failed

```

But it seems unrelated to the original problem in this post, so I will simply start a [new thread](https://root-forum.cern.ch/t/pyroot-cannot-open-file-error-in-tnetxngfile-open-fatal-auth-failed/26593). Thanks much for taking the time to help, everyone.

By the way, there are WAY too many problems trying to get this installation up and running. I almost regret even trying.

---

_[View the full topic](https://root-forum.cern.ch/t/cannot-access-file-in-python-unsafe-use-of-relative-rpath/26565)._
