Put it after the doctest.

Aaron Meurer

On Mon, Oct 28, 2013 at 12:24 PM, Pablo Puente <[email protected]> wrote:
> You were right!
>
> i moved, just for testing import integrate in series() and the error is
> removed.
>
> Thanks.
>
> from __future__ import print_function, division
>
> from sympy.core.sympify import sympify
>
> def series(expr, x=None, x0=0, n=6, dir="+"):
>     from sympy.integrals import integrate
>     """Series expansion of expr around point `x = x0`.
>
>     See the doctring of Expr.series() for complete details of this wrapper.
>     """
>     expr = sympify(expr)
>     return expr.series(x, x0, n, dir)
>
>
> On Monday, October 28, 2013 6:52:47 PM UTC+1, Aaron Meurer wrote:
>>
>> Oh, if it came from adding an import, then the issue is most likely
>> due to a circular import problem.  In that case, you'll have to move
>> the import inside the function that needs it.
>>
>> Aaron Meurer
>>
>> On Mon, Oct 28, 2013 at 12:37 AM, Pablo Puente <[email protected]>
>> wrote:
>> > The problem was not on master (sorry) but was caused by a modification i
>> > did
>> > locallay.
>> >
>> > Adding "from sympy.integrals import integrate" in series.py causes, with
>> > both python3 and python 2, the ImportError.
>> >
>> > I searched for "roots" and found a twisted python library file caled
>> > "roots.py"
>> >
>> > pape@lenovo:~/sympy$ locate roots
>> > /home/pape/sympy/sympy/polys/polyroots.py
>> > /home/pape/sympy/sympy/polys/polyroots.pyc
>> > /home/pape/sympy/sympy/polys/__pycache__/polyroots.cpython-33.pyc
>> > /home/pape/sympy/sympy/polys/tests/test_polyroots.py
>> >
>> > /home/pape/workspace/.metadata/.plugins/com.python.pydev.analysis/python_v1_3tswbhuj9gc4kibexhrzgzdx/v1_indexcache/sympy.polys.polyroots_5ze7.v1_indexcache
>> >
>> > /home/pape/workspace/.metadata/.plugins/com.python.pydev.analysis/python_v1_3tswbhuj9gc4kibexhrzgzdx/v1_indexcache/sympy.polys.tests.test_polyroots_uce2.v1_indexcache
>> >
>> > /home/pape/workspace/.metadata/.plugins/com.python.pydev.analysis/python_v1_3tswbhuj9gc4kibexhrzgzdx/v1_indexcache/twisted.python.roots_9ohn.v1_indexcache
>> >
>> > /home/pape/workspace/.metadata/.plugins/com.python.pydev.analysis/python_v1_3tswbhuj9gc4kibexhrzgzdx/v1_indexcache/twisted.test.test_roots_eoll.v1_indexcache
>> >
>> > /home/pape/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/sympy/com.python.pydev.analysis/v1_indexcache/sympy.polys.polyroots_5ze7.v1_indexcache
>> >
>> > /home/pape/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/sympy/com.python.pydev.analysis/v1_indexcache/sympy.polys.tests.test_polyroots_uce2.v1_indexcache
>> > /usr/lib/python2.7/dist-packages/sympy/polys/polyroots.py
>> > /usr/lib/python2.7/dist-packages/sympy/polys/polyroots.pyc
>> > /usr/lib/python2.7/dist-packages/sympy/polys/tests/test_polyroots.py
>> > /usr/lib/python2.7/dist-packages/sympy/polys/tests/test_polyroots.pyc
>> > /usr/lib/python2.7/dist-packages/twisted/python/roots.py
>> > /usr/lib/python2.7/dist-packages/twisted/python/roots.pyc
>> > /usr/lib/python2.7/dist-packages/twisted/test/test_roots.py
>> > /usr/lib/python2.7/dist-packages/twisted/test/test_roots.pyc
>> > /usr/share/doc/python-twisted-web/examples/rootscript.py
>> > /usr/share/pyshared/sympy/polys/polyroots.py
>> > /usr/share/pyshared/sympy/polys/tests/test_polyroots.py
>> > /usr/share/pyshared/twisted/python/roots.py
>> > /usr/share/pyshared/twisted/test/test_roots.py
>> >
>> > Also I thought it could be caused come from another sympy installation
>> > in
>> > pythonpath (maybe coming from IPython Notebook).
>> >
>> > pape@lenovo:~/sympy$ locate polytools
>> > /home/pape/sympy/sympy/polys/polytools.py
>> > /home/pape/sympy/sympy/polys/polytools.pyc
>> > /home/pape/sympy/sympy/polys/__pycache__/polytools.cpython-33.pyc
>> > /home/pape/sympy/sympy/polys/tests/test_polytools.py
>> >
>> > /home/pape/workspace/.metadata/.plugins/com.python.pydev.analysis/python_v1_3tswbhuj9gc4kibexhrzgzdx/v1_indexcache/sympy.polys.polytools_6qvd.v1_indexcache
>> >
>> > /home/pape/workspace/.metadata/.plugins/com.python.pydev.analysis/python_v1_3tswbhuj9gc4kibexhrzgzdx/v1_indexcache/sympy.polys.tests.test_polytools_1mp0.v1_indexcache
>> >
>> > /home/pape/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/sympy/com.python.pydev.analysis/v1_indexcache/sympy.polys.polytools_6qvd.v1_indexcache
>> >
>> > /home/pape/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/sympy/com.python.pydev.analysis/v1_indexcache/sympy.polys.tests.test_polytools_1mp0.v1_indexcache
>> > /usr/lib/python2.7/dist-packages/sympy/polys/polytools.py
>> > /usr/lib/python2.7/dist-packages/sympy/polys/polytools.pyc
>> > /usr/lib/python2.7/dist-packages/sympy/polys/tests/test_polytools.py
>> > /usr/lib/python2.7/dist-packages/sympy/polys/tests/test_polytools.pyc
>> > /usr/share/pyshared/sympy/polys/polytools.py
>> > /usr/share/pyshared/sympy/polys/tests/test_polytools.py
>> >
>> >
>> > I removed /usr/share/pyshared/sympy/ but the problem still happens.
>> >
>> > Any other ideas?
>> >
>> > On Monday, October 28, 2013 1:50:38 AM UTC+1, Aaron Meurer wrote:
>> >>
>> >> It works for me.
>> >>
>> >> Make sure that you don't have anything named "roots" laying around. Or
>> >> any additional files or directories for that matter (git status will
>> >> tell you what untracked file you have in your repository). Python 3
>> >> has these annoying "namespace" packages, meaning that if you have any
>> >> directory in your current directory (even if it's completely unrelated
>> >> to Python) with the same name as a package, it will break Python,
>> >> because it will try to import that directory instead of the package.
>> >>
>> >> Aaron Meurer
>> >>
>> >> On Sun, Oct 27, 2013 at 3:26 AM, Pablo Puente <[email protected]>
>> >> wrote:
>> >> > I did a pull from master and now I get an import error:
>> >> >
>> >> > pape@lenovo:~/sympy$ python3 bin/test
>> >> > Traceback (most recent call last):
>> >> >   File "bin/test", line 76, in <module>
>> >> >     import sympy
>> >> >   File "/home/pape/sympy/sympy/__init__.py", line 35, in <module>
>> >> >     from .polys import *
>> >> >   File "/home/pape/sympy/sympy/polys/__init__.py", line 21, in
>> >> > <module>
>> >> >     from . import numberfields
>> >> >   File "/home/pape/sympy/sympy/polys/numberfields.py", line 26, in
>> >> > <module>
>> >> >     from sympy.polys.rootoftools import RootOf
>> >> >   File "/home/pape/sympy/sympy/polys/rootoftools.py", line 16, in
>> >> > <module>
>> >> >     from sympy.polys.polyroots import (
>> >> >   File "/home/pape/sympy/sympy/polys/polyroots.py", line 22, in
>> >> > <module>
>> >> >     from sympy.simplify import simplify, powsimp
>> >> >   File "/home/pape/sympy/sympy/simplify/__init__.py", line 23, in
>> >> > <module>
>> >> >     from .hyperexpand import hyperexpand
>> >> >   File "/home/pape/sympy/sympy/simplify/hyperexpand.py", line 80, in
>> >> > <module>
>> >> >     from sympy.series import residue
>> >> >   File "/home/pape/sympy/sympy/series/__init__.py", line 6, in
>> >> > <module>
>> >> >     from .series import series
>> >> >   File "/home/pape/sympy/sympy/series/series.py", line 4, in <module>
>> >> >     from sympy.integrals import integrate
>> >> >   File "/home/pape/sympy/sympy/integrals/__init__.py", line 12, in
>> >> > <module>
>> >> >     from .integrals import integrate, Integral, line_integrate
>> >> >   File "/home/pape/sympy/sympy/integrals/integrals.py", line 3, in
>> >> > <module>
>> >> >     from sympy.concrete.expr_with_limits import AddWithLimits
>> >> >   File "/home/pape/sympy/sympy/concrete/__init__.py", line 1, in
>> >> > <module>
>> >> >     from .products import product, Product
>> >> >   File "/home/pape/sympy/sympy/concrete/products.py", line 11, in
>> >> > <module>
>> >> >     from sympy.polys import quo, roots
>> >> > ImportError: cannot import name roots
>> >> >
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups
>> >> > "sympy" group.
>> >> > To unsubscribe from this group and stop receiving emails from it,
>> >> > send
>> >> > an
>> >> > email to [email protected].
>> >> > To post to this group, send email to [email protected].
>> >> > Visit this group at http://groups.google.com/group/sympy.
>> >> > For more options, visit https://groups.google.com/groups/opt_out.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "sympy" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to [email protected].
>> > To post to this group, send email to [email protected].
>> > Visit this group at http://groups.google.com/group/sympy.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to