[Scons-users] import pandas into SConstruct

Bill Deegan bill at baddogconsulting.com
Fri Mar 11 10:14:26 EST 2016


Chris,

Any update?
Did this resolve your issue?

-Bill

On Thu, Mar 10, 2016 at 8:52 PM, Bill Deegan <bill at baddogconsulting.com>
wrote:

> Seems to work for me.
> Now have to make sure making that change doesn't break anything. Shouldn't
> Python 3 doesn't have cpickle it just does the right thing. Python 2 you
> need to try one and then use the other if the first isn't available.
>
> -Bill
>
> On Thu, Mar 10, 2016 at 8:24 PM, chris warth <cswarth at gmail.com> wrote:
>
>> Thanks , Bill, I'll try your fix when I get off the bus.
>>
>> $ scons --version
>> SCons by Steven Knight et al.:
>>         script: v2.4.1.rel_2.4.1:3453:73fefd3ea0b0, 2015/11/09 03:25:05,
>> by bdbaddog on ubuntu1404-32bit
>>         engine: v2.4.1.rel_2.4.1:3453:73fefd3ea0b0, 2015/11/09 03:25:05,
>> by bdbaddog on ubuntu1404-32bit
>>         engine path: ['/shared/silo_researcher
>>
>> On Thursday, March 10, 2016, Bill Deegan <bill at baddogconsulting.com>
>> wrote:
>>
>>> O.k. Try commenting out this line:
>>>
>>> around line 85 in whatever your equivalent to:
>>> /Users/bdbaddog/tmp/panda/venv/lib/python2.7/site-packages/scons-2.4.1/SCons/compat/__init__.py
>>> is.
>>>
>>> # In 3.x, 'pickle' automatically loads the fast version if available.
>>> #rename_module('pickle', 'cPickle')
>>>
>>>
>>> On Thu, Mar 10, 2016 at 8:19 PM, Bill Deegan <bill at baddogconsulting.com>
>>> wrote:
>>>
>>>> Chris,
>>>>
>>>> I see the problem. (in scons's compat.py renaming packages to prep for
>>>> py3 compatibility).
>>>> Which version of SCons are you using?
>>>>
>>>> -Bill
>>>>
>>>> On Thu, Mar 10, 2016 at 8:12 PM, chris warth <cswarth at gmail.com> wrote:
>>>>
>>>>> Thanks!  If it's any help, I've reduced the example to one that
>>>>> doesn't involve pandas at all.  It seems that under scons, 'pkl.Unpickler'
>>>>> is a function rather than a class.
>>>>>
>>>>> $ cat scons.py
>>>>>
>>>>> import pickle as pkl
>>>>> print type(pkl.Unpickler)
>>>>>
>>>>> class Unpickler(pkl.Unpickler):
>>>>>     pass
>>>>>
>>>>> $ python scons.py
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> <type 'classobj'>
>>>>>
>>>>> $ scons -f scons.py
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> scons: Reading SConscript files ...
>>>>> <type 'builtin_function_or_method'>
>>>>> TypeError: Error when calling the metaclass bases
>>>>>     cannot create 'builtin_function_or_method' instances:
>>>>>   File "/path/explore/scons.py", line 5:
>>>>>     class Unpickler(pkl.Unpickler):
>>>>>
>>>>>
>>>>> On Thu, Mar 10, 2016 at 5:09 PM, Bill Deegan <
>>>>> bill at baddogconsulting.com> wrote:
>>>>>
>>>>>> Just built a virtualenv with pandas and scons.
>>>>>> Get same stack trace.
>>>>>> Let me take a quick look and see if it's something simple.
>>>>>>
>>>>>> -Bill
>>>>>>
>>>>>> On Thu, Mar 10, 2016 at 7:49 PM, William Blevins <
>>>>>> wblevins001 at gmail.com> wrote:
>>>>>>
>>>>>>> See inline.
>>>>>>>
>>>>>>> On Thu, Mar 10, 2016 at 10:39 PM, chris warth <cswarth at gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> I am having trouble importing the pandas package into an SConstruct
>>>>>>>> file.
>>>>>>>> Can anyone confirm if this is real defect or just something in my
>>>>>>>> environment?
>>>>>>>>
>>>>>>>> Thanks for any help,
>>>>>>>>
>>>>>>>> - Chris
>>>>>>>>
>>>>>>>>
>>>>>>>> $ cat >scons.test
>>>>>>>>> import pandas as pd
>>>>>>>>> ^D
>>>>>>>>> $ scons -f scons.test
>>>>>>>>> scons: Reading SConscript files ...
>>>>>>>>> TypeError: Error when calling the metaclass bases
>>>>>>>>>     cannot create 'builtin_function_or_method' instances:
>>>>>>>>>   File "/path/explore/scons.test", line 1:
>>>>>>>>>     import pandas as pd
>>>>>>>>>   File
>>>>>>>>> "/path/venv/local/lib/python2.7/site-packages/pandas/__init__.py", line 48:
>>>>>>>>>     from pandas.io.api import *
>>>>>>>>>   File
>>>>>>>>> "/path/venv/local/lib/python2.7/site-packages/pandas/io/api.py", line 14:
>>>>>>>>>     from pandas.io.pickle import read_pickle, to_pickle
>>>>>>>>>   File
>>>>>>>>> "/path/venv/local/lib/python2.7/site-packages/pandas/io/pickle.py", line 1:
>>>>>>>>>     from pandas.compat import cPickle as pkl, pickle_compat as pc,
>>>>>>>>> PY3
>>>>>>>>>   File
>>>>>>>>> "/path/venv/local/lib/python2.7/site-packages/pandas/compat/pickle_compat.py",
>>>>>>>>> line 57:
>>>>>>>>>     class Unpickler(pkl.Unpickler):
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> This error isn't coming from SCons. This error is coming from trying
>>>>>>> to import from the pandas library. Right? Is the version of pandas
>>>>>>> installed setup for python3 rather than python2?
>>>>>>>
>>>>>>>
>>>>>>>> $ python --version
>>>>>>>>> Python 2.7.6
>>>>>>>>> $ scons --version
>>>>>>>>> SCons by Steven Knight et al.:
>>>>>>>>>         script: v2.4.1.rel_2.4.1:3453:73fefd3ea0b0, 2015/11/09
>>>>>>>>> 03:25:05, by bdbaddog on ubuntu1404-32bit
>>>>>>>>>         engine: v2.4.1.rel_2.4.1:3453:73fefd3ea0b0, 2015/11/09
>>>>>>>>> 03:25:05, by bdbaddog on ubuntu1404-32bit
>>>>>>>>>         engine path:
>>>>>>>>> ['/shared/silo_researcher/Matsen_F/MatsenGrp/working/cwarth/founder-inference-bakeoff/venv/lib/scons-2.4.1/SCons']
>>>>>>>>> Copyright (c) 2001 - 2015 The SCons Foundation
>>>>>>>>> $ python -c 'import pandas as pd; print pd.__version__'
>>>>>>>>> 0.17.1
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Scons-users mailing list
>>>>>>>> Scons-users at scons.org
>>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Scons-users mailing list
>>>>>>> Scons-users at scons.org
>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Scons-users mailing list
>>>>>> Scons-users at scons.org
>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Scons-users mailing list
>>>>> Scons-users at scons.org
>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>
>>>>>
>>>>
>>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20160311/dfdfae9e/attachment-0001.html>


More information about the Scons-users mailing list