Navigation Menu

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

pip install mayavi fail #354

Closed
kitchoi opened this issue Apr 22, 2016 · 10 comments
Closed

pip install mayavi fail #354

kitchoi opened this issue Apr 22, 2016 · 10 comments
Assignees
Labels

Comments

@kitchoi
Copy link
Contributor

kitchoi commented Apr 22, 2016

In a clean virtual environment (with Python 2.7, Linux 64bit), checking out the repository and do python setup.py install works, but not with pip install.

Assuming you have installed vtk as well (here I tried vtkPython 6.3.0 downloaded from vtk.org)

$ pip install numpy
$ pip install mayavi

...[skip many lines]...
  ----------------------------------------------------------------------
  Building TVTK classes... vtkGeoTreeNode: Ignoring method: Get/SetStatus
  default: 0, range: None

...[skip more lines]...

  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-TXVQcu/mayavi/setup.py", line 476, in <module>
      **config
    File "/home/kit/.virtualenvs/test/local/lib/python2.7/site-packages/numpy/distutils/core.py", line 169, in setup
      return old_setup(**new_attr)
    File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
      dist.run_commands()
    File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/home/kit/.virtualenvs/test/local/lib/python2.7/site-packages/wheel/bdist_wheel.py", line 179, in run
      self.run_command('build')
    File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-TXVQcu/mayavi/setup.py", line 308, in run
      build_tvtk_classes_zip()
    File "/tmp/pip-build-TXVQcu/mayavi/setup.py", line 294, in build_tvtk_classes_zip
      gen_tvtk_classes_zip()
    File "tvtk/setup.py", line 66, in gen_tvtk_classes_zip
      import numpy
    File "/tmp/pip-build-TXVQcu/mayavi/tvtk/code_gen.py", line 117, in generate_code
      self._write_wrapper_class(node, tvtk_name)
    File "/tmp/pip-build-TXVQcu/mayavi/tvtk/code_gen.py", line 207, in _write_wrapper_class
      self.wrap_gen.generate_code(node, out)
    File "/tmp/pip-build-TXVQcu/mayavi/tvtk/wrapper_gen.py", line 84, in generate_code
      self._gen_methods(node, out)
    File "/tmp/pip-build-TXVQcu/mayavi/tvtk/wrapper_gen.py", line 195, in _gen_methods
      get_set = self._gen_get_set_methods(klass, out)
    File "/tmp/pip-build-TXVQcu/mayavi/tvtk/wrapper_gen.py", line 702, in _gen_get_set_methods
      print("default: %s, range: None"%default)
  UnicodeEncodeError: 'ascii' codec can't encode character u'\U000a000d' in position 9: ordinal not in range(128)
@stefanoborini stefanoborini self-assigned this Apr 25, 2016
@stefanoborini
Copy link
Contributor

Working on it.

@stefanoborini
Copy link
Contributor

I tried to reproduce the problem but I could not. Checking on your computer.

@stefanoborini
Copy link
Contributor

stefanoborini commented Apr 25, 2016

Again, unable to reproduce, but I see the potential for a problem. pull request #355 should solve.

@stefanoborini
Copy link
Contributor

PR merged. Closing

@ashgillman
Copy link

As far as I can tell this should be fixed in 4.5.0? I am having a similar issue:

----------------------------------------------------------------------
Building TVTK classes... vtkContextDevice2D: Ignoring method: Get/SetViewportRect
default: [0, 0, 0, 0], range: None
vtkContextDevice2D: Ignoring method: Get/SetViewportSize
default: [-134528976, 32767], range: None
vtkGeoTreeNode: Ignoring method: Get/SetStatus
default: 0, range: None
vtkIncrementalForceLayout: Ignoring method: Get/SetGravityPoint
default: [200.0, 200.0], range: None
vtkOpenGLBufferObject: Ignoring method: Get/SetType
default: 0, range: None
vtkRenderWidget: Ignoring method: Get/SetPosition
default: [0, 0], range: None
vtkRenderWidget: Ignoring method: Get/SetSize
default: [300, 300], range: None
vtkShader: Ignoring method: Get/SetType
default: 3, range: None
vtkChartMatrix: Ignoring method: Get/SetGutter
default: [15.0, 15.0], range: None
vtkChartMatrix: Ignoring method: Get/SetSize
default: [0, 0], range: None
vtkContextArea: Ignoring method: Get/SetDrawAreaBounds
default: [0.0, 0.0, 300.0, 300.0], range: None
vtkContextArea: Ignoring method: Get/SetFixedRect
default: [0, 0, 300, 300], range: None
vtkContextArea: Ignoring method: Get/SetGeometry
default: [0, 0, 300, 300], range: None
vtkContextArea: Ignoring method: Get/SetDrawAreaResizeBehavior
default: 0, range: None
vtkContextArea: Ignoring method: Get/SetFixedMargins
default: [0, 0, 0, 0], range: None
Traceback (most recent call last):
  File "nix_run_setup.py", line 6, in <module>
    exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
  File "setup.py", line 499, in <module>
  File "/nix/store/2l4p7w0km7c9lz7cxwkxkly6akiwpafs-python3.4-numpy-1.10.4/lib/python3.4/site-packages/numpy/distutils/core.py", line 169, in setup
    return old_setup(**new_attr)
  File "/nix/store/g7fvvd84gkdpxfc1xah4m05nxsf6xbyp-python3-3.4.5/lib/python3.4/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/nix/store/g7fvvd84gkdpxfc1xah4m05nxsf6xbyp-python3-3.4.5/lib/python3.4/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/nix/store/g7fvvd84gkdpxfc1xah4m05nxsf6xbyp-python3-3.4.5/lib/python3.4/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/nix/store/jsn7asadxjb65qh47vnlc5435n9k2w19-python-3.4.5-bootstrapped-pip-8.0.2/lib/python3.4/site-packages/wheel/bdist_wheel.py", line 179, in run
    self.run_command('build')
  File "/nix/store/g7fvvd84gkdpxfc1xah4m05nxsf6xbyp-python3-3.4.5/lib/python3.4/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/nix/store/g7fvvd84gkdpxfc1xah4m05nxsf6xbyp-python3-3.4.5/lib/python3.4/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "setup.py", line 311, in run
  File "setup.py", line 297, in build_tvtk_classes_zip
  File "tvtk/setup.py", line 66, in gen_tvtk_classes_zip
    gen.generate_code()
  File "/tmp/nix-build-python3.4-mayavi-4.5.0.drv-0/mayavi-4.5.0-src/tvtk/code_gen.py", line 123, in generate_code
    self._write_wrapper_class(node, tvtk_name)
  File "/tmp/nix-build-python3.4-mayavi-4.5.0.drv-0/mayavi-4.5.0-src/tvtk/code_gen.py", line 210, in _write_wrapper_class
    self.wrap_gen.generate_code(node, out)
  File "/tmp/nix-build-python3.4-mayavi-4.5.0.drv-0/mayavi-4.5.0-src/tvtk/wrapper_gen.py", line 243, in generate_code
    self._gen_class_init(node, out)
  File "/tmp/nix-build-python3.4-mayavi-4.5.0.drv-0/mayavi-4.5.0-src/tvtk/wrapper_gen.py", line 315, in _gen_class_init
    self.dm.write_class_doc(klass.__doc__, out, indent)
  File "/tmp/nix-build-python3.4-mayavi-4.5.0.drv-0/mayavi-4.5.0-src/tvtk/indenter.py", line 169, in write_class_doc
    out.write(indent.format('\n' + ret))
UnicodeEncodeError: 'ascii' codec can't encode character '\xfc' in position 447: ordinal not in range(128)

I believe \xfc is a u with an umlaut.

@mpesavento
Copy link

I am having a similar problem, again with using pip install of mayavi 4.5.
I have built VTK 7.1.1 on ubuntu 16.04 with python 3.5.
On pip3 install mayavi, I get a UnicodeEncodeError.
It looks like something in the writer is expecting an encoding other than UTF-8, while default python3 encoder is UTF-8. This may be a translation problem from py2 to py3.

  Running setup.py install for mayavi ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-b59tvpug/mayavi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-s8qedh_6-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    ----------------------------------------------------------------------
    Building TVTK classes... vtkContextDevice2D: Ignoring method: Get/SetViewportSize
    default: [3306096, 32658], range: None
    vtkContextDevice2D: Ignoring method: Get/SetViewportRect
    default: [3301168, 32658, 3305592, 32658], range: None
    vtkFXAAOptions: Ignoring method: Get/SetDebugOptionValue
    default: 0, range: None
    vtkGeoTreeNode: Ignoring method: Get/SetStatus
    default: 0, range: None
    vtkIncrementalForceLayout: Ignoring method: Get/SetGravityPoint
    default: [200.0, 200.0], range: None
    vtkOpenGLBufferObject: Ignoring method: Get/SetType
    default: 0, range: None
    vtkRenderWidget: Ignoring method: Get/SetSize
    default: [300, 300], range: None
    vtkRenderWidget: Ignoring method: Get/SetPosition
    default: [0, 0], range: None
    vtkShader: Ignoring method: Get/SetType
    default: 3, range: None
    vtkChartMatrix: Ignoring method: Get/SetSize
    default: [0, 0], range: None
    vtkChartMatrix: Ignoring method: Get/SetGutter
    default: [15.0, 15.0], range: None
    vtkContextArea: Ignoring method: Get/SetDrawAreaBounds
    default: [0.0, 0.0, 300.0, 300.0], range: None
    vtkContextArea: Ignoring method: Get/SetGeometry
    default: [0, 0, 300, 300], range: None
    vtkContextArea: Ignoring method: Get/SetFixedMargins
    default: [0, 0, 0, 0], range: None
    vtkContextArea: Ignoring method: Get/SetDrawAreaResizeBehavior
    default: 0, range: None
    vtkContextArea: Ignoring method: Get/SetFixedRect
    default: [0, 0, 300, 300], range: None
    vtkOpenGLVertexBufferObject: Ignoring method: Get/SetCoordShiftAndScaleMethod
    default: 1, range: None
    vtkSimple3DCirclesStrategy: Ignoring method: Get/SetMarkedValue
    default: (invalid), range: None
    vtkArrayNorm: Ignoring method: Get/SetWindow
    default: [0, 9223372036854775807), range: None
    vtkChart: Ignoring method: Get/SetSize
    default: [0.0, 0.0, 0.0, 0.0], range: None
    vtkChartXYZ: Ignoring method: Get/SetAxisColor
    default: [0, 0, 0, 255], range: None
    vtkLightingMapPass: Ignoring method: Get/SetRenderType
    default: 0, range: None
    vtkPlot: Ignoring method: Get/SetShiftScale
    default: [0.0, 0.0, 1.0, 1.0], range: None
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-b59tvpug/mayavi/setup.py", line 499, in <module>
        **config
      File "/usr/local/lib/python3.5/dist-packages/numpy/distutils/core.py", line 169, in setup
        return old_setup(**new_attr)
      File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.5/dist-packages/numpy/distutils/command/install.py", line 62, in run
        r = self.setuptools_run()
      File "/usr/local/lib/python3.5/dist-packages/numpy/distutils/command/install.py", line 36, in setuptools_run
        return distutils_install.run(self)
      File "/usr/lib/python3.5/distutils/command/install.py", line 583, in run
        self.run_command('build')
      File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-b59tvpug/mayavi/setup.py", line 311, in run
        build_tvtk_classes_zip()
      File "/tmp/pip-build-b59tvpug/mayavi/setup.py", line 297, in build_tvtk_classes_zip
        gen_tvtk_classes_zip()
      File "tvtk/setup.py", line 66, in gen_tvtk_classes_zip
        from setuptools import Command
      File "/tmp/pip-build-b59tvpug/mayavi/tvtk/code_gen.py", line 123, in generate_code
        self._write_wrapper_class(node, tvtk_name)
      File "/tmp/pip-build-b59tvpug/mayavi/tvtk/code_gen.py", line 210, in _write_wrapper_class
        self.wrap_gen.generate_code(node, out)
      File "/tmp/pip-build-b59tvpug/mayavi/tvtk/wrapper_gen.py", line 246, in generate_code
        self._gen_methods(node, out)
      File "/tmp/pip-build-b59tvpug/mayavi/tvtk/wrapper_gen.py", line 365, in _gen_methods
        self._gen_other_methods(klass, out)
      File "/tmp/pip-build-b59tvpug/mayavi/tvtk/wrapper_gen.py", line 909, in _gen_other_methods
        self._write_tvtk_method(klass, out, vtk_meth)
      File "/tmp/pip-build-b59tvpug/mayavi/tvtk/wrapper_gen.py", line 1282, in _write_tvtk_method
        self._write_generic_method(out, decl, vtk_meth, body)
      File "/tmp/pip-build-b59tvpug/mayavi/tvtk/wrapper_gen.py", line 1303, in _write_generic_method
        out.write(indent.format('"""\n' + doc + '"""\n'))
    UnicodeEncodeError: 'latin-1' codec can't encode character '\u2013' in position 315: ordinal not in range(256)

@satra
Copy link

satra commented Aug 14, 2017

i'm getting this error as well on py36, numpy

UnicodeEncodeError: 'ascii' codec can't encode character '\xfc' in position \
447: ordinal not in range(128)

environment details (debian:stretch)

# packages in environment at /opt/conda/envs/neuro:
#
altair                    1.2.0                    py36_0    conda-forge
appdirs                   1.4.3                     <pip>
apptools                  4.4.0                    py36_0    conda-forge
asn1crypto                0.22.0                   py36_0    conda-forge
blas                      1.1                    openblas    conda-forge
bleach                    1.5.0                    py36_0    conda-forge
boto                      2.48.0                    <pip>
ca-certificates           2017.7.27.1                   0    conda-forge
certifi                   2017.7.27.1              py36_0    conda-forge
cffi                      1.10.0                   py36_0    conda-forge
chardet                   3.0.2                    py36_1    conda-forge
configobj                 5.0.6                    py36_0    defaults
cryptography              1.9                      py36_0    conda-forge
cycler                    0.10.0                   py36_0    conda-forge
datalad                   0.8.1                     <pip>
dbus                      1.10.10                       3    conda-forge
decorator                 4.1.2                    py36_0    conda-forge
entrypoints               0.2.3                    py36_1    conda-forge
expat                     2.2.1                         0    conda-forge
fontconfig                2.12.1                        4    conda-forge
freetype                  2.7                           1    conda-forge
future                    0.16.0                   py36_0    conda-forge
gettext                   0.19.7                        1    conda-forge
gitdb2                    2.0.2                     <pip>
GitPython                 2.1.5                     <pip>
glib                      2.51.4                        0    conda-forge
gmp                       6.1.2                         0    conda-forge
gst-plugins-base          1.8.0                         0    conda-forge
gstreamer                 1.8.0                         2    conda-forge
hdf5                      1.8.18                        0    conda-forge
html5lib                  0.9999999                py36_0    conda-forge
humanize                  0.5.1                     <pip>
icu                       58.1                          1    conda-forge
idna                      2.5                      py36_0    conda-forge
ipykernel                 4.6.1                    py36_0    conda-forge
ipython                   6.1.0                    py36_0    conda-forge
ipython_genutils          0.2.0                    py36_0    conda-forge
ipywidgets                6.0.0                    py36_0    conda-forge
iso8601                   0.1.12                    <pip>
jedi                      0.10.2                   py36_0    conda-forge
jinja2                    2.9.5                    py36_0    conda-forge
jpeg                      9b                            0    conda-forge
jsmin                     2.2.2                     <pip>
jsoncpp                   0.10.6                        1    conda-forge
jsonschema                2.5.1                    py36_0    conda-forge
jupyter                   1.0.0                    py36_0    conda-forge
jupyter_client            5.1.0                    py36_0    conda-forge
jupyter_console           5.1.0                    py36_0    conda-forge
jupyter_core              4.3.0                    py36_0    conda-forge
jupyterlab                0.26.5                   py36_0    conda-forge
jupyterlab_launcher       0.3.1                    py36_0    conda-forge
keyring                   10.4.0                    <pip>
keyrings.alt              2.2                       <pip>
libffi                    3.2.1                         3    conda-forge
libgfortran               3.0.0                         1    defaults
libiconv                  1.14                          4    conda-forge
libpng                    1.6.28                        0    conda-forge
libsodium                 1.0.10                        0    conda-forge
libtiff                   4.0.6                         7    conda-forge
libxcb                    1.12                          1    conda-forge
libxml2                   2.9.4                         4    conda-forge
markupsafe                1.0                      py36_0    conda-forge
matplotlib                2.0.2                    py36_2    conda-forge
mistune                   0.7.4                    py36_0    conda-forge
mock                      2.0.0                     <pip>
msgpack-python            0.4.8                     <pip>
nbconvert                 5.2.1                    py36_1    conda-forge
nbformat                  4.3.0                    py36_0    conda-forge
ncurses                   5.9                          10    conda-forge
nibabel                   2.1.0                     <pip>
nilearn                   0.3.1                     <pip>
notebook                  5.0.0                    py36_0    conda-forge
numpy                     1.13.1          py36_blas_openblas_200  [blas_openblas]  conda-forge
openblas                  0.2.19                        2    conda-forge
openssl                   1.0.2l                        0    conda-forge
pandas                    0.20.3                   py36_1    conda-forge
pandoc                    1.19.2                        0    conda-forge
pandocfilters             1.4.1                    py36_0    conda-forge
patool                    1.12                      <pip>
patsy                     0.4.1                    py36_0    conda-forge
pbr                       3.1.1                     <pip>
pcre                      8.39                          0    conda-forge
pexpect                   4.2.1                    py36_0    conda-forge
pickleshare               0.7.3                    py36_0    conda-forge
pip                       9.0.1                    py36_0    conda-forge
prompt_toolkit            1.0.15                   py36_0    conda-forge
ptyprocess                0.5.2                    py36_0    conda-forge
pycparser                 2.18                     py36_0    conda-forge
pyface                    5.1.0                    py36_0    defaults
PyGithub                  1.35                      <pip>
pygments                  2.2.0                    py36_0    conda-forge
PyJWT                     1.5.2                     <pip>
PyLD                      0.7.2                     <pip>
pyopenssl                 16.2.0                   py36_0    conda-forge
pyparsing                 2.2.0                    py36_0    conda-forge
pyqt                      5.6.0                    py36_4    conda-forge
pysocks                   1.6.7                    py36_0    conda-forge
python                    3.6.2                         0    conda-forge
python-dateutil           2.6.1                    py36_0    conda-forge
pytz                      2017.2                   py36_0    conda-forge
pyyaml                    3.12                     py36_1    conda-forge
pyzmq                     16.0.2                   py36_2    conda-forge
qt                        5.6.2                         3    conda-forge
qtconsole                 4.3.1                    py36_0    conda-forge
readline                  6.2                           0    conda-forge
reprounzip                1.0.9                    py36_0    conda-forge
reprozip                  1.0.9                    py36_0    conda-forge
requests                  2.18.3                   py36_0    conda-forge
rpaths                    0.12                     py36_0    conda-forge
scikit-learn              0.19.0          py36_blas_openblas_201  [blas_openblas]  conda-forge
scipy                     0.19.1          py36_blas_openblas_202  [blas_openblas]  conda-forge
seaborn                   0.8.0                    py36_0    conda-forge
SecretStorage             2.3.1                     <pip>
setuptools                36.2.2                   py36_0    conda-forge
simplegeneric             0.8.1                    py36_0    conda-forge
simplejson                3.11.1                    <pip>
sip                       4.18                     py36_1    conda-forge
six                       1.10.0                   py36_1    conda-forge
smmap2                    2.0.3                     <pip>
sqlite                    3.13.0                        1    conda-forge
statsmodels               0.8.0               np113py36_0    conda-forge
terminado                 0.6                      py36_0    conda-forge
testpath                  0.3                      py36_0    conda-forge
tk                        8.5.19                        2    conda-forge
tornado                   4.5.1                    py36_0    conda-forge
tqdm                      4.15.0                    <pip>
traitlets                 4.3.2                    py36_0    conda-forge
traits                    4.6.0                    py36_1    conda-forge
traitsui                  5.1.0                    py36_0    conda-forge
urllib3                   1.21.1                   py36_1    conda-forge
usagestats                0.5                      py36_0    conda-forge
vega                      0.4.4                    py36_1    conda-forge
vtk                       7.1.1                    py36_0    conda-forge
wcwidth                   0.1.7                    py36_0    conda-forge
webencodings              0.5                      py36_0    conda-forge
wheel                     0.29.0                   py36_0    conda-forge
widgetsnbextension        2.0.0                    py36_0    conda-forge
wrapt                     1.10.11                   <pip>
xorg-libxau               1.0.8                         3    conda-forge
xorg-libxdmcp             1.1.2                         3    conda-forge
xz                        5.2.2                         0    conda-forge
yaml                      0.1.6                         0    conda-forge
zeromq                    4.2.1                         1    conda-forge
zlib                      1.2.11                        0    conda-forge

@satra
Copy link

satra commented Aug 14, 2017

this was resolved by setting the following environment variable: LC_ALL=C.UTF-8

@subhacom
Copy link

subhacom commented Dec 4, 2017

I had the same issue with Python 3.6.3 on Windows-7 and set LC_ALL=C.UTF-8 in the command line did not help. I manually edited the source code in the file tvtk/code_gen.py to replace all
open(<filename>, 'w')
to
open(<filename>, 'w', encoding='utf-8')

and then did a pip install <sourcedir> to work around that.

@bosmacs
Copy link

bosmacs commented Dec 13, 2017

Same issue here, Win7, Python 3.6 (Anaconda 4.4). I installed the binary wheel of VTK from PyPI.

@subhacom Thanks for the workaround.

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

No branches or pull requests

7 participants