pymc2 icon indicating copy to clipboard operation
pymc2 copied to clipboard

UnicodeDecodeError while installing for Python3.3

Open hjwp opened this issue 8 years ago • 11 comments

Just came across this

File "/usr/lib/python3.3/distutils/dist.py", line 930, in run_commands[50/4922]
  self.run_command(cmd)
File "/usr/lib/python3.3/distutils/dist.py", line 949, in run_command
  cmd_obj.run()
File "/usr/local/lib/python3.3/dist-packages/numpy/distutils/command/egg_info.p
  self.run_command("build_src")
File "/usr/lib/python3.3/distutils/cmd.py", line 313, in run_command
  self.distribution.run_command(command)
File "/usr/lib/python3.3/distutils/dist.py", line 949, in run_command
  cmd_obj.run()
File "/usr/local/lib/python3.3/dist-packages/numpy/distutils/command/build_src.
  self.build_sources()
File "/usr/local/lib/python3.3/dist-packages/numpy/distutils/command/build_src.
  self.build_extension_sources(ext)
File "/usr/local/lib/python3.3/dist-packages/numpy/distutils/command/build_src.
  sources = self.f2py_sources(sources, ext)
File "/usr/local/lib/python3.3/dist-packages/numpy/distutils/command/build_src.
  ['-m', ext_name]+f_sources)
File "/usr/local/lib/python3.3/dist-packages/numpy/f2py/f2py2e.py", line 361, i
  postlist=callcrackfortran(files, options)
File "/usr/local/lib/python3.3/dist-packages/numpy/f2py/f2py2e.py", line 283, i
  postlist=crackfortran.crackfortran(files)
File "/usr/local/lib/python3.3/dist-packages/numpy/f2py/crackfortran.py", line
  readfortrancode(files, crackline)
File "/usr/local/lib/python3.3/dist-packages/numpy/f2py/crackfortran.py", line
  l=fin.readline()
File "/usr/lib/python3.3/fileinput.py", line 354, in readline
  self._buffer = self._file.readlines(self._bufsize)
File "/usr/lib/python3.3/encodings/ascii.py", line 26, in decode
  return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 5125: ordinal not in range(128)

hjwp avatar Oct 22 '15 13:10 hjwp

Happens for pymc==2.3.2 thru pymc==2.3.6, for Python 3.4 and 3.3. Python 2.7 installs ok.

hjwp avatar Oct 22 '15 14:10 hjwp

Can you post the code that generates this error? I'd like to try to replicate it here.

fonnesbeck avatar Oct 22 '15 15:10 fonnesbeck

Just pip install pymc (in a Python 3.3/3.4 virtualenv, or use pip-3.4, or whatever is available in your env to pip install for a particular python version...)

hjwp avatar Oct 22 '15 17:10 hjwp

I can't replicate this with Anaconda Python 3.3 in a virtualenv:

Collecting pymc
  Downloading pymc-2.3.6.tar.gz (348kB)
    100% |████████████████████████████████| 352kB 414kB/s 
Building wheels for collected packages: pymc
  Running setup.py bdist_wheel for pymc
  Stored in directory: /Users/fonnescj/Library/Caches/pip/wheels/b4/12/14/094b6184fc97f474640caba446f451335daaf32c5b547e1c87
Successfully built pymc
Installing collected packages: pymc
Successfully installed pymc-2.3.6

fonnesbeck avatar Oct 22 '15 18:10 fonnesbeck

I'm on Ubuntu. I think it's fairly consistent, not something to do with my setup. I can repro it in a minimal dockerfile:

FROM ubuntu:trusty
RUN apt-get update
RUN apt-get install -y python3-dev python3-pip 
RUN apt-get install -y python3-numpy python3-matplotlib
RUN pip3 install pymc

hjwp avatar Oct 23 '15 10:10 hjwp

Here's the full output from the minimal repro run: http://pastebin.com/9SEww4CT

hjwp avatar Oct 23 '15 10:10 hjwp

when I install pymc in windows platform use “pip install pymc", it will report this error:

 File "c:\Python34\lib\site-packages\numpy\f2py\crackfortran.py", line 336, in readfortrancode
    l=fin.readline()
  File "c:\Python34\lib\fileinput.py", line 363, in readline
    self._buffer = self._file.readlines(self._bufsize)
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa1 in position 6844: illegal multibyte sequence

weijy026a avatar Oct 27 '15 15:10 weijy026a

I fixed it by setting the LANG environment variable(s):

LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=en_US.UTF-8

But it might be nice to get it working without that...

hjwp avatar Oct 28 '15 08:10 hjwp

We do have a .cfg file for Debian installs. Would it work to put these there?

fonnesbeck avatar Nov 01 '15 22:11 fonnesbeck

Ran into the same issue myself on a Mac (10.11) using Python 3.5. hjwp's environment variable fix worked for me to successfully install. https://github.com/pymc-devs/pymc/issues/62#issuecomment-151760213

mr-mcox avatar Aug 01 '16 15:08 mr-mcox

#62 (comment) did't work for me. I got the same error: UnicodeDecodeError: 'gbk' codec can't decode byte 0xa1 in position 6844: illegal multibyte sequence

mgdreamingstar avatar Aug 26 '18 04:08 mgdreamingstar