CircleCI-Public / cimg-python

The Next-Gen CircleCI Python Docker Convenience Image.
https://circleci.com/developer/images/image/cimg/python
MIT License
33 stars 33 forks source link

pip installed binaries not readily available? #112

Closed FelicianoTech closed 2 years ago

FelicianoTech commented 2 years ago

It appears for some pip binaries to be made available in PATH, eval "$(pyenv init -)" needs to be manually run. This needs to be investigated as that doesn't sound ideal.

kelvintaywl commented 2 years ago

From recent GitHub issues in Pyenv, it seems there has been a recent change to how much is needed to be done to ensure Pyenv is initialized as part of $PATH.

Example Issue: https://github.com/pyenv/pyenv/issues/1906

This looks to be a recent issue (perhaps starting from a particular Pyenv version).

adrogon commented 2 years ago

Is the following related?

Before

- image: circleci/python:3.10
- sudo pip install awscli

:heavy_check_mark: Passes.

After

- image: cimg/python:3.10
- sudo pip install awscli

:x: sudo: pip: command not found

hyperknot commented 2 years ago

I'm running into this as well. What I found out is that I locally have a .python-version file and it breaks the build environment on CircleCI. This is a recent change and it was quite difficult to debug. Fix is to add

      - run: rm .python-version

at the top of the config.

FelicianoTech commented 2 years ago

There were some changes to the Python image a few months ago. Is anyone having this issue with images published within the past couple of months?

mellis-at-infomedia commented 2 years ago

I've this exact problem 3.10. Should try a different version?

FelicianoTech commented 2 years ago

@mellis-at-infomedia When v3.10.6 came out, the alias 3.10 was updated. Which specific tag are you using? Is there a build link with the error that is for a public project?

adrogon commented 2 years ago

Same problem so far, still trying 3.10. No link to provide, sorry. But here is a sample workflow to reproduce the issue:

version: 2.1

jobs:
  old_image:
    docker:
      - image: circleci/python:3.10
    steps:
      - run: sudo pip install awscli
  new_image:
    docker:
      - image: cimg/python:3.10
    steps:
      - run: sudo pip install awscli

workflows:
  build_and_test:
    jobs:
      - old_image
      - new_image

Screenshot from 2022-09-15 20-14-34

Screenshot from 2022-09-15 20-15-30

FelicianoTech commented 2 years ago

Is everyone here trying to use pip with sudo? Using it without sudo works: https://app.circleci.com/pipelines/github/felicianotech/cci-testing-pub/795/workflows/b06c6237-8392-4375-beaf-294b576a4541/jobs/1805

mellis-at-infomedia commented 2 years ago

You may need to fall back to circleci/python:3.10, which is not the version CircleCI recommends and is marked as experimental, but does seem to have less of these issues

adrogon commented 2 years ago

@felicianotech It does work, thank you for that :blush:

FelicianoTech commented 2 years ago

I'm going to go ahead and close this. In the near future, we'll be updating this readme (as well as for the other images) and how to use package managers, such as when to use sudo or not. Hopefully that will make it clear since I know sometimes it's confusing.

anilanar commented 2 years ago

I think there are legitimate cases when pip or binaries installed by pip need to be used with sudo, for example when running things that will do system-wide operations with sudo.

So I think this issue should be reopened and pip should be pre-installed for root user as well as for the non-root circleci user.