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

python27 pipenv install python36 project #1457

Closed
melbshark opened this issue Feb 21, 2018 · 9 comments
Closed

python27 pipenv install python36 project #1457

melbshark opened this issue Feb 21, 2018 · 9 comments

Comments

@melbshark
Copy link

Be sure to check the existing issues, both open and closed.

Describe the issue briefly here.

Describe your environment
  1. Win10 64
  2. Python version: Python 2.7.13
  3. Pipenv version: version 9.1.0
Expected result

I use gobal pipenv, which located in python27 folder, install python3 project, using python3 interpreter.
python3 project locate: https://github.com/hugsy/cemu

Actual result

Installing -e .…
Traceback (most recent call last):
File "C:\Python27\Scripts\pipenv-script.py", line 11, in
load_entry_point('pipenv==9.1.0', 'console_scripts', 'pipenv')()
File "c:\python27\lib\site-packages\pipenv\vendor\click\core.py", line 722, in call
return self.main(*args, **kwargs)
File "c:\python27\lib\site-packages\pipenv\vendor\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "c:\python27\lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\python27\lib\site-packages\pipenv\vendor\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\python27\lib\site-packages\pipenv\vendor\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "c:\python27\lib\site-packages\pipenv\cli.py", line 213, in install
deploy=deploy
File "c:\python27\lib\site-packages\pipenv\core.py", line 1757, in do_install
click.echo(crayons.blue(format_pip_output(c.out)))
File "c:\python27\lib\site-packages\pipenv\vendor\click\utils.py", line 221, in echo
message = text_type(message)
File "c:\python27\lib\site-packages\pipenv\patched\crayons.py", line 88, in unicode
return value.decode('utf8')
File "c:\python27\lib\encodings\utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb2 in position 4264: invalid start byte

Steps to replicate
  1. download "https://github.com/hugsy/cemu" to a folder.
  2. cd to this folder.
  3. pipenv --three install -e.
@ncoghlan
Copy link
Member

This looks to me like we might be attempting to decode mbcs from the Windows console as UTF-8.

@mmyydd Does the install behave itself if you use Python 3.6 to run pipenv and pip as well? (3.6 changed how the console gets handled on Windows, such that decoding with utf-8 should more reliably do the right thing).

@uranusjr
Copy link
Member

From experience, this error message usually suggests there is an underlying issue happening, usually in a subprocess. I would even venture to guess the issue is OSError-derived, most of those contain localised messages on Windows.

@ncoghlan
Copy link
Member

@uranusjr Getting Python 2 to play nice with the standard Windows console can be a little interesting: https://pypi.python.org/pypi/win_unicode_console goes over some of the problems with it.

Python 3.6+ is a fair bit easier to use though, since Steve Dower moved a lot of the console encoding handling over into the Python runtime, which is what makes it possible to mostly avoid encountering mbcs.

@techalchemy
Copy link
Member

@mmyydd it is highly recommended to install pipenv with python 3 if at all possible, especially on windows.

Crossing python version boundaries from python 2 to 3 poses plenty of problems on its own, but if you haven't made the necessary console adjustments you're going to have a hard time (and you still might)

@kennethreitz
Copy link
Contributor

Resolution: use Python 3. I'm considering dropping support for 2.

@jtratner
Copy link
Collaborator

jtratner commented Feb 23, 2018 via email

@ncoghlan
Copy link
Member

@kennethreitz I think the main problem with dropping Py2 support completely right now is that #857 means that a Py3 pipenv may not generate a correct lockfile for Python 2.7 virtual environments.

So if we did drop support for running pipenv under Py 2.7, we'd likely have to drop official support for directly managing 2.7 environments as well (or at least emit a warning that some dependencies might be missing).

However, if we're able to figure out a way to fix #857, then I'd definitely be +1 on requiring that pipenv itself run under Python 3.x (perhaps even going so far as to require 3.6+, because f-strings are really nice).

@kennethreitz
Copy link
Contributor

We can't drop 2 support, just discourage it.

@kennethreitz
Copy link
Contributor

kennethreitz commented Feb 24, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants