condagensim

How do I use OML to create a custom conda that contains the gensim python package?


I'd like to use OML (Oracle Machine Learning) to create a custom python conda that contains the gensim python package. The OML docs suggest

%conda create -n gensim_env python==3.10 gensim

but that errors out with

Collecting package metadata: ...working... done
Solving environment: ...working... failed

UnsatisfiableError: The following specifications were found to be in conflict:
  - gensim -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  - gensim -> libgcc-ng[version='>=11.2.0'] -> _openmp_mutex -> openmp_impl==9999
  - gensim -> libstdcxx-ng[version='>=11.2.0']
  - gensim -> numpy[version='>=1.26.0,<2.0a0'] -> numpy-base==1.26.3=py312he1a6c75_0 -> python[version='>=3.12,<3.13.0a0'] -> libffi[version='>=3.4,<4.0a0']
  - gensim -> numpy[version='>=1.26.0,<2.0a0'] -> numpy-base==1.26.3=py312he1a6c75_0 -> python[version='>=3.12,<3.13.0a0'] -> libuuid[version='>=1.41.5,<2.0a0']
  - gensim -> numpy[version='>=1.26.0,<2.0a0'] -> numpy-base==1.26.3=py312he1a6c75_0 -> python[version='>=3.12,<3.13.0a0'] -> ncurses[version='>=6.4,<7.0a0']
  - gensim -> numpy[version='>=1.26.0,<2.0a0'] -> numpy-base==1.26.3=py312he1a6c75_0 -> python[version='>=3.12,<3.13.0a0'] -> openssl[version='>=3.0.11,<4.0a0']
  - gensim -> numpy[version='>=1.26.0,<2.0a0'] -> numpy-base==1.26.3=py312he1a6c75_0 -> python[version='>=3.12,<3.13.0a0'] -> sqlite[version='>=3.41.2,<4.0a0'] -> zlib[version='>=1.2.13,<1.3.0a0,>=1.2.13,<2.0a0']
  - gensim -> numpy[version='>=1.26.0,<2.0a0'] -> numpy-base==1.26.3=py312he1a6c75_0 -> python[version='>=3.12,<3.13.0a0'] -> xz[version='>=5.4.2,<6.0a0']
  - python==3.10
Use "conda search <package> --info" to see the dependencies for each package.

Solution

  • Use the -c flag to install a Python library from a specific conda channel. By querying gensim in https://anaconda.org/search, I found that it resides in the conda-forge channel. To create a conda environment with the name 'gensim_env' in OML Notebooks on Oracle Autonomous Database, run the following command in a %conda paragraph under the ADMIN user:

    %conda

    create -n gensim_env -c conda-forge --override-channels --strict-channel-priority python=3.10 gensim

    Save the conda environment to Object Storage for OML users to download, activate, and use the conda environment:

    %conda

    upload gensim_env -t application "OML4Py"

    Uploading conda environment gensim_env Upload successful for conda environment gensim_env

    Next, the OML user will download and activate the conda environment in a %conda paragraph:

    %conda

    download gensim_env activate gensim_env

    With the conda environment downloaded and activated, the gensim library, along with other libraries in this conda environment, can be used in a %python paragraph.

    Note that these instructions are specific to OML on Autonomous Database. For on-premises installations, third-party packages can be installed using various packages installation techniques, including conda, pip, CRAN, etc.