DinoTools / python-overpy

Python Wrapper to access the Overpass API
https://python-overpy.readthedocs.io/
MIT License
243 stars 58 forks source link

unable to install on Fedora 24, with pip, Python3 #37

Closed absudabsu closed 8 years ago

absudabsu commented 8 years ago

pip3 install fails:

$ sudo pip3 install overpy                                                                                     
Collecting overpy                                                                                                                   
  Using cached overpy-0.3.1.tar.gz                                                                                                  
    Complete output from command python setup.py egg_info:                                                                          
    Traceback (most recent call last):                                                                                              
      File "<string>", line 1, in <module>                                                                                          
      File "/tmp/pip-build-e9c50bzk/overpy/setup.py", line 12, in <module>                                                          
        long_description = f.read()                                                                                                 
      File "/usr/lib64/python3.5/encodings/ascii.py", line 26, in decode                                                            
        return codecs.ascii_decode(input, self.errors)[0]                                                                           
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1883: ordinal not in range(128)                            

    ----------------------------------------                                                                                        
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-e9c50bzk/overpy                                       
You are using pip version 8.0.2, however version 8.1.2 is available.                                                                
You should consider upgrading via the 'pip install --upgrade pip' command.       

but it works for python2

$ sudo pip install overpy                                                                                      
Collecting overpy                                                                                                                   
  Using cached overpy-0.3.1.tar.gz                                                                                                  
Installing collected packages: overpy                                                                                               
  Running setup.py install for overpy ... done                                                                                      
Successfully installed overpy-0.3.1                                                                                                 
You are using pip version 8.0.2, however version 8.1.2 is available.                                                                
You should consider upgrading via the 'pip install --upgrade pip' command.                                                          

Any ideas?

phibos commented 8 years ago

Looks like the default encoding on your system is set to ASCII instead of UTF-8. This issue will be fixed in the next release.

phibos commented 8 years ago

I could reproduce the error by setting the LC_CTYPE environment variable to C.

LC_CTYPE=C python setup.py build 
Traceback (most recent call last):
  File "setup.py", line 18, in <module>
    long_description = fp.read()
  File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1883: ordinal not in range(128)
absudabsu commented 8 years ago

Thanks, I figured as much, but didn't think to check the src. As a sidenote, is this a python default or system default?

phibos commented 8 years ago

From the Python 3 Docs

In text mode, if encoding is not specified the encoding used is platform dependent: locale.getpreferredencoding(False) is called to get the current locale encoding.

During the setup/build process the README.rst is read to provide the long description for the package. There are some UTF-8 characters in this file. That's why the build process fails on systems that don't use UTF-8 as their default encoding.

phibos commented 8 years ago

I have merged a fix and it should be available in the next release.

absudabsu commented 8 years ago

Thanks for your help. I was wondering if you knew when the next release would be?

absudabsu commented 8 years ago

Also, I'm not sure its an default encoding issue, since:

$ python3 -c 'import sys; print(sys.getdefaultencoding())'
utf-8
$ sudo pip3 install overpy
Collecting overpy                                                                                                                   
  Using cached overpy-0.3.1.tar.gz                                                                                                  
    Complete output from command python setup.py egg_info:                                                                          
    Traceback (most recent call last):                                                                                              
      File "<string>", line 1, in <module>                                                                                          
      File "/tmp/pip-build-5m016bco/overpy/setup.py", line 12, in <module>                                                          
        long_description = f.read()                                                                                                 
      File "/usr/lib64/python3.5/encodings/ascii.py", line 26, in decode                                                            
        return codecs.ascii_decode(input, self.errors)[0]                                                                           
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1883: ordinal not in range(128)                                                                                                                 
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5m016bco/overpy                                       
You are using pip version 8.0.2, however version 8.1.2 is available.                                                                
You should consider upgrading via the 'pip install --upgrade pip' command

Maybe pip3 relies on python2?:

$ python -c 'import sys; print(sys.getdefaultencoding())'
ascii

That doesn't make sense to me, though.