question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attempting to use pipenv in coreos7 fails do to reliance on which command

See original GitHub issue

This was referenced in #544 and was supposedly fixed in 835d935. But I still get the error after installing python36 on a base CentOS7 container.

After finding https://stackoverflow.com/questions/27815420/bash-centos7-which-command?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa it looks like CentOS7 uses the command whatprovides instead of the which command.

Expected result

Pipenv would work.

Actual result

Pipenv didn’t work.


Step 15/16 : RUN pipenv install --system
 ---> Running in bf7ec8a89563
Installing dependencies from Pipfile.lock (011179)…
Warning: the which -a system utility is required for Pipenv to find Python installations properly.
  Please install it.
Warning: the which -a system utility is required for Pipenv to find Python installations properly.
  Please install it.
Warning: the which -a system utility is required for Pipenv to find Python installations properly.
  Please install it.
Traceback (most recent call last):
  File "/usr/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/usr/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pipenv/cli.py", line 402, in install
    selective_upgrade=selective_upgrade,
  File "/usr/lib/python3.6/site-packages/pipenv/core.py", line 1932, in do_install
    requirements_dir=requirements_directory,
  File "/usr/lib/python3.6/site-packages/pipenv/core.py", line 1378, in do_init
    requirements_dir=requirements_dir.name,
  File "/usr/lib/python3.6/site-packages/pipenv/core.py", line 816, in do_install_dependencies
    extra_indexes=extra_indexes,
  File "/usr/lib/python3.6/site-packages/pipenv/core.py", line 1488, in pip_install
    quoted_pip = which_pip(allow_global=allow_global)
  File "/usr/lib/python3.6/site-packages/pipenv/core.py", line 1533, in which_pip
    return which('pip')
  File "/usr/lib/python3.6/site-packages/pipenv/core.py", line 128, in which
    p = os.sep.join([location] + ['bin/{0}'.format(command)])
TypeError: sequence item 0: expected str instance, NoneType found

Steps to replicate

Build this docker container.

FROM centos:7

RUN yum update -y
RUN yum install -y yum-utils
RUN yum -y groupinstall development whatprovides
RUN yum -y install https://centos7.iuscommunity.org/ius-release.rpm
RUN yum -y install python36u
RUN yum -y install python36u-pip
RUN yum -y install python36u-devel
RUN echo -e '#!/bin/bash\nwhatprovides "$@"' > /usr/bin/which && \
    chmod +x /usr/bin/which
COPY . /app
WORKDIR /app
ENV LC_ALL=en_US.utf-8
ENV LANG=en_US.utf-8
RUN pip3.6 install pipenv
RUN pipenv install --system
CMD ["python", "app.py"]

As you can see, I am attempting to wrap which in a call to whatprovides but it didn’t help.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
frobcommented, Sep 22, 2018

This is a closed issue. @sedrubal please open a new issue if you intend to get something done.

0reactions
sedrubalcommented, Sep 3, 2018

Pipenv’s reliance on which is an issue itself

I didn’t find an issue for that and don’t want to open a new one, but why do you require which at all? Can’t you just do something like this instead of which -a?

def which(command):
    """The same as which -a?"""
    return [
        "{}/{}".format(path, command)
        for path in os.getenv('PATH').split(':')
        if os.path.isdir(path) and command in os.listdir(path)
    ]

I can try to make a PR, if you think, this is possible, @uranusjr.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common Pipenv Errors and How to Solve Them: Why Won't it ...
What to do when Pipenv Fails to Lock ... an error, and anyone who uses this Pipfile will encounter locking and dependency errors....
Read more >
Frequently Encountered Pipenv Problems - Read the Docs
Run the following command: pipenv lock --clear. and try again. If this does not work, try manually deleting the whole cache directory.
Read more >
How to resolve Python package dependencies with pipenv?
First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again. Alternatively, you can use $ pipenv...
Read more >
pipenv Documentation - Read the Docs
This shell can be deactivated by using exit. • run will run a given command from the virtualenv, with any arguments forwarded (e.g....
Read more >
Why Use Pipenv to Create a Python Environment? - MakeUseOf
Dependency bugs can be a developer's worst nightmare. You can consume a lot of time upgrading and downgrading dependencies in a vain attempt...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found