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

Can't install pendulum unless locale is set to UTF-8 #365

Closed
joar opened this issue Apr 12, 2019 · 6 comments
Closed

Can't install pendulum unless locale is set to UTF-8 #365

joar opened this issue Apr 12, 2019 · 6 comments

Comments

@joar
Copy link

joar commented Apr 12, 2019

To reproduce, run:

env LC_ALL=C pip install --no-cache -I pendulum==2.0.4
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting pendulum==2.0.4
  Downloading https://files.pythonhosted.org/packages/5b/57/71fc910edcd937b72aa0ef51c8f5734fbd8c011fa1480fce881433847ec8/pendulum-2.0.4.tar.gz (75kB)
    100% |################################| 81kB 2.5MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... error
    Complete output from command /home/joar/.virtualenvs/pendulum/bin/python2.7 /home/joar/.virtualenvs/pendulum/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpyu2VCb:
    Traceback (most recent call last):
      File "/home/joar/.virtualenvs/pendulum/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
        main()
      File "/home/joar/.virtualenvs/pendulum/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/home/joar/.virtualenvs/pendulum/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 69, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "/tmp/pip-build-env-emNFZt/overlay/lib/python2.7/site-packages/poetry/masonry/api.py", line 49, in prepare_metadata_for_build_wheel
        builder._write_metadata_file(f)
      File "/tmp/pip-build-env-emNFZt/overlay/lib/python2.7/site-packages/poetry/masonry/builders/wheel.py", line 314, in _write_metadata_file
        fp.write(decode(self.get_metadata_content()))
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 178: ordinal not in range(128)
    
    ----------------------------------------
Command "/home/joar/.virtualenvs/pendulum/bin/python2.7 /home/joar/.virtualenvs/pendulum/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpyu2VCb" failed with error code 1 in /tmp/pip-install-gZc9To/pendulum

The root cause seems to be in poetry, I've filed a separate issue there: python-poetry/poetry#1030.

A quick fix for pendulum would be to either change the build-system requirement to poetry==0.12.11 or remove the é in pyproject.toml.

@yaoguoba
Copy link

I faced the same.

@andrewschultz
Copy link
Contributor

I have Windows 7 and am seeing the same error.

2.0.4 didn't work, but I was able to get things to work easily enough by installing a slightly older version.

pip install pendulum==2.0.2

So that may help narrow down what is going wrong, since Windows users don't seem to be able to set the locale so easily to UTF8. (Would a link to how to do this in the FAQ be appropriate, in case this is a really tricky bug that is prone to happen again?

@Vaelek
Copy link

Vaelek commented Apr 26, 2019

Rather than install an older version of pendulum, I had 2.0.4 installed on another machine and finally narrowed the magic down to the pip version. If you do easy_install pip==18.1 then you will be able to install the latest version of pendulum, and go back to the current pip if you like afterwards.

@vlcinsky
Copy link

vlcinsky commented May 7, 2019

Shall be fixed by poetry's PR python-poetry/poetry#1085

Both pendulum versions 2.0.2 as well as 2.0.4 include special character é in there:

authors = [
    "Sébastien Eustace <sebastien@eustace.io>"
]

pendulum==2.0.4 includes [build-system] in pyproject.toml:

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

pendulum==2.0.2 does not include [build-system] in pyproject.toml

Installing pendulum using a wheel works well as the problem is building the wheel properly and not installing the wheel.

Building pendulum==2.0.4 on Linux can fail, if you set other than UTF-8 console encoding.

Problem is in poetry, which created text files without explicit encoding, thus using default system encoding.

@kamichal
Copy link

Exactly the same problem with Debian9, python 2.7. Unable to run tox test suite that has pendulum as a dependency of one of mine deps. Tox fails on installdeps step.

Installing pendulum with explicit command works:

pip install pendulum

but

pip install -r requirements.txt

does not.

      File "/tmp/pip-build-env-ydB1WE/overlay/lib/python2.7/site-packages/poetry/masonry/builders/wheel.py", line 314, in _write_metadata_file
        fp.write(decode(self.get_metadata_content()))
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 178: ordinal not in range(128)

Wooble added a commit to pitthsls/pycounter that referenced this issue May 22, 2019
Should be unpinned if sdispater/pendulum#365
is ever fixed, but right now pycounter won't install cleanly on
Windows (including on Appveyor) or anywhere the locale isn't set to
use UTF-8.
@sdispater
Copy link
Owner

This is now fixed with the release of the new Poetry version

cicdw added a commit to PrefectHQ/prefect that referenced this issue Jul 28, 2019
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

7 participants