title: Library (dylib) not loaded - image not found - Python IDE
body: <p>Basically I'm trying to run some Python code from savReaderWriter module in order to create a .sav file ready to open in IBM SPSS. As a macOS user I needed to run these two lines in the terminal first for the module to work:</p>
  
  <pre><code>echo 'export DYLD_LIBRARY_PATH=/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/savReaderWriter/spssio/macos'  &gt;&gt; ~/.bash_profile
  echo 'export LC_ALL=en_US.UTF-8'  &gt;&gt; ~/.bash_profile
  </code></pre>
  
  <p>Below you can see a piece of code I'm trying to run in Python:</p>
  
  <pre><code>import savReaderWriter
  
  savFileName = "someFile.sav"
  records = [['Test1', 1, 1], ['Test2', 2, 1]]
  varNames = ['var1', 'v2', 'v3']
  varTypes = {'var1': 5, 'v2': 0, 'v3': 0}
  with savReaderWriter.SavWriter(savFileName, varNames, varTypes, ioUtf8=True) as writer:
      for record in records:
          writer.writerow(record)
  </code></pre>
  
  <p>My problem is that while running the code in Python through terminal.app works like a charm and a new .sav file appears, trying to execute the very same code in an IDE (tried PyCharm and Spyder) gives me an error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2847, in run_code
      exec(code_obj, self.user_global_ns, self.user_ns)
    File "&lt;ipython-input-2-94007b092d47&gt;", line 7, in &lt;module&gt;
      with savReaderWriter.SavWriter(savFileName, varNames, varTypes, ioUtf8=True) as writer:
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/savReaderWriter/savWriter.py", line 198, in __init__
      super(Header, self).__init__(savFileName, ioUtf8, ioLocale)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/savReaderWriter/generic.py", line 29, in __init__
      self.spssio = self.loadLibrary()
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/savReaderWriter/generic.py", line 117, in loadLibrary
      spssio = self._loadLibs("macos")
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/savReaderWriter/generic.py", line 89, in _loadLibs
      return [load(os.path.join(path, lib)) for lib in libs][-1]
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/savReaderWriter/generic.py", line 89, in &lt;listcomp&gt;
      return [load(os.path.join(path, lib)) for lib in libs][-1]
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ctypes/__init__.py", line 348, in __init__
      self._handle = _dlopen(self._name, mode)
  OSError: dlopen(/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/savReaderWriter/spssio/macos/libicuuc48.1.dylib, 6): Library not loaded: @executable_path/../lib/libicudata48.1.dylib
    Referenced from: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/savReaderWriter/spssio/macos/libicuuc48.1.dylib
    Reason: image not found
  </code></pre>
  
  <p>The module author was unable to help me on this matter, therefore I would be very glad for any suggestions from this community.</p>
  
  <p>EDIT (added sys.path):</p>
  
  <p>From terminal:</p>
  
  <pre><code> ['',
   '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip',
   '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6',
   '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload',
   '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages',
   '/Users/mg/mne-python']
  </code></pre>
  
  <p>From IDE:</p>
  
  <pre><code>['/Applications/PyCharm.app/Contents/helpers/pydev',
   '/Users/mg/Documents/Python/Projects/MD',
   '/Applications/PyCharm.app/Contents/helpers/pydev',
   '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip',
   '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6',
   '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload',
   '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages',
   '/Users/mg/mne-python',
   '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/IPython/extensions',
   '/Users/mg/Documents/Python/Projects/MD']
  </code></pre>
  
  <p>Regards,</p>
  
  <p>MG</p>