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?
Go to Environments tab just below the Home tab and from there we can check what all packages are installed and what is not. It is very easy to install any package through anaconda navigator, simply search the required package, select package and click on apply to install it.
Click Start�All Programs�Anaconda (64-bit)�Anaconda Command Prompt. � A command prompt window will open. Type idle to run the Python interpreter. A new window titled Python Shell will open and you will see the Python >>> command prompt.
Importing module from a package We can import modules from packages using the dot (.) operator. Now, if this module contains a function named select_difficulty() , we must use the full name to reference it. Now we can directly call this function.
Start the Anaconda Navigator application. Select Environments in the left column. A dropdown box at the center-top of the GUI should list installed packages. If not, then select Installed in the dropdown menu to list all packages.
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) then source ~/.bashrc
.
Next time you will go to will run python
and import theano
you'll succeed.
When I had this issue my python install was actually missing a "site-packages" path reference. To solve/workaround the issue do the following.
python -c "import site; print(site.getsitepackages())"
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With