PyCall.jl icon indicating copy to clipboard operation
PyCall.jl copied to clipboard

cannot import name MAXREPEAT (PyCall failed with Anaconda)

Open tungwaiyip opened this issue 12 years ago • 4 comments

I am trying to use IJulia and PyPlot. It causes a kernel restart as soon as I enter "using pyplot". I tracked it down to what looks like a basic failure of PyCall.

I am using Anaconda Python 2.7.5 on Windows 7.

Also I'm using 64 bit Julia but 32 bit Python. I wonder if it matters.

c:\julia-05c6461b55>conda -V
conda 2.3.0

c:\julia-05c6461b55>where python
C:\Anaconda\python.exe

c:\julia-05c6461b55>python -V
Python 2.7.5 :: Anaconda 1.8.0 (32-bit)

c:\julia-05c6461b55>julia -v
julia version 0.2.0

c:\julia-05c6461b55>julia -e "using PyCall; @pyimport math"
Traceback (most recent call last):
  File "C:\Anaconda\lib\site.py", line 548, in <module>
    main()
  File "C:\Anaconda\lib\site.py", line 530, in main
    known_paths = addusersitepackages(known_paths)
  File "C:\Anaconda\lib\site.py", line 266, in addusersitepackages
    user_site = getusersitepackages()
  File "C:\Anaconda\lib\site.py", line 241, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "C:\Anaconda\lib\site.py", line 231, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "C:\Anaconda\lib\sysconfig.py", line 516, in get_config_var
    return get_config_vars().get(name)
  File "C:\Anaconda\lib\sysconfig.py", line 449, in get_config_vars
    import re
  File "C:\Anaconda\lib\re.py", line 105, in <module>
    import sre_compile
  File "C:\Anaconda\lib\sre_compile.py", line 14, in <module>
    import sre_parse
  File "C:\Anaconda\lib\sre_parse.py", line 17, in <module>
    from sre_constants import *
  File "C:\Anaconda\lib\sre_constants.py", line 18, in <module>
    from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT

tungwaiyip avatar Jan 25 '14 16:01 tungwaiyip

Do you get the same error with import math in python? It looks like your installation may be corrupt.

jiahao avatar Jan 25 '14 16:01 jiahao

Wow! Thanks for super quick response. Python works fine.

c:\julia-05c6461b55>python
Python 2.7.5 |Anaconda 1.8.0 (32-bit)| (default, Jul  1 2013, 12:41:55) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import math

tungwaiyip avatar Jan 25 '14 16:01 tungwaiyip

I have fetched the 32 bit version of Julia instead. Now the problem go away. I am able to launch IJulia at last.

tungwaiyip avatar Jan 25 '14 17:01 tungwaiyip

Oh, I missed that you were trying to run 64 bit Julia with 32 bit Python. Yeah, that would do it.

jiahao avatar Jan 25 '14 17:01 jiahao