Installed package with Anaconda, cannot be imported into Python
Forgive me, but I am new to python. I installed the package (theano) using
conda install theano
and when I type the conda list
package exists
However, when I go into the python interpreter, run it python
and try to import it with import theano
, I get an error: "there is no module named theano" and when I list all python modules, theano doesn't exist.
What am I missing?
source to share
Probably due to the fact that you have multiple python envs installed on your machine. when you do which python
you will probably end up with native python installed on your machine. i.e/usr/bin/python
You want to use Python, which came when you installed Anaconda. Just add the Anaconda path to the beginning of your $PATH
. (To do this, you will probably need to edit the file ~/.bashrc
(or the equivalent file for your shell), then source ~/.bashrc
.
Next time you start python
, import theano
you will be successful.
source to share
I had a base environment where I 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
), keras_vggface import failed.
When base
deactivated and on the python command line the import worked fine. which python
detects the one in the Anaconda bin directory. Now I did pip3 install keras_vggface
being in base
.
I can now import the module from base
and at the python prompt and also from the jupyter notebook launched from the base via anaconda-navigator.
Note: this is not expert advice on how to do this; please use this experience with a pinch of salt.
source to share