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

pip installed binaries not readily available? #112

Closed
FelicianoTech opened this issue Dec 14, 2021 · 12 comments
Closed

pip installed binaries not readily available? #112

FelicianoTech opened this issue Dec 14, 2021 · 12 comments

Comments

@FelicianoTech
Copy link
Contributor

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
Copy link

kelvintaywl commented Dec 15, 2021

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: pyenv/pyenv#1906

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

@adrogon
Copy link

adrogon commented Mar 12, 2022

Is the following related?

Before

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

✔️ Passes.

After

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

sudo: pip: command not found

@hyperknot
Copy link

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
Copy link
Contributor Author

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
Copy link

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

@FelicianoTech
Copy link
Contributor Author

@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
Copy link

adrogon commented Sep 15, 2022

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
Copy link
Contributor Author

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
Copy link

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
Copy link

adrogon commented Sep 16, 2022

@FelicianoTech It does work, thank you for that 😊

@FelicianoTech
Copy link
Contributor Author

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.

NickFitz added a commit to uktrade/market-access-python-frontend that referenced this issue Oct 10, 2022
… using `sudo pip install` - removing the `sudo` suppsedly fixes it. Let's see…
NickFitz added a commit to uktrade/market-access-python-frontend that referenced this issue Oct 10, 2022
* This needs redoing.

* Show all status changes for PB100 barriers.

* Update view tests to reflect new, more inclusive attitude to history.

* Missing </div>.

* Need the lockfile too…

* Update CircleCI images.

* Well, that just broke everything :-/

* Let's try just switching images for the formats-and-secrets checks, as they're what's failing.

* According to CircleCI-Public/cimg-python#112 (comment) the problem is using `sudo pip install` - removing the `sudo` suppsedly fixes it. Let's see…

* Aaagh! "Fixed" the wrong bit :-(

* Try force-installing a version of `importlib-metadata` that ought to work.

* Well, that didn't work. Let's dig a little deeper.

* Let's try updating flake8 used by pre-commit.

* Check if we actually need to pin the importlib-metadata version now flake8 is working.

* That just broke stuff again :-(

* Back out the CircleCI changes - they should be done, but we should do them on a separate tech debt ticket :-)
NickFitz added a commit to uktrade/market-access-python-frontend that referenced this issue Oct 11, 2022
* This needs redoing.

* Show all status changes for PB100 barriers.

* Update view tests to reflect new, more inclusive attitude to history.

* Missing </div>.

* Need the lockfile too…

* Update CircleCI images.

* Well, that just broke everything :-/

* Let's try just switching images for the formats-and-secrets checks, as they're what's failing.

* According to CircleCI-Public/cimg-python#112 (comment) the problem is using `sudo pip install` - removing the `sudo` suppsedly fixes it. Let's see…

* Aaagh! "Fixed" the wrong bit :-(

* Try force-installing a version of `importlib-metadata` that ought to work.

* Well, that didn't work. Let's dig a little deeper.

* Let's try updating flake8 used by pre-commit.

* Check if we actually need to pin the importlib-metadata version now flake8 is working.

* That just broke stuff again :-(

* Back out the CircleCI changes - they should be done, but we should do them on a separate tech debt ticket :-)
NickFitz added a commit to uktrade/market-access-python-frontend that referenced this issue Oct 21, 2022
* Use the same version of Lunux as is used in production.

* Different system requirements and package names! Also, node is an idiot.

* There doesn't seem to be a Python 3.7 available from the official Ubuntu repository, but the excellent deadsnakes repo comes to the rescue!

* Switch wget for curl, as we already used that further up.

* No need to upgrade pip - further up, we installed the latest version.

* Bump node to a more recent version.

* Update node packages.

* added rtp tag to metadata (#348)

* Add Playwright to project requirements.

* Start setting up Playwright tests.

* Install and initialise Playwright in Docker.

* Configure Playwright to use test settings.

* Custom Playwright settings.

* Configure Django test server and Mock SSO.

* An example of a Playwright test 🙂

* Ensure the live_server fixture is in use for all tests.

* Remove live_server fixture from args as it's now a session-wide autouse fixture.

* Add an example test showing use of `reverse` to construct test URL.

* More examples and a test for history.

* Hotfix for the pre-commit problem with outdated flake8.

* TSS-477: BUGFIX barrier status history (#354)

* This needs redoing.

* Show all status changes for PB100 barriers.

* Update view tests to reflect new, more inclusive attitude to history.

* Missing </div>.

* Need the lockfile too…

* Update CircleCI images.

* Well, that just broke everything :-/

* Let's try just switching images for the formats-and-secrets checks, as they're what's failing.

* According to CircleCI-Public/cimg-python#112 (comment) the problem is using `sudo pip install` - removing the `sudo` suppsedly fixes it. Let's see…

* Aaagh! "Fixed" the wrong bit :-(

* Try force-installing a version of `importlib-metadata` that ought to work.

* Well, that didn't work. Let's dig a little deeper.

* Let's try updating flake8 used by pre-commit.

* Check if we actually need to pin the importlib-metadata version now flake8 is working.

* That just broke stuff again :-(

* Back out the CircleCI changes - they should be done, but we should do them on a separate tech debt ticket :-)

* This is poetry.lock as generated on this branch after rebasing on master.

* End-of-file-fixer being annoying again :-/

* Now flake8 is breaking on a different step, because we install different versions for pre-commit and the main environment. Ho hum.

* Try to bust CircleCI's cache for the pep8 step.

* Restore CircleCI's cache for the pep8 step.

* Mention the need for the API to be running.

* Add comment.

* Get rid of old Selenium tests and move Playwright tests in.

* Run UI tests via Makefile.

* Update README for UI tests.

* Dependency updates after merging master back in.

* Include TEST_BASE_URL in sample Docker env file.

* Mention problem with local Barrier IDs.

Co-authored-by: James Pacileo <608868+jamespacileo@users.noreply.github.com>
NickFitz added a commit to uktrade/market-access-python-frontend that referenced this issue Oct 25, 2022
* Use the same version of Lunux as is used in production.

* Different system requirements and package names! Also, node is an idiot.

* There doesn't seem to be a Python 3.7 available from the official Ubuntu repository, but the excellent deadsnakes repo comes to the rescue!

* Switch wget for curl, as we already used that further up.

* No need to upgrade pip - further up, we installed the latest version.

* Bump node to a more recent version.

* Update node packages.

* added rtp tag to metadata (#348)

* Add Playwright to project requirements.

* Start setting up Playwright tests.

* Install and initialise Playwright in Docker.

* Configure Playwright to use test settings.

* Custom Playwright settings.

* Configure Django test server and Mock SSO.

* An example of a Playwright test 🙂

* Ensure the live_server fixture is in use for all tests.

* Remove live_server fixture from args as it's now a session-wide autouse fixture.

* Add an example test showing use of `reverse` to construct test URL.

* More examples and a test for history.

* Hotfix for the pre-commit problem with outdated flake8.

* TSS-477: BUGFIX barrier status history (#354)

* This needs redoing.

* Show all status changes for PB100 barriers.

* Update view tests to reflect new, more inclusive attitude to history.

* Missing </div>.

* Need the lockfile too…

* Update CircleCI images.

* Well, that just broke everything :-/

* Let's try just switching images for the formats-and-secrets checks, as they're what's failing.

* According to CircleCI-Public/cimg-python#112 (comment) the problem is using `sudo pip install` - removing the `sudo` suppsedly fixes it. Let's see…

* Aaagh! "Fixed" the wrong bit :-(

* Try force-installing a version of `importlib-metadata` that ought to work.

* Well, that didn't work. Let's dig a little deeper.

* Let's try updating flake8 used by pre-commit.

* Check if we actually need to pin the importlib-metadata version now flake8 is working.

* That just broke stuff again :-(

* Back out the CircleCI changes - they should be done, but we should do them on a separate tech debt ticket :-)

* This is poetry.lock as generated on this branch after rebasing on master.

* End-of-file-fixer being annoying again :-/

* Now flake8 is breaking on a different step, because we install different versions for pre-commit and the main environment. Ho hum.

* Try to bust CircleCI's cache for the pep8 step.

* Restore CircleCI's cache for the pep8 step.

* Mention the need for the API to be running.

* Add comment.

* Get rid of old Selenium tests and move Playwright tests in.

* Run UI tests via Makefile.

* Update README for UI tests.

* Dependency updates after merging master back in.

* Include TEST_BASE_URL in sample Docker env file.

* Mention problem with local Barrier IDs.

Co-authored-by: James Pacileo <608868+jamespacileo@users.noreply.github.com>
@anilanar
Copy link

anilanar commented Oct 27, 2022

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.

facebook-github-bot pushed a commit to pytorch/captum that referenced this issue May 27, 2023
Summary:
Current images used (e.g. circleci/python3.6.8 ) seem to be deprecated and causing current test failures. Migrating to new machine images (cimg/python3.6.8 ).

This also required updating pip calls to not use sudo due to changes to python virtualenv setup (see CircleCI-Public/cimg-python#112 for more details).

Minor fixes to test_gradient_shap added to resolve mypy failures.

Pull Request resolved: #1142

Reviewed By: aobo-y

Differential Revision: D46164598

Pulled By: vivekmig

fbshipit-source-id: c8497e6d320bb2212ff76f371ed7b117fd32ec9c
Jonty added a commit to Jonty/uk_petitions_data that referenced this issue May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants