Reputation: 1
I have been trying to install Lasagne and Theano in Anaconda (Jupyter) on MacOS Sierra (10.12.3) to use this neural network: neural-storyteller
However when I try to import them in Jupyter:
import lasagne
import theano
I get this error:
ImportError Traceback (most recent call last)
<ipython-input-2-7d877a974cd7> in <module>()
----> 1 import lasagne
2 import theano
//anaconda/lib/python2.7/site-packages/lasagne/__init__.py in <module>()
11 section 'Install from PyPI' in the installation docs for more details:
12 http://lasagne.readthedocs.org/en/latest/user/installation.html#install-from-pypi
---> 13 """)
14 else:
15 del theano
ImportError: Could not import Theano.
Please make sure you install a recent enough version of Theano. See
section 'Install from PyPI' in the installation docs for more details:
http://lasagne.readthedocs.org/en/latest/user/installation.html#install-from-pypi
My guess is that I installed Theano on a different version of python because when I make a normal python file (.py) and import lasagne and theano they work. Also, when I look in the anaconda folder in the User directory there is no theano folder but there is one in the miniconda2 folder (/Users/Pit/miniconda2/pkgs/theano-0.9.0-py27_0). I could just use a .py file, but I also need the caffe library which I could only get to work with Anaconda python.
Does anybody know how to install the right version of theano that works in Anaconda (Jupyter)? Any help would be much appreciated
Upvotes: 0
Views: 3027
Reputation: 11
I had faced the same issue. I think it's because Theano installation was not proper. So here is what I did and it started working after that :
In Anaconda Prompt
conda install theano
Follow through the installation. It would probably ask for some confirmations. Then,
pip install -r https://raw.githubusercontent.com/Lasagne/Lasagne/master/requirements.txt
After that,
pip install https://github.com/Lasagne/Lasagne/archive/master.zip
I think that should do the trick. It started working after that in my case. Restart the kernel once. For more context : https://pypi.org/project/Lasagne/
Upvotes: 1
Reputation: 137
You should check which jupyter and which python is being called by using the command:
which python
If you do:
which jupyter
they should be in the same directory. For example:
$:/home/spark : which jupyter
~/anaconda2/bin/jupyter
$:/home/spark : which python
~/anaconda2/bin/python
If they're not the same, then that could explain why you cannot import some libraries (because they're installed under a different python instance).
Unless you need both, I would remove either anaconda or miniconda to make things simpler and less confusing.
Theano works fine with Anaconda and in Jupyter in my experience.
Upvotes: -1