Can't find Python when installing dependencies


#1

I have been running into this problem recently with all my Python project where CircleCI Linux environment can’t seem to find Python.

Here is the error message:

#!/bin/bash -eo pipefail
pipenv sync
Warning: Your Pipfile requires python_version 3.6, but you are using None (/home/c/.local/share/v/r/bin/python).
  $ pipenv check will surely fail.
Installing dependencies from Pipfile.lock (609aec)...
An error occurred while installing atomicwrites==1.1.5! Will try again.
An error occurred while installing attrs==18.1.0! Will try again.
An error occurred while installing click==6.7! Will try again.
An error occurred while installing flask==1.0.2! Will try again.
An error occurred while installing itsdangerous==0.24! Will try again.
An error occurred while installing jinja2==2.10! Will try again.
An error occurred while installing markupsafe==1.0! Will try again.
An error occurred while installing more-itertools==4.2.0! Will try again.
An error occurred while installing pluggy==0.6.0! Will try again.
An error occurred while installing py==1.5.4! Will try again.
An error occurred while installing pytest==3.6.3! Will try again.
An error occurred while installing six==1.11.0! Will try again.
An error occurred while installing werkzeug==0.14.1! Will try again.
  🐍   β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰ 13/13 β€” 00:00:00

Installing initially failed dependencies...

/home/circleci/.local/share/virtualenvs/repo-eQF46Ow3/bin/python3.6m: error while loading shared libraries: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory

  ☀  β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰ 0/13 β€” 00:00:00

Exited with code 127

Here is my configuration file:

version: 2
jobs:
  build:
    docker:
      # specify the version you desire here
      # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
      - image: circleci/python

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/postgres:9.4

    working_directory: ~/repo

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "Pipfile.lock" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run:
          name: install dependencies
          command: pipenv sync

      - save_cache:
          paths:
            - ~/.local
          key: v1-dependencies-{{ checksum "Pipfile.lock" }}

      # run tests!
      - run:
          name: run tests
          command: pipenv run pytest

      - store_artifacts:
          path: test-reports
          destination: test-reports

Does anyone know how to solve this problem?
Thanks in advance.


#2

I don’t have an answer to hand, but that warning looks like it could do with fixing. I just did a web search for that error, and there were answers on Stack Overflow. Try that angle first?


#3

You could add an echo "python -V" command to make sure it’s installed and the required version on the image.
Also, I would try adding a version to your image… i.e. - image: circleci/python:3.6-node-browsers (or whichever version you need for compatibility code)


#4

Thanks for the advice. I did found a post on stack overflow about solving this problem except it didn’t work for me. One thing to note is that this worked fine before and it stopped working as soon as I got to China so I don’t know if the great firewall has anything to do with it.


#5

It worked by specifying the version of python. Thanks!!


#6

that’s great. i’m glad that solved your issue!


#7

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.