Skip to content

Usage in Conda #1

@vasilygrz

Description

@vasilygrz

Hi Nathaniel,

My working environment in Python consists of WSL2 + VS Code + Conda and I also use Dev Containers when Docker is needed. So far, I couldn't make R work in this environment, so I've been using rocker instead.

I've created the following Conda environment, which contains the minimum amount of libraries to give iglu-py a try:

name: iglu-env
channels:
  - conda-forge
dependencies:
  # Python
  - python=3.12.11
  - jupyter=1.1.1
  - pandas=2.2.3 py312*
  - pip=25.1.1
  - xz=5.8.1
  - zlib=1.3.1
  # R
  - r-base=4.4.3
  - rpy2=3.6.1
  - pip:
    - iglu-py==1.1.1

And, not surprisingly, it doesn't work. While the Installation section says that R is not needed, it's in fact required to use rpy2. For example, check this issue on iglu where another user has created a direct Python translation of the R library.

When I run import iglu-py two things happen:

  1. libR.so cannot be found: Error importing in API mode: ImportError('libR.so: cannot open shared object file: No such file or directory'). It then proceeds to Trying to import in ABI mode without success. libR.so is located in $CONDA_PREFIX/lib/R/lib/ and iglu_py is in ~/miniconda3/envs/iglu-env/lib/python3.12/site-packages/. Adding the environment variable LD_LIBRARY_PATH in the Jupyter Notebook doesn't work, I've read that it has to be done on the shell before activating the Conda environment.
  2. It doesn't find the iglu_4.1.7.tar.gz file, so it starts to download all dependencies from CRAN into lib/R/ and after 10 min it crashes.

Questions

  1. I'd like to ask you whether it's feasible to adapt the library to make it work in a Conda environment.
  2. Is it in your interest to do so?

Comments

  1. We'd have to revisit and improve the Installation section.
  2. The first thing I've thought about is to adapt both __init__.py and bridge.py to create a distinction between Conda and non-Conda environments (L84-85 cannot see the difference between lib/python3.12/ and lib/R/), but I've realised that it may not be a good solution.
  3. For the time being, we can update __init__.py to check for where rpy2 looks for libR.so and raise an ImportError.
  4. How about automating L12 so the latest iglu version from CRAN is passed in?

Note that I haven't created a library before, so my knowledge may be limited.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions