Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "No module named pip" with Python2.7 #461

Open
2 tasks done
cas-- opened this issue Apr 11, 2024 · 4 comments
Open
2 tasks done

Error "No module named pip" with Python2.7 #461

cas-- opened this issue Apr 11, 2024 · 4 comments
Labels
type::bug describes erroneous operation, use severity::* to classify the type

Comments

@cas--
Copy link

cas-- commented Apr 11, 2024

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

We have a legacy system that is still running Python2 and the CI build system recently started failing due to the following error when it picked up a new docker image with Conda 23.10.

Pip subprocess error:

/opt/conda/envs/national/bin/python: No module named pip

Installing pip dependencies: ...working... Ran pip subprocess with arguments:

['/opt/conda/envs/national/bin/python', '-m', 'pip', 'install', '-U', '-r', '/opt/atlassian/pipelines/agent/build/condaenv.3ycmalfz.requirements.txt', '--exists-action=b']

Pip subprocess output:

failed

CondaEnvException: Pip failed

We can replicate with a minimal test.yml

channels:
  - conda-forge
dependencies:
  - python=2.7.18
  - pip
  - pip:
    - boto3

and Dockerfile:

FROM continuumio/miniconda3:latest
# works: 23.9.0-0
# broken: 24.1.2-0 23.10.0-1

COPY test.yml .

RUN set -ex && \
    conda env create --name test --file test.yml

I then noticed in the release notes for Conda 23.10 that this solver was now default so testing again with classic solver there was no issue.

-     conda env create --name test --file test.yml
+     conda env create --solver=classic --name test --file test.yml

I didn't see anything specifically mentioning that this solver does not support Python2

Conda Info

No response

Conda Config

No response

Conda list

No response

Additional Context

No response

@cas-- cas-- added the type::bug describes erroneous operation, use severity::* to classify the type label Apr 11, 2024
@cas--
Copy link
Author

cas-- commented Apr 11, 2024

I think i have identified the root of the issue, it seems that Python 2.7.18 is not available in conda-forge, latest is 2.7.15.

So modifying the test.yml to use the older version on conda forge now works:

channels:
  - conda-forge
dependencies:
  - python=2.7.15
  - pip
  - pip:
    - boto3

Not sure what this means for this bug status and whether this should be closed 🤔

@jaimergp
Copy link
Contributor

That's odd. Do you have earlier output for the original error? If the env failed to solve, it should have failed before running pip 🤔

@cas--
Copy link
Author

cas-- commented May 7, 2024

Here is the full error.log with increased verbosity but it does not show any issues.

I did however find in the Mamba docs troubleshooting guide to not mix channels which I would assume applies here

Using the default and conda-forge channels at the same time is not supported and will lead to broken environments:

Although it might be useful if libmamba generated a log warning when it encounters this scenario.

@jaimergp
Copy link
Contributor

jaimergp commented May 7, 2024

You are asking for 2.7.18 but conda-forge only has up to 2.7.15, hence the solver is forced to pick from defaults, which creates the incompatibility I'd guess.

Try to use only defaults, or only conda-forge, or pick python=2.7 so the solver has some more leeway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::bug describes erroneous operation, use severity::* to classify the type
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants