Search code examples
pythonpipanacondacondagoogle-colaboratory

No module named pip


Conda environment

I'm creating the following conda environment by conda env create -f environment.yml.

The environment.yml file content is:

name: deep3d_pytorch
channels:
  - pytorch
  - conda-forge
  - defaults
dependencies:
  - python=3.6
  - pytorch=1.6.0
  - torchvision=0.7.0
  - numpy=1.18.1
  - scikit-image=0.16.2
  - scipy=1.4.1
  - pillow=6.2.1
  - pip=20.0.2
  - ipython=7.13.0
  - yaml=0.1.7
  - pip:
    - matplotlib==2.2.5
    - opencv-python==3.4.9.33
    - tensorboard==1.15.0
    - tensorflow==1.15.0
    - kornia==0.5.5
    - dominate==2.6.0
    - trimesh==3.9.20

Error

At the end of the environment creation process, these errors are thrown:

Installing pip dependencies: \ Ran pip subprocess with arguments:
['/usr/local/envs/deep3d_pytorch/bin/python', '-m', 'pip', 'install', '-U', '-r', '/content/Deep3DFaceRecon_pytorch/condaenv.i1gomfsb.requirements.txt', '--exists-action=b']
Pip subprocess output:

Pip subprocess error:
/usr/local/envs/deep3d_pytorch/bin/python: No module named pip

failed

CondaEnvException: Pip failed

In addition to conda env create -f environment.yml, updating the conda environment by conda env update -f environment.yml would throw similar errors.

Note

The errors occur on my local machine and also on the Google Colab. I'm just following the instructions. Does anybody have any clue or hint?

I have looked at this, but couldn't figure it out: Using Pip to install packages to Anaconda Environment


Solution

  • A teammate helped me out:

    I copy pasted your question into google gemini and it told me to do this :)

    This change, suggested by Google Gemini, resolved the errors: I replaced - pip=20.0.2 with - pip on the environment.yml file:

    Git diff screenshot

    Google Colab

    On Google Colab I would run:

    !sed -i '/- pip=20.0.2/c\  - pip' environment.yml
    !conda env update -f environment.yml
    

    Google Colab screenshot