Skip to content

Commit

Permalink
fix(retropath2_wrapper): prevent use of CONDA_PREFIX env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-gricourt committed Dec 1, 2022
1 parent 13cdf67 commit 471442a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ python -m pytest tests

## Known issues

### Could not load native RDKit library
Some Knime versions (like: 4.3.0) can't load RDKit library.
You need to append to the `$CONDA_PREFIX/lib` path to the `LD_LIBRARY_PATH` variable where the `libfreetype` library is available:
1. Could not load native RDKit library, libfreetype.so.6: cannot open shared object file
Some Knime versions (like: 4.3.0) or environments can't load RDKit library.
You need to append the `$CONDA_PREFIX/lib` path to the `LD_LIBRARY_PATH` variable where the `libfreetype` library is available:
```sh
conda activate <env_name>
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$CONDA_PREFIX/lib"
Expand Down
17 changes: 17 additions & 0 deletions retropath2_wrapper/RetroPath2.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,24 @@ def call_knime(

try:
printout = open(devnull, 'wb') if logger.level > 10 else None
# Hack to link libGraphMolWrap.so (RDKit) against libfreetype.so.6 (from conda)
is_ld_path_modified = False
if "CONDA_PREFIX" in os_environ.keys():
os_environ['LD_LIBRARY_PATH'] = os_environ.get(
'LD_LIBRARY_PATH',
''
) + ':' + os_path.join(
os_environ['CONDA_PREFIX'],
"lib"
)
is_ld_path_modified = True

returncode = subprocess_call(cmd=" ".join(args), logger=logger)
if is_ld_path_modified:
os_environ['LD_LIBRARY_PATH'] = ':'.join(
os_environ['LD_LIBRARY_PATH'].split(':')[:-1]
)

StreamHandler.terminator = "\n"
logger.info(' {bold}OK{reset}'.format(bold=attr('bold'), reset=attr('reset')))
return returncode
Expand Down

0 comments on commit 471442a

Please sign in to comment.