Python and Spyder set up and troubleshooting

Discussion in 'Mac Programming' started by patent10021, Sep 15, 2016.

  1. patent10021, Sep 15, 2016
    Last edited: Sep 15, 2016

    patent10021 macrumors 68030


    Apr 23, 2004
    I am having some issues and would like some feedback re the best setup.

    Main issue
    The main issue is Spyder is not seeing theano as I have out lined here.

    The message in the console is "ImportError: No module named theano"

    Locations of Python and Theano on my Mac.
    I have the invisible .theano in /usr/bob/theano
    I have theano in /usr/local/lib/python2.7/site-packages
    I also have theano in /usr/lib/python3.5/site-packages

    When I am in Terminal Python2/3 and do an import of theano to check if its installed properly it is there.
    When I do pip2/3 install theano I already have it as expected.

    I have tried copying the theano module folder to the ' (new error saying I was missing python.h)
    I have tried the PYTHONPATH manager then updating the module names list.
    I have tried using a different interpreter (which only produces further errors.)

    I have tried using theano in a venv and still got the same error message.

    My instances of python exist in the following locations.
    /usr/local/bin contains aliases to python2, python2.7, python3, python3.5
    /usr/bin contains aliases to python2.6, python2.7
    /system/library/frameworks/Python.framework/Versions/ (2.3, 2.5, 2.6, 2.7 and Current which is pointing to 2.7)
    /usr/local/Cellar/python/2.712/Frameworks/Python.Framework/Versions/2.7, Current

    Secondary issue
    It seems I have a lot of instances of Python and modules in various locations. I know I should be using venv so I have started doing that. But for quick tests of super small scripts it seems like such a waste of time to set up a venv every time. Is there a solution to this?

    I only want python 2.7 and 3.5. What should I do about the default Mac install of python 2?

    I also noticed that my default version of Python from the Terminal is Python 3.5.2 |Anaconda 4.1.1. Not sure if this makes a difference. Also I have the same issue with the theano module when using PyCharm.

    Maybe the zshrc or bash_profile need a more proper set up?
  2. jaduff46 macrumors 6502


    Mar 3, 2010
    Second star on the right....
    Are you using Anaconda? Last time I installed it (Anaconda before retiring a year ago, the install put everything in the right places with the right links, including the appropriate Python version (2 or 3). I needed the math libraries and numpy to do some stuff.

    Otherwise just go to Haven't used the ActiveState version.
  3. patent10021 thread starter macrumors 68030


    Apr 23, 2004
    Anaconda isn't the issue. I have Anaconda and yes it installs everything nicely. Problem is with Spyder not being able to import Theano. I've tried both versions of Spyder and all the solutions above. Really driving me nuts.
  4. patent10021 thread starter macrumors 68030


    Apr 23, 2004
    What's interesting is that when I run the standalone version of Spyder I always get import problems. But when I run Spyder from Anaconda it works. I know Anaconda has all the packages and modules already but so did my own installs so I'm not sure why my manually installed version of Spyder always has issues. Oh well.

Share This Page

3 September 15, 2016