Can't import pyramid.arima even after installing it in jupyter notebook as well as checking the same in anaconda prompt.
Tried installing it in jupyter notebook and then checked the same in the command promp of anaconda.
!pip install pyramid-arima
from pyramid.arima import auto_arima
Actual Result: No module named 'pyramid.arima'
Closing and opening the jupyter notebook did the trick.
N.B - Sorry for bothering you guys. :P
Related
I ran same program before. But don't know suddenly it's showing ImportError. I did not change anything in Anaconda. Then what's going wrong ?
If you get a numpy import error, the C-libraries are not on the path. This means that you conda environment isn't activated.
To use conda environments in Jupyter follow this instuction:
How to add your Conda environment to your jupyter notebook in just 4 steps
On a side note: Why are you trying to mix pip and conda installs? This is asking for trouble!
I'm trying to install and import the Basemap library into my Jupyter Notebook, but this returns the following error:
KeyError: 'PROJ_LIB'
After some research online, I understand I'm to install Basemap on a separate environment in Anaconda. After creating a new environment and installing Basemap (as well as all other relevant libraries), I have activated the environment. But when importing Basemap I still receive the same KeyError.
Here's what I did in my MacOS terminal:
conda create --name Py3.6 python=3.6 basemap
source activate Py3.6
conda upgrade proj4
env | grep -i proj
conda update --channel conda-forge proj4
Then in Jupyter Notebook I run the following:
from mpl_toolkits.basemap import Basemap
Can anyone tell me why this results in a KeyError?
Need to set the PROJ_LIB environment variable either before starting your notebook or in python with os.environ['PROJ_LIB'] = '<path_to_anaconda>/share/proj'
Ref. Basemap import error in PyCharm —— KeyError: 'PROJ_LIB'
In Windows 10 command line: first find the directory where the epsg file is stored:
where /r "c:\Users\username" epsg.*
...
c:\Users\username\AppData\Local\conda\conda\envs\envname\Library\share\epsg
...
then either in command line:
activate envname
SET PROJ_LIB=c:\Users\username\AppData\Local\conda\conda\envs\envname\Library\share
(make sure there are no leading on trailing spaces in the path!) and then
jupyter notebook
or add this to your jupyter notebook (as suggested by john ed):
import os
os.environ['PROJ_LIB'] = r'c:\Users\username\AppData\Local\conda\conda\envs\envname\Library\share'
The problem occurs as the file location of "epsg" and PROJ_LIB has been changed for recent versions of python, but somehow they forgot to update the init.py for Basemap. If you have installed python using anaconda, this is a possible location for your espg file:
C:\Users\(xxxx)\AppData\Local\Continuum\anaconda3\pkgs\proj4-5.1.0-hfa6e2cd_1\Library\share
So you have to add this path at the start of your code in spyder or whatever field you are using.
import os
os.environ['PROJ_LIB'] = r'C:\Users\(xxxx)\AppData\Local\Continuum\anaconda3\pkgs\proj4-5.1.0-hfa6e2cd_1\Library\share'
from mpl_toolkits.basemap import Basemap
If you can not locate epsg file at all, you can download it here:
https://raw.githubusercontent.com/matplotlib/basemap/master/lib/mpl_toolkits/basemap/data/epsg
And copy this file to your PATH, e.g. to:
os.environ['PROJ_LIB'] = 'C:\Users\username\Anaconda3\pkgs\basemap-1.2.0-py37h4e5d7af_0\Lib\site-packages\mpl_toolkits\basemap\data\'
This is the ONLY solution that worked for me on Windows 10 / Anaconda 3.
Launch Jupyter Notebook from command prompt and it won't throw the same error. It somehow works for me!
I installed tflearn using pip install tflearn. It installs alright, no error message, but when I try to import it gives error (on Pycharm and Jupyter Notebook error reads: Import error: No module named Tflearn)
But on Powershell more details are available: Powershell
Any idea how to resolve this?
Check your spelling of the import in your code. You have to import tflearn, not Tflearn.
First of all thanks #Thomas for all your responses.
The problem solved after I performed:
1. Uninstall tflearn.
2. Update conda
3. Install tflearn again
Working on my Windows machine, I installed Anaconda 3 and created a Python 2 environment in Anaconda Prompt using commands below:
conda create -n py2 python=2
activate py2
conda install numpy matplotlib pandas scikit-learn
However, when I run jupyter notebook in Anaconda Prompt, in the opened notebook, I checked Python version using this:
import sys
print('Python version is:', sys.version_info)
I found out it is Python 3 instead of Python 2...I wonder what's going on?
It turns out I need to install jupyter notebook like below in Anaconda Prompt as well, otherwise, the default Python 3 version notebook will be called.
conda install jupyter notebook
Now, if we launch jupyter notebook again, we'll get Python 2.
You may also find that you need to install the Notebook extensions which provides Conda environment and package access extension from within Jupyter Notebook. You can do that by running:
conda install nb_conda
My apologies in advance - I have read through multiple sites and tried multiple things, but am still having trouble.
On OSX. Am trying to execute "import pandas as pd" in a jupyter notebook with Python 3, but receive the following message:
ModuleNotFoundError: No module named 'pandas'
I created a new conda environment
conda create -n py3x python=3
activated it
source activate py3x
then opened jupyter
jupyter notebook
Did not work.
Tried this, but that seemed to default to Python 2: ImportError: No module named 'pandas'
I've also tried (perhaps?) every iteration from the following: Using both Python 2.x and Python 3.x in IPython Notebook
I have python 3 in jupyter notebook now, but none of the packages from anaconda. I also tried updating Anaconda (had already done Anaconda3 graphical install)
conda update anaconda
And that just said "All requested packages already installed"
Any further thoughts on terminal command lines to help would be much appreciated.