Forgive me but I'm new to python. I've installed a package (theano) using
conda install theano
, and when I type conda list
, the package exists
However, when I enter the python interpreter by running python
, and try to import it with import theano
, I get an error: "no module named theano", and when I list all python modules, theano doesn't exist.
What am I missing?
So I also had the same problem, turn out that I had named my own file to the same modulename (graphviz) and it tried to import that one instead... Took me a while before I figured that one out!
Do you have another installation of Python on your system? You can run "which python" in your terminal to determine which Python will be used.
When I had this issue my python install was actually missing a "site-packages" path reference. To solve/workaround the issue do the following.
Example Output: ['C:\Anaconda3', 'C:\Anaconda3\lib\site-packages']
If you're interested in managing your own "site-packages" locations check out the Python Doc for details on setting up a site config file.
I had this problem and realised that the issue was that
ipython
andjupyter-notebook
did not have the samesys.path
aspython
, just in case that helps anyone.Probably due to the fact you have multiply python envs installed in your computer. when you do
which python
you will probably get the native python installed in your computer. that is/usr/bin/python
You want to use the Python that came when you installed Anaconda. Just add Anaconda path to the beginning of your
$PATH
. (In order to do this you probably need to edit your~/.bashrc
file (or the equivalent file for your shell) thensource ~/.bashrc
.Next time you will go to will run
python
andimport theano
you'll succeed.I had a base environment where I had installed keras_vggface using conda (sudo pip install git+https://github.com/rcmalli/keras-vggface.git: Courtesy: https://machinelearningmastery.com/how-to-perform-face-recognition-with-vggface2-convolutional-neural-network-in-keras/). Launched anaconda-navigator from base (post
conda activate base
), import keras_vggface failed.When
base
is deactivated, and in python command line, import worked fine.which python
reveals the one within anaconda bin directory. Now, I didpip3 install keras_vggface
while being inbase
.Now, I am able to import the module from within
base
and in python prompt and also from jupyter notebook launched from base via anaconda-navigator.Note: this is not an expert advice on how it has to be done; please use this experience with pinch of salt.