How to install omero-py with slicer.util.pip_install

Hi all,

I am working with 3D Slicer on a Ubuntu 20.0.4 docker. I am trying to install the omero-py Python library. It needs to install zero-ice==3.6.5. Additionally, you have to install the following libraries in Ubuntu:

apt-get install libssl-dev
apt-get install libbz2-dev
apt-get install build-essential
apt-get install python3.9-dev

Pip doesn’t intall these.

However, the slicer.util.pip_install(“zeroc-ice==‘3.6.5’”) command doesn’t work.
Error:

creating build/temp.linux-x86_64-cpython-39/src/ice/mcpp
 
      /opt/rh/devtoolset-7/root/usr/bin/gcc -pthread -std=c99 -Wall -Wstrict-prototypes -fno-strict-aliasing -fwrapv -g -fPIC -DICE_STATIC_LIBS -Isrc -Isrc/ice/cpp/include -Isrc/ice/cpp/src -I/work/Stable/Slicer-0-build/python-install/include/python3.9 -c src/BatchRequestInterceptor.cpp -o build/temp.linux-x86_64-cpython-39/src/BatchRequestInterceptor.o -w
 
      error: command '/opt/rh/devtoolset-7/root/usr/bin/gcc' failed: No such file or directory
 
      [end of output]
  note: This error originates from a subprocess, and is likely not a problem with pip.
 
error: legacy-install-failure
× Encountered error while trying to install package.
 
╰─> zeroc-ice
note: This is an issue with the package mentioned above, not pip.
 
hint: See above for output from the failure.
[notice] A new release of pip is available: 23.0 -> 23.3.1
 
[notice] To update, run: python-real -m pip install --upgrade pip
 
Traceback (most recent call last):
 
  File "<console>", line 1, in <module>
 
  File "/slicer/bin/Python/slicer/util.py", line 3578, in pip_install
 
    _executePythonModule('pip', args)
 
  File "/slicer/bin/Python/slicer/util.py", line 3540, in _executePythonModule
 
    logProcessOutput(proc)
 
  File "/slicer/bin/Python/slicer/util.py", line 3509, in logProcessOutput
 
    raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
 
subprocess.CalledProcessError: Command '['/slicer/bin/../bin/PythonSlicer', '-m', 'pip', 'install', 'omero-py']' returned non-zero exit status 1.

In order for it to work, I need to install python 3.9 and its pip with:

apt-get install python3.9
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.9 get-pip.py

Then, I install zeroc-ice library:
pip install zeroc-ice=='3.6.5'`` If I then execute slicer.util.pip_install(“zeroc-ice==‘3.6.5’”)`, it succeeds.

Does anyone know why? Is there any way to make the pip install work in Slicer without installing the other python as described above?

Thanks a lot for the help!

ZeroC-ICE 3.6.5 does does not have wheels for Python-3.9: zeroc-ice · PyPI

You can use a more recent version that supports Python-3.9 (that has wheels with -cp39- in its name).