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.

Unable to install package in container

See original GitHub issue

I was troubleshooting an opened bug (https://github.com/pypa/pipenv/issues/1639) that I seem to have run into. In trying to reproduce it, it seems like i bumped into another issue.

This looks similar to the closed https://github.com/pypa/pipenv/issues/1441 issue, however, the command virtualenv --python=python3 myenv did not error out as anticipated in the comments.

Expected result

I expected to see a Pipfile and Pipfile.lock in the /tmp/test1 directory.

Actual result

Saw the strack trace above.

Steps to replicate
 saviles  ~  1  docker run --rm -ti fedora:27 /bin/bash
[root@0958ee759ab3 /]# dnf install -qy which
install-info: No such file or directory for /usr/share/info/which.info.gz
[root@0958ee759ab3 /]# pip3 install --user pipenv
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting pipenv
  Downloading pipenv-11.2.0.tar.gz (4.1MB)
    100% |████████████████████████████████| 4.1MB 412kB/s 
Collecting setuptools>=36.2.1 (from pipenv)
  Downloading setuptools-38.5.2-py2.py3-none-any.whl (490kB)
    100% |████████████████████████████████| 491kB 2.3MB/s 
Collecting virtualenv (from pipenv)
  Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB)
    100% |████████████████████████████████| 1.8MB 810kB/s 
Collecting virtualenv-clone>=0.2.5 (from pipenv)
  Downloading virtualenv_clone-0.3.0-py2.py3-none-any.whl
Installing collected packages: setuptools, virtualenv, virtualenv-clone, pipenv
  Running setup.py install for pipenv ... done
Successfully installed pipenv-11.2.0 setuptools-38.5.2 virtualenv-15.1.0 virtualenv-clone-0.3.0
[root@0958ee759ab3 /]# mkdir /tmp/test1
[root@0958ee759ab3 /]# cd /tmp/test1
[root@0958ee759ab3 test1]# python3 -m pipenv install requests
Warning: the environment variable LANG is not set!
We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.
Creating a virtualenv for this project…
⠋Using base prefix '/usr'
New python executable in /root/.local/share/virtualenvs/test1-MiVIN7Yf/bin/python3
Also creating executable in /root/.local/share/virtualenvs/test1-MiVIN7Yf/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: 
Creating a Pipfile for this project…
Traceback (most recent call last):
  File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/root/.local/lib/python3.6/site-packages/pipenv/__main__.py", line 4, in <module>
    cli()
  File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/root/.local/lib/python3.6/site-packages/pipenv/cli.py", line 197, in install
    selective_upgrade=selective_upgrade
  File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 1767, in do_install
    ensure_project(three=three, python=python, system=system, warn=True, deploy=deploy, skip_requirements=skip_requirements)
  File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 688, in ensure_project
    ensure_pipfile(validate=validate, skip_requirements=skip_requirements)
  File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 341, in ensure_pipfile
    project.create_pipfile(python=python)
  File "/root/.local/lib/python3.6/site-packages/pipenv/project.py", line 439, in create_pipfile
    data[u'requires'] = {'python_version': python_version(self.which('python'))[:len('2.7')]}
TypeError: 'NoneType' object is not subscriptable

[root@0958ee759ab3 test1]# python3 -m pipenv.help
Pipenv version: '11.2.0'

Pipenv location: '/root/.local/lib/python3.6/site-packages/pipenv'

Python location: '/usr/bin/python3'

Other Python installations in PATH:

  • 3.6: /usr/bin/python3.6m

  • 3.6: /usr/bin/python3.6

  • 3.6: /bin/python3.6

  • 3.6.2: /usr/bin/python3

  • 3.6.2: /bin/python3

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.6.2',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.15.6-300.fc27.x86_64',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP Mon Feb 26 18:43:03 UTC 2018',
 'python_full_version': '3.6.2',
 'python_version': '3.6',
 'sys_platform': 'linux'}

System environment variables:

  • LS_COLORS
  • HOSTNAME
  • PWD
  • HOME
  • FBR
  • DISTTAG
  • FGC
  • TERM
  • SHLVL
  • PATH
  • _
  • OLDPWD
  • LC_CTYPE
  • PIP_PYTHON_PATH

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  • PWD: /tmp/test1

Contents of Pipfile (‘/tmp/test1/Pipfile’):


[root@0958ee759ab3 test1]# envname
bash: envname: command not found
[root@0958ee759ab3 test1]# virtualenv --python=python3 myenv
bash: virtualenv: command not found
[root@0958ee759ab3 test1]# python3 -m virtualenv --python=python3 myenv
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /tmp/test1/myenv/bin/python3
Also creating executable in /tmp/test1/myenv/bin/python
Installing setuptools, pip, wheel...done.
[root@0958ee759ab3 test1]# ls
Pipfile  myenv
[root@0958ee759ab3 test1]# 

(Edit: Formatting)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:31 (18 by maintainers)

github_iconTop GitHub Comments

11reactions
sijiscommented, Mar 9, 2018

Don’t use Docker? 😃

3reactions
cmac4603commented, May 8, 2018

I am still seeing this issue on python:3.6 docker. Is there a fix released, or a quick fix a user can do?

Step 1/6 : FROM python:3.6
 ---> efb6baa1169f
Step 2/6 : RUN python -m pip install pipenv
 ---> Running in 44264bb4020b
Collecting pipenv
  Downloading https://files.pythonhosted.org/packages/ed/a3/6c51d36006a563798021f954fd10a9baeb9592f8dabbb162ff0595e309cf/pipenv-11.10.3-py3-none-any.whl (6.4MB)
Requirement already satisfied: pip>=9.0.1 in /usr/local/lib/python3.6/site-packages (from pipenv)
Requirement already satisfied: setuptools>=36.2.1 in /usr/local/lib/python3.6/site-packages (from pipenv)
Collecting certifi (from pipenv)
  Downloading https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl (150kB)
Collecting virtualenv (from pipenv)
  Downloading https://files.pythonhosted.org/packages/ed/ea/e20b5cbebf45d3096e8138ab74eda139595d827677f38e9dd543e6015bdf/virtualenv-15.2.0-py2.py3-none-any.whl (2.6MB)
Collecting virtualenv-clone>=0.2.5 (from pipenv)
  Downloading https://files.pythonhosted.org/packages/6d/c2/dccb5ccf599e0c5d1eea6acbd058af7a71384f9740179db67a9182a24798/virtualenv_clone-0.3.0-py2.py3-none-any.whl
Installing collected packages: certifi, virtualenv, virtualenv-clone, pipenv
Successfully installed certifi-2018.4.16 pipenv-11.10.3 virtualenv-15.2.0 virtualenv-clone-0.3.0
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Removing intermediate container 44264bb4020b
 ---> 4a3bf7062e88
Step 3/6 : RUN python -m pipenv shell
 ---> Running in 27d9a362d4c3
Creating a virtualenv for this project…
Using /usr/local/bin/python (3.6.5) to create virtualenv…
usage: __main__.py [-h] [-p PYTHON] [-i PACKAGES] [-r REQUIREMENTS] [-d]
                   [-a PROJECT]
                   envname
__main__.py: error: the following arguments are required: envname

Virtualenv location:
Creating a Pipfile for this project…
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.6/site-packages/pipenv/__main__.py", line 4, in <module>
    cli()
  File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/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/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pipenv/cli.py", line 607, in shell
    three=three, python=python, fancy=fancy, shell_args=shell_args
  File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 2143, in do_shell
    ensure_project(three=three, python=python, validate=False)
  File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 650, in ensure_project
    ensure_pipfile(validate=validate, skip_requirements=skip_requirements, system=system)
  File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 304, in ensure_pipfile
    project.create_pipfile(python=python)
  File "/usr/local/lib/python3.6/site-packages/pipenv/project.py", line 571, in create_pipfile
    config_parser = ConfigOptionParser(name=self.name)
  File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/pip9/baseparser.py", line 149, in __init__
    assert self.name
AssertionError

I am tring to install dependencies, but even a pipenv shell from fresh doesn’t seem to work for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot install packages inside docker Ubuntu image
It is because there is no package cache in the image, you need to run: apt-get update. before installing packages, and if your...
Read more >
docker apt-get unable to locate package
You want to install a package inside a docker container? apt-get tells you unable to locate package? Find help here.
Read more >
Latest Docker image fails to install packages because of ...
I am using the docker image FROM pytorch/torchserve:0.5.3-gpu as the base image. Trying to install packages like RUN pip install --upgrade ...
Read more >
Cannot install packages in a container running the rocker ...
If you are getting a different error message then you most likely have a different problem.
Read more >
Unable to install package via yum while using a docker ...
The solution was fairly simple, I had to create a shell script that would remove that additional ".rpm" from the package name and...
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