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.

Installing futures backport on Python 2 breaks pipenv on Python 3

See original GitHub issue

The problem appears on systems with Python 2 installed as a default (unfortunately, will still be around for at least several years!) and pipenv installed on Python 2 accordingly, when users are trying to create and manage Python 3 virtualenvs.

See details about my specific setup here:

https://github.com/pypa/pipenv/issues/1686#issuecomment-373019016


Expected result

pipenv works.

Actual result

pipenv bails out with an exception:

zaytsev@work:~/src/pipenv$ docker run -it --rm pipenv-bug
port Link
  File "/root/.local/lib/python2.7/site-packages/pipenv/../pipenv/vendor/pip9/index.py", line 31, in <module>
    from pip9.wheel import Wheel, wheel_ext
  File "/root/.local/lib/python2.7/site-packages/pipenv/../pipenv/vendor/pip9/wheel.py", line 6, in <module>
    import compileall
  File "/usr/lib/python3.6/compileall.py", line 20, in <module>
    from concurrent.futures import ProcessPoolExecutor
  File "/root/.local/lib/python2.7/site-packages/pipenv/../pipenv/../concurrent/futures/__init__.py", line 8, in <module>
    from concurrent.futures._base import (FIRST_COMPLETED,
  File "/root/.local/lib/python2.7/site-packages/pipenv/../pipenv/../concurrent/futures/_base.py", line 414
    raise exception_type, self._exception, self._traceback
                        ^
SyntaxError: invalid syntax
Steps to replicate
# Build image
zaytsev@work:~/src/pipenv$ docker build . --tag pipenv-bug

# Reproduce bug
zaytsev@work:~/src/pipenv$ docker run -it --rm pipenv-bug

# Debug live
zaytsev@work:~/src/pipenv$ docker run -it --rm pipenv-bug /bin/sh

Dockerfile:

zaytsev@work:~/src/pipenv$ cat Dockerfile 
FROM python:2.7-alpine3.7

WORKDIR /opt

RUN apk add --no-cache python3 gcc musl-dev libffi-dev openssl-dev

RUN pip install --user pipenv

ENV PATH="/root/.local/bin:${PATH}" SHELL="/bin/sh"

RUN pipenv --python 3.6

# Installing this breaks pipenv!
RUN pip install --user futures

CMD ["pipenv", "update", "--dry-run"]

Duplicates:

Issue Analytics

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

github_iconTop GitHub Comments

7reactions
zyvcommented, Mar 14, 2018

@kennethreitz I am very disappointed by your reaction. I have really put much time into helping you to isolate, reproduce and debug this issue. I have finally created a working reproducer that you can just run out of the box on any system, so as suggested in the other issue, I’ve opened a new clean issue with detailed explanations on how to reproduce the isolated problem.

Obviously, this is the first step to fixing the issue. If I didn’t want to help you, I would have spared the time I invested so far and went out to get drunk instead of tinkering with Docker…

Whether I will be able to find enough time to submit a pull request, I don’t know. I hope so, but I’m unfamiliar with pipenv code. Now, on top of that, your reaction doesn’t sound welcoming at all, and frankly speaking, I feel demotivated.

5reactions
kennethreitzcommented, Mar 14, 2018

If you’d like to help, please try to help fix the problem, instead of continuing to tell us about it in new and creative ways.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you tell pipenv to use python 3 and not python 2?
The easiest way is to run (assuming you want 3.6 ): pipenv --python 3.6. Alternatively and as a more persistent solution, you can...
Read more >
pipenv Documentation - Read the Docs
Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the. Python...
Read more >
futures - PyPI
This is a backport of the concurrent.futures standard library module to Python 2. It does not work on Python 3 due to Python...
Read more >
Packaging and Python 2 - #19 by ncoghlan
An open source project can just use an unsupported version of Python 2.7 to test their package with, and can utilize backports to...
Read more >
Outdated python/pip in License Management yields ... - GitLab
2 installed as its python3. Therefore any package that requires a version of python later than Python 3.5.2 will fail to install -...
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