Skip to content

can't install by pip #298

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wwqgtxx opened this issue Feb 12, 2017 · 9 comments
Closed

can't install by pip #298

wwqgtxx opened this issue Feb 12, 2017 · 9 comments

Comments

@wwqgtxx
Copy link

wwqgtxx commented Feb 12, 2017

I had try on the raspbain(RaspberryPI's Linux)

root@raspberrypi:/ST# pip3.6 install git+https://github.com/MongoEngine/flask-mongoengine.git
Collecting git+https://github.com/MongoEngine/flask-mongoengine.git
  Cloning https://github.com/MongoEngine/flask-mongoengine.git to /tmp/pip-dj4yycwg-build
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-dj4yycwg-build/setup.py", line 10, in <module>
        long_description = open(doc_path).read()
      File "/usr/local/lib/python3.6/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 4182: ordinal not in range(128)

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-dj4yycwg-build/

and the windows 10

Collecting flask-mongoengine>=0.8.2
  Downloading flask-mongoengine-0.8.2.tar.gz (111kB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Administrator\AppData\Local\Temp\pycharm-packaging\flask-mongoengine\setup.py", line 10, in <module>
        long_description = open(doc_path).read()
    UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 3978: illegal multibyte sequence
    
    ----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in C:\Users\Administrator\AppData\Local\Temp\pycharm-packaging\flask-mongoengine\

But it's work fine in a standard ubuntu server 16.04.

@lafrech
Copy link
Member

lafrech commented Feb 12, 2017

Thanks for reporting.

Can you please open your Python interpreter on both platforms, execute

locale.getpreferredencoding(False)

and provide the results?

@wwqgtxx
Copy link
Author

wwqgtxx commented Feb 12, 2017

on my windows 10

import locale
locale.getpreferredencoding(False)
'cp936'

@lafrech
Copy link
Member

lafrech commented Feb 12, 2017

Another thing you could try.

On each platform, clone the repository, cd into the clone and try to install "by hand" using

python setup.py install

It should fail with the same error.

Then modify setup.py like this:

  import os
+ import io

[...]

  # Load index.rst as long_description
  doc_path = os.path.join(os.path.dirname(__file__), "docs", "index.rst")
- long_description = open(doc_path).read()
+ long_description = io.open(doc_path, encoding='utf-8').read()

And tell us how it went.

Thanks.

@wwqgtxx
Copy link
Author

wwqgtxx commented Feb 12, 2017

on raspbain

root@raspberrypi:~# python3.6
Python 3.6.0 (default, Jan 12 2017, 12:16:11)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getpreferredencoding(False)
'ANSI_X3.4-1968'
>>>

@wwqgtxx
Copy link
Author

wwqgtxx commented Feb 12, 2017

on ubuntu 16.04

python3.6
Python 3.6.0 (default, Jan 11 2017, 20:02:03)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getpreferredencoding(False)
'UTF-8'
>>>

@lafrech
Copy link
Member

lafrech commented Feb 12, 2017

Great. Then the procedure I provided might work.

@wwqgtxx
Copy link
Author

wwqgtxx commented Feb 12, 2017

the diff with

- long_description = open(doc_path).read()
+ long_description = io.open(doc_path, encoding='utf-8').read()

can work fine now.Thanks

@lafrech
Copy link
Member

lafrech commented Feb 12, 2017

You mean you installed successfully on all platforms using this fix?

If so, then we shall release a new version with this fix.

@wwqgtxx
Copy link
Author

wwqgtxx commented Feb 12, 2017

Yes,I had test on all platforms that I used, and it installed successfully.

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

No branches or pull requests

2 participants