Skip to content

ModuleNotFoundError when installing via install_from_url() #66

Open
@gbayarri

Description

@gbayarri

Hi, I'm installing a condacolab via install_from_url() because I need a conda/mamba with python 3.9 while colab is pinned to 3.10. I tried with several versions of mambaforge, included some of the official website or this:

https://github.com/jaimergp/miniforge/releases/tag/22.11.1-4_colab

I've tried as well with the conda constructor following the instruction of the condacolab pypi but modifying the version to 3.9:

name: condacolab  # you can edit this if you want
version: 0.1      # increment if you change the specs, for reproducibility!

channels:
  - conda-forge
specs:
  - python =3.9  # Python MUST be version 3.7
  - pip
  - conda
  - mamba  # mamba is not needed but recommended

# Pip dependencies are NOT recommended. If you do need them
# uncomment the line below and edit `pip-dependencies.sh`.
# post_install: pip-dependencies.sh

# do not edit below this line
# ---------------------------
installer_type: sh

After running all these installations, I load my environment.yml and the conda list shows the correct version of my dependencies. For example:

!conda list | grep ngl
nglview                   3.0.8              pyh1da8cd4_0    conda-forge

But when doing the import in a cell:

import nglview
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
[<ipython-input-12-dd30d89a3198>](https://localhost:8080/#) in <cell line: 1>()
----> 1 import nglview

ModuleNotFoundError: No module named 'nglview'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

The weirdest thing is that when I import this dependency in pure python it works:

!python
Python 3.9.19 | packaged by conda-forge | (main, Mar 20 2024, 12:50:21) 
[GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import nglview
>>> nglview.demo()
NGLWidget()

Any idea of what I'm missing?

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