SyntaxError: unqualified exec is not allowed in function 'test_EvalEnvironment_capture_flag #1108

Closed
hkok opened this Issue Oct 9, 2013 · 5 comments

Projects

None yet

2 participants

@hkok
hkok commented Oct 9, 2013

I am getting SyntaxError building the statsmodel package. I am not sure if this is a patsy bug or statsmodel. Can someone verify this? Thanks.

python 2.7.5 (stable)
patsy version 0.21 (latest)
statsmodels 0.50 (stable)

/usr/pkg/python/current/bin/python2.7 setup.py build

Traceback (most recent call last):
File "setup.py", line 463, in
check_dependency_versions(min_versions)
File "setup.py", line 120, in check_dependency_versions
from patsy import version as patsy_version
File "build/bdist.linux-x86_64/egg/patsy/init.py", line 77, in
File "build/bdist.linux-x86_64/egg/patsy/highlevel.py", line 19, in
File "/usr/pkg/python/current/lib/python2.7/site-packages/patsy-0.2.1-py2.7.egg/patsy/eva
SyntaxError: unqualified exec is not allowed in function 'test_EvalEnvironment_capture_flag

@josef-pkt
Member

Looks like a pure patsy.
Can you import patsy directly? before building statsmodels

try from patsy import version as patsy_version directly in python, to see if it's the same problem without statsmodels

@hkok
hkok commented Oct 9, 2013

I downgraded patsy version 0.2.1 to 0.1.0 and was able to build with lot of warnings:

#warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"

build install working...
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying statsmodels.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying statsmodels.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying statsmodels.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying statsmodels.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
copying statsmodels.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
creating dist
creating 'dist/statsmodels-0.5.0-py2.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing statsmodels-0.5.0-py2.7-linux-x86_64.egg
removing '/usr/local/pkg/python/2.7.5/lib/python2.7/site-packages/statsmodels-0.5.0-py2.7-linux-x86_64.egg' (and everything under it)
creating /usr/local/pkg/python/2.7.5/lib/python2.7/site-packages/statsmodels-0.5.0-py2.7-linux-x86_64.egg
Extracting statsmodels-0.5.0-py2.7-linux-x86_64.egg to /usr/local/pkg/python/2.7.5/lib/python2.7/site-packages
statsmodels 0.5.0 is already the active version in easy-install.pth

Installed /usr/local/pkg/python/2.7.5/lib/python2.7/site-packages/statsmodels-0.5.0-py2.7-linux-x86_64.egg
Processing dependencies for statsmodels==0.5.0
Finished processing dependencies for statsmodels==0.5.0

Now when running the acid test:

/usr/pkg/python/current/bin/python2.7

Python 2.7.5 (default, Oct 8 2013, 16:27:21)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import statsmodels.api as foo
Traceback (most recent call last):
File "", line 1, in
File "statsmodels/api.py", line 1, in
import iolib, datasets, tools
File "statsmodels/iolib/init.py", line 1, in
from foreign import StataReader, genfromdta, savetxt
File "statsmodels/iolib/foreign.py", line 20, in
import statsmodels.tools.data as data_util
File "statsmodels/tools/init.py", line 1, in
from tools import add_constant, categorical
File "statsmodels/tools/tools.py", line 8, in
from scipy.interpolate import interp1d
File "/usr/pkg/python/current/lib/python2.7/site-packages/scipy/interpolate/init.py", line 160, in
from .ndgriddata import *
File "/usr/pkg/python/current/lib/python2.7/site-packages/scipy/interpolate/ndgriddata.py", line 10, in
from .interpnd import LinearNDInterpolator, NDInterpolatorBase,
File "interpnd.pyx", line 1, in init scipy.interpolate.interpnd (scipy/interpolate/interpnd.c:22803)
File "/usr/pkg/python/current/lib/python2.7/site-packages/scipy/spatial/init.py", line 87, in
from .kdtree import *
File "/usr/pkg/python/current/lib/python2.7/site-packages/scipy/spatial/kdtree.py", line 8, in
import scipy.sparse
File "/usr/pkg/python/current/lib/python2.7/site-packages/scipy/sparse/init.py", line 182, in
from .csr import *
File "/usr/pkg/python/current/lib/python2.7/site-packages/scipy/sparse/csr.py", line 15, in
from .sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks,
File "/usr/pkg/python/current/lib/python2.7/site-packages/scipy/sparse/sparsetools/init.py", line 5, in
from .csr import *
File "/usr/pkg/python/current/lib/python2.7/site-packages/scipy/sparse/sparsetools/csr.py", line 26, in
_csr = swig_import_helper()
File "/usr/pkg/python/current/lib/python2.7/site-packages/scipy/sparse/sparsetools/csr.py", line 22, in swig_import_helper
_mod = imp.load_module('_csr', fp, pathname, description)
ImportError: /usr/pkg/python/current/lib/python2.7/site-packages/scipy/sparse/sparsetools/_csr.so: undefined symbol: _ZNSt8ios_base4InitD1Ev

I'm running scipy 0.12 and compiles cleanly.
:
Found executable /usr/bin/gfortran
customize Gnu95FCompiler
customize Gnu95FCompiler using build_clib
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
extending extension 'scipy.sparse.linalg.dsolve._superlu' defined_macros with [('USE_VENDOR_BLAS', 1)]
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize Gnu95FCompiler
customize Gnu95FCompiler
customize Gnu95FCompiler using build_ext
running scons
running install_lib
copying build/lib.linux-x86_64-2.7/scipy/config.py -> /usr/pkg/python/current/lib/python2.7/site-packages/scipy
copying build/lib.linux-x86_64-2.7/scipy/version.py -> /usr/pkg/python/current/lib/python2.7/site-packages/scipy
byte-compiling /usr/pkg/python/current/lib/python2.7/site-packages/scipy/config.py to config.pyc
byte-compiling /usr/pkg/python/current/lib/python2.7/site-packages/scipy/version.py to version.pyc
running install_data
running install_egg_info
Removing /usr/pkg/python/current/lib/python2.7/site-packages/scipy-0.12.0-py2.7.egg-info
Writing /usr/pkg/python/current/lib/python2.7/site-packages/scipy-0.12.0-py2.7.egg-info
running install_clib

So what does these undefined symbols means when I import statmodels.api? Should I downgrade to scipi 0.7 instead?

@hkok
hkok commented Oct 9, 2013

I downgraded patsy from 0.21 to 0.1 and now I am able to build. However, I
think there are still issues with scipy that cause problem with importing
statsmodel.api. Any idea how to resolve this?

Regards,

-KHY

On Wed, Oct 9, 2013 at 9:18 AM, Josef Perktold notifications@github.comwrote:

Looks like a pure patsy.
Can you import patsy directly? before building statsmodels

try from patsy import version as patsy_version directly in python, to see
if it's the same problem without statsmodels


Reply to this email directly or view it on GitHubhttps://github.com/statsmodels/statsmodels/issues/1108#issuecomment-25970021
.

@josef-pkt
Member

check your scipy install:

your traceback means that scipy is not properly installed

import scipy
scipy.test()

It would be easier but less up-to-date to install scipy from your package distribution. If you want to upgrade scipy, then you would have to ask on the scipy-user mailing list. I'm not familiar with any Linux scipy install problems.

Also you should run the numpy tests, to see if that one is correctly installed.

import numpy
numpy.test()

Something looks strange in your build environment, but I have no guess for that.

@josef-pkt
Member

Doesn't look like anything directly related to statsmodels.

@josef-pkt josef-pkt closed this Oct 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment