Skip to content

Compiled library files are not linked when installing with conda #39

Open

Description

@denbonte

Dear Dan,

Good day, and thanks for your work on maintaining the package!

I installed PascalX in a conda environment following the procedure below:

git clone https://github.com/BergmannLab/PascalX.git
cd PascalX
make all
cd python
python3 setup.py install 

After installing the boost libraries in the conda environment:

conda install boost libboost py-boost

Following a recommendation from a colleague, I updated the first line of the Makefile from:

CC=g++ 

To:

CC=g++ -I path_to_miniconda3_folder/PascalX/includeODIR=build

Where path_to_miniconda3_folder is the location where I created a fresh conda environment, in my case running Python 3.10.16:

conda create --prefix path_to_miniconda3_folder/PascalX python=3.10

Everything seemed to work fine, until this point:

>>> from PascalX import genescorer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "path_to_miniconda3_folder/envs/PascalX/PascalX/python/PascalX/genescorer.py", line 20, in <module>
    from PascalX import wchissum,snpdb,tools,refpanel,genome,hpstats
  File "path_to_miniconda3_folder/envs/PascalX/PascalX/python/PascalX/wchissum.py", line 21, in <module>
    from PascalX_core import lib,ffi
ImportError: libruben.so: cannot open shared object file: No such file or directory

After checking the folders resulting from the make command, I found that it was just a matter of these shared objects not being linked (as they are actually found in the PascalX/build/lib folder. A very fast and easy solution is to create a symlink to libruben.so, libdavies.so , and libwchissum.so in the lib folder of the conda environment, in this example path_to_miniconda3_folder/PascalX/lib:

ln -s path_to_git_folder/PascalX/build/lib/libruben.so path_to_miniconda3_folder/PascalX/lib/libruben.so
ln -s path_to_git_folder/PascalX/build/lib/libdavies.so path_to_miniconda3_folder/PascalX/lib/libdavies.so
ln -s path_to_git_folder/PascalX/build/lib/libwchissum.so path_to_miniconda3_folder/PascalX/lib/libwchissum.so

We replicated the same problem on multiple machines (and different Python versions, the latest being 3.12.3), and this simple procedure above solved the error(s) on all of them.

I am not sure whether this is something that can be easily solved for the conda-packaged PascalX, but I figured writing it here. people with the same problem (and make you aware that this couldmight help some an issue for some users)!

Thank you in advance for your help!
Dennis.

Activity

  1. changed the title [-]Compiled library files are not linked when installing with condo[/-] [+]Compiled library files are not linked when installing with conda[/+] on Feb 7, 2025
  2. Dan-RAI commented on Feb 11, 2025

    @Dan-RAI
    Collaborator

    I think the issue is that conda does not support setting LD_LIBRARY_PATH. See for instance the discussion here.

    A workaround stated there:

    Now, every time I activate a env, I have to manually export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH
    

    Another solution would be to install the .so into one of the system lib dirs, but that requires sudo.

    I do not recall what the original motivation had been for using an additional .so library file. I think one of the motivations could have been that one can directly use the lib elsewhere. But we may think about moving the code away from the .so, which should then allow to skip the LD path setting.

  3. added
    enhancement
    on Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions