user1971989
user1971989

Reputation: 121

The error of importing Enthought Package without using Canopy

I try to use enthought package without iPython, Canopy.

I download traits, traitsui, enthought...etc package. However, it calls back the ctraits error when I put the folder in /Lib.

After I download ctraits from https://github.com/enthought/ctraits,

there still has problem. When I import enthought.traits.api or trais.api

the error message is

Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
   import enthought.traits.api
File "C:\Python27\lib\enthought\traits\api.py", line 3, in <module>
from traits.api import *
File "<pyshell#0>", line 1, in <module>
   import enthought.traits.api
File "C:\Python27\lib\enthought\traits\api.py", line 3, in <module>
    from traits.api import *
File "C:\Python27\lib\traits\api.py", line 107, in <module>
    from traitsui import view_elements
File "C:\Python27\lib\traitsui\view_elements.py", line 201, in <module>
    class SearchStackItem ( HasStrictTraits ):
File "C:\Python27\lib\traits\has_traits.py", line 426, in __new__
    mhto = MetaHasTraitsObject( cls, class_name, bases, class_dict, False )
File "C:\Python27\lib\traits\has_traits.py", line 497, in __init__
    value = _check_trait( value )
File "C:\Python27\lib\traits\has_traits.py", line 340, in _check_trait
    return trait.as_ctrait()
File "C:\Python27\lib\traits\trait_handlers.py", line 597, in as_ctrait
    trait.set_validate( validate )
File "C:\Python27\lib\traits\ctraits.py", line 714, in set_validate
    raise ValueError("The argument must be a tuple or callable")
ValueError: The argument must be a tuple or callable

does anyone has related experience to use Traits, Enthought package without Canopy or Ipython?

Upvotes: 0

Views: 364

Answers (1)

jonathanrocher
jonathanrocher

Reputation: 1208

To install ETS the best link is http://code.enthought.com/downloads/. If you don't want to install Canopy, the easiest way is to install Traits from PyPI using pip or easy_install. The most manual way requires for you to clone the entire repository (at https://github.com/enthought/traits) and build it with

python setup.py develop

This will require a C compiler. Downloading individual files and manually placing them places is highly likely to fail.

One final note: the enthought namespace has been deprecated and now you can/should simply import traits, traitsui or chaco directly, for example:

from traits.api import HasTraits

Hope this helps.

Upvotes: 1

Related Questions