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

Pipenv requires existing folder ~/.local/share/virtualenvs #2786

Closed
tcwalther opened this issue Aug 28, 2018 · 5 comments · Fixed by #2877
Closed

Pipenv requires existing folder ~/.local/share/virtualenvs #2786

tcwalther opened this issue Aug 28, 2018 · 5 comments · Fixed by #2877
Labels
good first issue Issues suitable as a newcomer to get familiar with Pipenv! Type: Bug 🐛 This issue is a bug.

Comments

@tcwalther
Copy link

tcwalther commented Aug 28, 2018

Issue description

When running the current commit 51cbc2e of pipenv in a Docker image (like python:3.6), one has to manually create the folder /root/.local/share/virtualenvs for pipenv to work.

Expected result
root@851be9e3b8d1:/tmp# pipenv install requests
Creating a virtualenv for this project…
Pipfile: /tmp/Pipfile
Using /usr/local/bin/python (3.6.6) to create virtualenv…
...
Actual result
root@851be9e3b8d1:/tmp# pipenv install requests
Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 11, in <module>
    sys.exit(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 416, in install
    selective_upgrade=selective_upgrade,
  File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 1667, in do_install
    pypi_mirror=pypi_mirror,
  File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 553, in ensure_project
    pypi_mirror=pypi_mirror,
  File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 471, in ensure_virtualenv
    if not project.virtualenv_exists:
  File "/usr/local/lib/python3.6/site-packages/pipenv/project.py", line 259, in virtualenv_exists
    if self.pipfile_exists and os.path.exists(self.virtualenv_location):
  File "/usr/local/lib/python3.6/site-packages/pipenv/project.py", line 370, in virtualenv_location
    self._virtualenv_location = self.get_location_for_virtualenv()
  File "/usr/local/lib/python3.6/site-packages/pipenv/project.py", line 272, in get_location_for_virtualenv
    name = self.virtualenv_name
  File "/usr/local/lib/python3.6/site-packages/pipenv/project.py", line 356, in virtualenv_name
    sanitized, encoded_hash = self._get_virtualenv_hash(self.name)
  File "/usr/local/lib/python3.6/site-packages/pipenv/project.py", line 340, in _get_virtualenv_hash
    for path in get_workon_home().iterdir():
  File "/usr/local/lib/python3.6/pathlib.py", line 1079, in iterdir
    for name in self._accessor.listdir(self):
  File "/usr/local/lib/python3.6/pathlib.py", line 387, in wrapped
    return strfunc(str(pathobj), *args)
FileNotFoundError: [Errno 2] No such file or directory: '/root/.local/share/virtualenvs'
Steps to replicate
docker run -it --rm python:3.6 bash
# inside the container
pip install git+git://github.com/pypa/pipenv.git@51cbc2e2f76a7c60f879a608fd96e95faca35f2e
pipenv install requests

To fix:

# inside the container
mkdir -p /root/.local/share/virtualenvs
@tcwalther tcwalther changed the title Pipenv requires ~/.local/share/virtualenvs to exist. Pipenv requires existing folder ~/.local/share/virtualenvs Aug 28, 2018
@uranusjr
Copy link
Member

I’d assume the solution would be to create ~/.local/share/virtualenvs to make sure it exists.

@uranusjr uranusjr added Type: Bug 🐛 This issue is a bug. good first issue Issues suitable as a newcomer to get familiar with Pipenv! labels Aug 29, 2018
@sinscary
Copy link
Contributor

sinscary commented Sep 4, 2018

@uranusjr Can I take this up?

@uranusjr
Copy link
Member

uranusjr commented Sep 4, 2018

sure, go ahead

@Enzime
Copy link
Contributor

Enzime commented Sep 19, 2018

@sinscary are you still working on this one or can I take it up?

@sinscary
Copy link
Contributor

sinscary commented Sep 19, 2018

@Enzime I didn't get time to look at this. You can take it up 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issues suitable as a newcomer to get familiar with Pipenv! Type: Bug 🐛 This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants