ImportError: No module named shutil_get_terminal_size - python

I have started to install SciPy using:
pip install --user numpy scipy matplotlib ipython jupyter pandas simply nose
It installed but when I want to go into ipython I get this error:
ImportError: No module named shutil_get_terminal_size
I tried uninstalling python then reinstalling it as well as uninstalling and reinstalling SciPy. I've also upgraded pip setup tools as well as python. It says that shutil_get_terminal_size has been installed:
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 7, in <module>
from IPython import start_ipython
File "/usr/local/lib/python2.7/site-packages/IPython/__init__.py", line 48, in <module>
from .core.application import Application
File "/usr/local/lib/python2.7/site-packages/IPython/core/application.py", line 25, in <module>
from IPython.core import release, crashhandler
File "/usr/local/lib/python2.7/site-packages/IPython/core/crashhandler.py", line 28, in <module>
from IPython.core import ultratb
File "/usr/local/lib/python2.7/site-packages/IPython/core/ultratb.py", line 128, in <module>
from IPython.utils.terminal import get_terminal_size
File "/usr/local/lib/python2.7/site-packages/IPython/utils/terminal.py", line 22, in <module>
from backports.shutil_get_terminal_size import get_terminal_size as _get_terminal_size
ImportError: No module named shutil_get_terminal_size
I just need to be able to get SciPy and ipython working.

You need to update your version of pip and then install ipython again.
sudo pip install --upgrade setuptools pip
pip uninstall --user ipython
pip install --user ipython

I have also faced the same issue.This is the issue of conda environment. That's why it is giving the error in ipython notebook.Try out this one.
conda update conda
conda update ipython
After trying this,if you are facing same issue.then try to install ipython inside your conda environment.Activate your conda environment first.then do as follows.
pip install --upgrade setuptools pip
ex: (dato-env) pydev#Optimus:~$ pip install --upgrade setuptools pip
then install ipython inside conda environment
pip install -U ipython
ex : (dato-env) pydev#Optimus:~$ pip install -U ipython
then open Jupyter notebook from the terminal and it will open jupyter on your browser.
(dato-env) pydev#Optimus:~$ jupyter notebook
Hope it helps.

Related

ktrain ImportError: DLL load failed: The specified module could not be found

I'm using windows 10
python version: 3.7.1
ktrain version: 0.11.3
tensorflow downgrade to 2.0
error log::
Traceback (most recent call last):
File "text_classifier.py", line 3, in
import ktrain
File "C:\Users\user\PycharmProjects\ai\env\lib\site-packages\ktrain__init__.py", line 2, in
from .imports import *
File "C:\Users\user\PycharmProjects\ai\env\lib\site-packages\ktrain\imports.py", line 209, in
import cchardet as chardet
File "C:\Users\user\PycharmProjects\ai\env\lib\site-packages\cchardet__init__.py", line 1, in
from cchardet import _cchardet
ImportError: DLL load failed: The specified module could not be found.
I was working on virtualenv
I moved to conda env
pip install ktrain
pip install tensorflow=2.0
pip uninstall h5py
pip install h5py
Now it's working fine, thanks for the idea conda install -c conda-forge cchardet
Try updating cchardet:
conda install -c conda-forge cchardet

ModuleNotFoundError: No module named 'tensorflow.python.training'

When I am trying to run this
import keras
I am getting following error:
Traceback (most recent call last):
File "<ipython-input-1-c74e2bd4ca71>", line 1, in <module>
import keras
File "/Users/rezwan/anaconda/lib/python3.6/site-packages/keras/__init__.py", line 3, in <module>
from . import utils
File "/Users/rezwan/anaconda/lib/python3.6/site-packages/keras/utils/__init__.py", line 6, in <module>
from . import conv_utils
File "/Users/rezwan/anaconda/lib/python3.6/site-packages/keras/utils/conv_utils.py", line 3, in <module>
from .. import backend as K
File "/Users/rezwan/anaconda/lib/python3.6/site-packages/keras/backend/__init__.py", line 83, in <module>
from .tensorflow_backend import *
File "/Users/rezwan/anaconda/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2, in <module>
from tensorflow.python.training import moving_averages
ModuleNotFoundError: No module named 'tensorflow.python.training'
Already I have installed Theano, Tensorflow and Keras through the following commands:
Theano:
Rezwans-iMac:~ rezwan$ pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git
Tensorflow:
Rezwans-iMac:~ rezwan$ conda create -n tensorflow python=3.6
Rezwans-iMac:~ rezwan$ source activate tensorflow
(tensorflow) Rezwans-iMac:~ rezwan$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.3.0rc2-py3-none-any.whl
(tensorflow) Rezwans-iMac:~ rezwan$ pip3 install --upgrade $TF_BINARY_URL
Keras:
Rezwans-iMac:~ rezwan$ pip install --upgrade keras
Above commands work properly.
But I am getting above error. How can I solve this error?
To make sure all libraries are installed, you can use a text file with something like this:
jupyter==1.0.0
Keras==2.1.3
numpy==1.15.1
pandas==0.22.0
scikit-learn==0.19.1
scipy==1.0.0
tensorboard==1.10.0
tensorflow==1.10.0
Then use pip to install:
pip install -r requirements.txt
or
pip3 install -r requirements.txt
All libraries will be installed for use in the same python version, in case you have multiple installations.
Your tensorflow installation commands:
Rezwans-iMac:~ rezwan$ conda create -n tensorflow python=3.6
Rezwans-iMac:~ rezwan$ source activate tensorflow
(tensorflow) Rezwans-iMac:~ rezwan$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.3.0rc2-py3-none-any.whl
(tensorflow) Rezwans-iMac:~ rezwan$ pip3 install --upgrade $TF_BINARY_URL
created and activated a virtual environment called tensorflow. Notice the (tensorflow) before Rezwans-iMac, indicating that you are inside the newly created virtual environment. Since tensorflow is only installed in this virtual environment, you need to switch into it with
source activate tensorflow
everytime you want to use tensorflow. You will also need to install other packages that you want to use inside this environment.
Also configure your IDE to use the interpreter in .../anaconda/env/tensorflow/bin/python
Upgrading tensorflow to "1.15.2" Solved the issue for me.
Seems like tensorflow doesn't have backword compatibility with

Error opening Anaconda package spykeviewer

I am running Anaconda on macOS Sierra utilising Python 2.7. I want to be able to run spykeviewer https://anaconda.org/pypi/spykeviewer
however I keep receiving this error:
*Traceback (most recent call last):
File "/Users/becky/anaconda/envs/spykeviewer-en/bin/spykeviewer", line 11, in <module>
sys.exit(main())
File "/Users/becky/anaconda/envs/spykeviewer-en/lib/python2.7/site-packages/spykeviewer/start.py", line 42, in main
from ui.main_window_neo import MainWindowNeo
File "/Users/becky/anaconda/envs/spykeviewer-en/lib/python2.7/site-packages/spykeviewer/ui/main_window_neo.py", line 16, in <module>
from spyderlib.widgets.variableexplorer.collectionseditor import \
ImportError: No module named spyderlib.widgets.variableexplorer.collectionseditor*
I have all of the dependent packages downloaded and I have reinstalled spyder as the error seems to be pointing to this module but I still get the same import error.
Here is how I installed the different packages:
conda install pyqt=4
conda install scipy
conda install gdata
conda install matplotlib
conda install pytables
conda install spyder
tables already installed in the environment
from terminal -> into guidata folder -> python setup.py install
from terminal -> into quiqwt -> python setup.py install
both are then in root —> open terminal in spykeviewer-en —> pip install guidata
condo install cython
pip install guiqwt
pip install neo
pip install spykeutils
pip install spykeviewerenter

I cant import sklearn

I try to import scikit-learn, but there is an error. i installed sklearn, scipy on anaconda. i am using W10 and python 3.5.
>>> import sklearn
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import sklearn
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python35-32\lib\site-packages\sklearn\__init__.py", line 57, in <module>
from .base import clone
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python35-32\lib\site-packages\sklearn\base.py", line 9, in <module>
from scipy import sparse
ImportError: No module named 'scipy'
In linux there is pip install <module> to install a module, and if you are using anaconda then conda install <module>, I believe there would be something similar in windows.
If you are sure that you have installed scipy module, then probably the python path is not looking for those directories.
You can try a environment variable PYTHONPATH that has a list of directories to append before launching python prompt. OR you can test it for a session by adding it to sys.path
Use pip to install the packages
pip install numpy
pip install scipy
pip install -U scikit-learn
Ensure you have appropriate privileges for installing globally or in virtual environment.
Using pip, or interpreter setting in pycharm:
pip install NumPy+mkl
numpy-mkl 1.10.2
Install module NumPy+mkl
pip install SciPy
Install module SciPy
Now you can install sklearn.
pip install scikit-learn
Install module scikit-learn
Hope that it is useful.

Install the ipython ImportError: No module named pickleshare

Today,I have installed the ipython by the follow steps:
cd
sudo apt-get install git
git clone https://github.com/ipython/ipython.git
cd ipython
sudo python setup.py install
But I meet a error when I open the ipython:
~$ ipython
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 4, in <module>
from IPython import start_ipython
File "/usr/local/lib/python2.7/dist-packages/IPython/__init__.py", line 48, in <module>
from .terminal.embed import embed
File "/usr/local/lib/python2.7/dist-packages/IPython/terminal/embed.py", line 16, in <module>
from IPython.core.interactiveshell import DummyMod
File "/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.py", line 31, in <module>
from pickleshare import PickleShareDB
ImportError: No module named pickleshare
How to deal with the error?
I solved the problem with sudo easy_install pickleshare
(https://pypi.python.org/pypi/pickleshare/0.3)
It looks that pickleshare is in package IPython.utils.
Use this pip install -I path.py==7.7.1
Updating the package to version 8.1 should fix the problem as well now:
pip install -I path.py==8.1

Categories

Resources