my jupyter notebook fails to import anaconda modules consistently - python

I can't get my jupyter notebook properly import any modules. The weird thing is, I am able to import numpy but not pandas with Sublime.
I wiped out every python related content on my Mac and re-installed anaconda. Here's the import error message for numpy on jupyter:
ImportError Traceback (most recent call last)
<ipython-input-1-5a0bd626bb1d> in <module>()
----> 1 import numpy
/Users/z-wang/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/__init__.pyc in <module>()
183 return loader(*packages, **options)
184
--> 185 from . import add_newdocs
186 __all__ = ['add_newdocs',
187 'ModuleDeprecationWarning',
/Users/z-wang/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/add_newdocs.py in <module>()
11 from __future__ import division, absolute_import, print_function
12
---> 13 from numpy.lib import add_newdoc
14
15 ###############################################################################
/Users/z-wang/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/lib/__init__.py in <module>()
16
17 from . import scimath as emath
---> 18 from .polynomial import *
19 #import convertcode
20 from .utils import *
/Users/z-wang/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/lib/polynomial.py in <module>()
17 from numpy.lib.function_base import trim_zeros, sort_complex
18 from numpy.lib.type_check import iscomplex, real, imag
---> 19 from numpy.linalg import eigvals, lstsq, inv
20
21 class RankWarning(UserWarning):
/Users/z-wang/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/linalg/__init__.py in <module>()
49 from .info import __doc__
50
---> 51 from .linalg import *
52
53 from numpy.testing import Tester
/Users/z-wang/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/linalg/linalg.py in <module>()
27 )
28 from numpy.lib import triu, asfarray
---> 29 from numpy.linalg import lapack_lite, _umath_linalg
30 from numpy.matrixlib.defmatrix import matrix_power
31 from numpy.compat import asbytes
ImportError: dlopen(/Users/z-wang/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/linalg/lapack_lite.so, 2): Library not loaded: #rpath/lib/libmkl_intel_lp64.dylib
Referenced from: /Users/z-wang/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/linalg/lapack_lite.so
Reason: image not found
And here's the message for pandas:
ImportError Traceback (most recent call last)
<ipython-input-5-d6ac987968b6> in <module>()
----> 1 import pandas
/Users/z-wang/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pandas/__init__.py in <module>()
11 "pandas from the source directory, you may need to run "
12 "'python setup.py build_ext --inplace' to build the C "
---> 13 "extensions first.".format(module))
14
15 from datetime import datetime
ImportError: C extension: scimath not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first.

Deleting everything Python related is a bad idea. There are system files which require it. Hopefully you didn't delete the wrong files and won't have to reinstall your operating system.
Regarding your question, you need to first activate your conda environment before launching jupyter notebook.
To see which environment you already have installed, type the following from a terminal window:
conda info --envs
Then type the following to activate your environment (obviously my_env is the name of what ever your environment is).
source activate my_env
From here, you are in your conda environment. To open Jupyter notebook, just type:
jupyter notebook
This notebook will be linked to your conda environment and will have access to all modules therein (type conda list from the terminal once you've activated your environment per above to see them, or !conda list from within the notebook).
Just for fun, we'll create a quick environment named test_env.
conda create -n test_env pandas jupyter notebook qtconsole matplotlib
source activate test_env
jupyter notebook # launches your notebook
Alternatively, to launch qtconsole:
jupyter qtconsole
Although we only installed a few packages, all linked dependencies are also installed (including numpy). This is now the output of conda list:
$ conda list
# packages in environment at /usr/local/miniconda/envs/test_env:
#
appnope 0.1.0 py27_0 defaults
backports-abc 0.4 <pip>
backports.ssl-match-hostname 3.4.0.2 <pip>
backports_abc 0.4 py27_0 defaults
cycler 0.10.0 py27_0 defaults
decorator 4.0.9 py27_0 defaults
freetype 2.5.5 0 defaults
ipykernel 4.3.1 py27_0 defaults
ipython 4.1.2 py27_0 defaults
ipython-genutils 0.1.0 <pip>
ipython_genutils 0.1.0 py27_0 defaults
ipywidgets 4.1.1 py27_0 defaults
jinja2 2.8 py27_0 defaults
jsonschema 2.4.0 py27_0 defaults
jupyter 1.0.0 py27_1 defaults
jupyter-client 4.1.1 <pip>
jupyter-console 4.1.0 <pip>
jupyter-core 4.0.6 <pip>
jupyter_client 4.1.1 py27_0 defaults
jupyter_console 4.1.0 py27_0 defaults
jupyter_core 4.0.6 py27_0 defaults
libpng 1.6.17 0 defaults
markupsafe 0.23 py27_0 defaults
matplotlib 1.5.1 np110py27_0 defaults
mistune 0.7.1 py27_0 defaults
mkl 11.3.1 0 defaults
nbconvert 4.1.0 py27_0 defaults
nbformat 4.0.1 py27_0 defaults
notebook 4.1.0 py27_0 defaults
numpy 1.10.4 py27_0 defaults
openssl 1.0.2g 0 defaults
pandas 0.17.1 np110py27_0 defaults
path.py 8.1.2 py27_1 defaults
pexpect 3.3 py27_0 defaults
pickleshare 0.5 py27_0 defaults
pip 8.0.3 py27_0 defaults
ptyprocess 0.5 py27_0 defaults
pygments 2.1.1 py27_0 defaults
pyparsing 2.0.3 py27_0 defaults
pyqt 4.11.4 py27_1 defaults
python 2.7.11 0 defaults
python-dateutil 2.4.2 py27_0 defaults
python.app 1.2 py27_4 defaults
pytz 2015.7 py27_0 defaults
pyzmq 15.2.0 py27_0 defaults
qt 4.8.7 1 defaults
qtconsole 4.1.1 py27_0 defaults
readline 6.2 2 <unknown>
setuptools 20.1.1 py27_0 defaults
simplegeneric 0.8.1 py27_0 defaults
singledispatch 3.4.0.3 py27_0 defaults
sip 4.16.9 py27_0 defaults
six 1.10.0 py27_0 defaults
sqlite 3.9.2 0 defaults
ssl_match_hostname 3.4.0.2 py27_0 defaults
terminado 0.5 py27_1 defaults
tk 8.5.18 0 http://repo.continuum.io/pkgs/free/osx-64/tk-8.5.18-0.tar.bz2
tornado 4.3 py27_0 defaults
traitlets 4.1.0 py27_0 defaults
wheel 0.29.0 py27_0 defaults
zlib 1.2.8 0 <unknown>
Once done, deactivate the environment.
source deactivate # From within the terminal of the active environment.
If you'd like to delete it:
conda env remove -n test_env

Related

How to solve "ImportError: DLL load failed:" for fancyimpute which previously worked

I could previously successfully import modules from fancyimpute in one Jupyterlab notebook and not in others. After restarting my PC it fails in all notebooks with a "ImportError: DLL load failed: The specified procedure could not be found."
Why would it work in one tab and not the other?
And, more worryingly, why would it stop working all together?
Some other posts on similar errors have suggested it could relate to the sys.path which I investigated. The only difference between the notebook where it worked and the ones where it didn't work was that the one where it worked lacked an entry for factor_analyzer-0.3.1-py3.6.egg which I added after opening that notebook.
I investigated the sys.path and for the notebook where it worked it looked like this (I entered the carriage returns manually to make it more legible):
['C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\python36.zip',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\DLLs',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\lib',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab',
'',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\lib\\site-packages',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\lib\\site-packages\\IPython\\extensions',
'C:\\Users\\laure\\.ipython']
And for the ones where it doesn't:
['C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\python36.zip',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\DLLs',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\lib',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab',
'',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\lib\\site-packages',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\lib\\site-packages\\factor_analyzer-0.3.1-py3.6.egg', 'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\lib\\site-packages\\IPython\\extensions',
'C:\\Users\\laure\\.ipython']
The code that produces the errors is:
from fancyimpute import KNN, NuclearNormMinimization, SoftImpute, IterativeImputer, BiScaler, SimpleFill
and the error message is:
Using TensorFlow backend.
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-5-64b839002688> in <module>
----> 1 from fancyimpute import KNN, NuclearNormMinimization, SoftImpute, IterativeImputer, BiScaler, SimpleFill
~\Anaconda3\envs\scipy18jlab\lib\site-packages\fancyimpute\__init__.py in <module>
4 from .nuclear_norm_minimization import NuclearNormMinimization
5 from .iterative_imputer import IterativeImputer
----> 6 from .matrix_factorization import MatrixFactorization
7 from .iterative_svd import IterativeSVD
8 from .simple_fill import SimpleFill
~\Anaconda3\envs\scipy18jlab\lib\site-packages\fancyimpute\matrix_factorization.py in <module>
14
15 import numpy as np
---> 16 from keras import regularizers
17 from keras.callbacks import EarlyStopping
18 from keras.layers import Input
~\Anaconda3\envs\scipy18jlab\lib\site-packages\keras\__init__.py in <module>
1 from __future__ import absolute_import
2
----> 3 from . import utils
4 from . import activations
5 from . import applications
~\Anaconda3\envs\scipy18jlab\lib\site-packages\keras\utils\__init__.py in <module>
4 from . import data_utils
5 from . import io_utils
----> 6 from . import conv_utils
7
8 # Globally-importable utils.
~\Anaconda3\envs\scipy18jlab\lib\site-packages\keras\utils\conv_utils.py in <module>
7 from six.moves import range
8 import numpy as np
----> 9 from .. import backend as K
10
11
~\Anaconda3\envs\scipy18jlab\lib\site-packages\keras\backend\__init__.py in <module>
87 elif _BACKEND == 'tensorflow':
88 sys.stderr.write('Using TensorFlow backend.\n')
---> 89 from .tensorflow_backend import *
90 else:
91 # Try and load external backend.
~\Anaconda3\envs\scipy18jlab\lib\site-packages\keras\backend\tensorflow_backend.py in <module>
3 from __future__ import print_function
4
----> 5 import tensorflow as tf
6 from tensorflow.python.framework import ops as tf_ops
7 from tensorflow.python.training import moving_averages
~\Anaconda3\envs\scipy18jlab\lib\site-packages\tensorflow\__init__.py in <module>
22
23 # pylint: disable=g-bad-import-order
---> 24 from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
25
26 from tensorflow._api.v1 import app
~\Anaconda3\envs\scipy18jlab\lib\site-packages\tensorflow\python\__init__.py in <module>
50
51 # Protocol buffers
---> 52 from tensorflow.core.framework.graph_pb2 import *
53 from tensorflow.core.framework.node_def_pb2 import *
54 from tensorflow.core.framework.summary_pb2 import *
~\Anaconda3\envs\scipy18jlab\lib\site-packages\tensorflow\core\framework\graph_pb2.py in <module>
4 import sys
5 _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
----> 6 from google.protobuf import descriptor as _descriptor
7 from google.protobuf import message as _message
8 from google.protobuf import reflection as _reflection
~\Anaconda3\envs\scipy18jlab\lib\site-packages\google\protobuf\descriptor.py in <module>
45 import binascii
46 import os
---> 47 from google.protobuf.pyext import _message
48 _USE_C_DESCRIPTORS = getattr(_message, '_USE_C_DESCRIPTORS', False)
49
ImportError: DLL load failed: The specified procedure could not be found.
Any advice on investigating and solving the issue would be appreciated.Also let me know if I need to provide more detail on the environment.
!pip list
Gives:
Package Version
-------------------- -----------
absl-py 0.7.1
appdirs 1.4.3
arrow 0.13.1
asn1crypto 0.24.0
astor 0.7.1
attrs 18.2.0
backcall 0.1.0
beautifulsoup4 4.5.3
binaryornot 0.4.4
bleach 3.1.0
bqplot 0.11.5
CausalInference 0.1.2
certifi 2019.3.9
cffi 1.12.0
chardet 3.0.4
Click 7.0
colorama 0.4.1
cookiecutter 1.6.0
country-converter 0.6.6
cryptography 2.3.1
CVXcanon 0.1.1
cvxpy 1.0.21
cycler 0.10.0
decorator 4.3.2
defusedxml 0.6.0
dill 0.2.9
distro 1.4.0
ecos 2.0.7.post1
entrypoints 0.3
factor-analyzer 0.3.1
fancyimpute 0.4.3
fastcache 1.0.2
future 0.17.1
gast 0.2.2
grpcio 1.20.1
h5py 2.9.0
html-table-extractor 1.3.0
idna 2.8
impyute 0.0.7
ipydatawidgets 4.0.0
ipykernel 5.1.0
ipyscales 0.3.0
ipython 7.2.0
ipython-genutils 0.2.0
ipywidgets 7.4.2
jedi 0.13.2
Jinja2 2.10
jinja2-time 0.2.0
jsonschema 3.0.0a3
jupyter-client 5.2.4
jupyter-core 4.4.0
jupyterlab 0.35.4
jupyterlab-server 0.2.0
Keras 2.2.4
Keras-Applications 1.0.7
Keras-Preprocessing 1.0.9
kiwisolver 1.1.0
knnimpute 0.1.0
lxml 4.3.1
Markdown 3.1
MarkupSafe 1.1.0
matplotlib 3.0.3
missingno 0.4.1
mistune 0.8.4
mkl-fft 1.0.10
mkl-random 1.0.2
mock 2.0.0
multiprocess 0.70.7
nbconvert 5.5.0
nbformat 4.4.0
notebook 5.5.0
np-utils 0.5.10.0
numpy 1.16.3
osqp 0.5.0
packaging 19.0
pandas 0.23.4
pandas-datareader 0.7.0
pandocfilters 1.4.2
parso 0.3.4
patsy 0.5.1
pbr 5.2.0
pickleshare 0.7.5
pip 19.0.2
poyo 0.4.2
prompt-toolkit 2.0.8
protobuf 3.7.1
pyarrow 0.13.0
pycparser 2.19
Pygments 2.3.1
pyOpenSSL 19.0.0
pyparsing 2.4.0
PyPDF2 1.26.0
pyrsistent 0.14.10
PySocks 1.6.8
python-dateutil 2.8.0
pythreejs 2.0.2
pytz 2018.9
pywinpty 0.5.5
PyYAML 5.1
pyzmq 17.1.2
quilt 2.9.15
requests 2.21.0
scikit-learn 0.20.3
scipy 1.2.1
scs 2.1.0
seaborn 0.9.0
Send2Trash 1.5.0
setuptools 40.8.0
six 1.12.0
statsmodels 0.9.0
tabula-py 1.3.1
tensorboard 1.13.1
tensorflow 1.13.1
tensorflow-estimator 1.13.0
termcolor 1.1.0
terminado 0.8.1
testpath 0.4.2
tornado 5.1.1
tqdm 4.31.1
traitlets 4.3.2
traittypes 0.2.1
urllib3 1.24.1
wbdata 0.2.7
wcwidth 0.1.7
webencodings 0.5.1
Werkzeug 0.15.2
wheel 0.33.0
whichcraft 0.5.2
widgetsnbextension 3.4.2
win-inet-pton 1.0.1
wincertstore 0.2
wrapt 1.11.1
xlrd 1.2.0
XlsxWriter 1.1.4
xlwt 1.3.0
Tried to solve the problem by downgrading protobuf to 3.7.0 and tested by directly importing the culprit:
from google.protobuf.pyext import _message
Which gives
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-10-019e0ec86f84> in <module>
----> 1 from google.protobuf.pyext import _message
ImportError: DLL load failed: The specified procedure could not be found.

ipywidgets.embed missing dependencies? Key error when run in venv

I am writing a script that simply asks the google api for the latitudes and longitudes for a list of addresses read in from a csv file and outputs an html with the googlemap widget embedded. Further I hoped to run pyinstaller in order to make this into a .exe.
Running the code on my original conda environment it works fine however the .exe that pyinstaller creates is massive for such a small script (over 300mb). As such, I created a new virtual environment in which to work and have installed what I believe to be the bare minimum packages necessary and have rewritten the code to use as few packages as I am able which for the currently working portion of the code dropped it down considerably to just over 10 mb. (No numpy or pandas for me... ah well).
The code again works fine up until the final step:
from ipywidgets.embed import embed_minimal_html
embed_minimal_html("exporttest.html", None)
The above line should take any widgets, in particular the figure created from
fig = gmaps.figure(layout=figure_layout)
markers = gmaps.marker_layer(coordinates)
fig.add_layer(markers)
fig
Running the currently modified version in my original conda environment with all my of my usual packages installed this runs as expected without errors. Running on the virtual environment however on the mentioned lines I get the following key error:
KeyError Traceback (most recent call last)
c:\programdata\anaconda3\envs\synod_environ\lib\sre_parse.py in
parse_template(source, pattern)
1020 try:
-> 1021 this = chr(ESCAPES[this][1])
1022 except KeyError:
KeyError: '\\u'
During handling of the above exception, another exception occurred:
error Traceback (most recent call last)
<ipython-input-5-3359941239ab> in <module>
1 from ipywidgets.embed import embed_minimal_html
2
----> 3 embed_minimal_html("exporttest.html", None)
...
error: bad escape \u at position 0
(For clarification, key error has two slashes before the u, some frustration in getting this to post correctly)
As the code runs correctly in the one environment but not the other, I can only assume that I'm missing a package somewhere that ipywidgets requires, but running pip check doesn't notify me of anything missing.
pip list returns the following packages:
altgraph 0.16.1
backcall 0.1.0
bleach 3.0.2
certifi 2018.10.15
chardet 3.0.4
colorama 0.4.0
decorator 4.3.0
defusedxml 0.5.0
entrypoints 0.2.3
future 0.17.1
geojson 2.4.1
gmaps 0.8.2
idna 2.7
ipykernel 5.1.0
ipython 7.1.1
ipython-genutils 0.2.0
ipywidgets 7.4.2
jedi 0.13.1
Jinja2 2.10
jsonschema 2.6.0
jupyter 1.0.0
jupyter-client 5.2.3
jupyter-console 6.0.0
jupyter-core 4.4.0
macholib 1.11
MarkupSafe 1.0
mistune 0.8.4
nbconvert 5.4.0
nbformat 4.4.0
notebook 5.7.0
pandocfilters 1.4.2
parso 0.3.1
pefile 2018.8.8
pickleshare 0.7.5
pip 10.0.1
prometheus-client 0.4.2
prompt-toolkit 2.0.7
Pygments 2.2.0
PyInstaller 3.4
python-dateutil 2.7.5
pywin32-ctypes 0.2.0
pywinpty 0.5.4
pyzmq 17.1.2
qtconsole 4.4.2
requests 2.20.0
Send2Trash 1.5.0
setuptools 40.4.3
six 1.11.0
terminado 0.8.1
testpath 0.4.2
tornado 5.1.1
traitlets 4.3.2
urllib3 1.24
wcwidth 0.1.7
webencodings 0.5.1
wheel 0.32.2
widgetsnbextension 3.4.2
wincertstore 0.2
Any thoughts on how to further identify what went wrong, what package might be missing or how to fix the issue, and/or alternate ways to save a googlemaps output?
Fiddling with it and comparing from one environment to the other, I found that my virtual environment had ipywidgets 7.4.2 while the base environment had ipywidgets 7.2.1. Downgrading versions fixed the issue I was having.

ipywidgets.interact giving following error <function __main__.update(f)> despite having recent versions of packages. Detailed breakdown given

Note: for anyone are experiencing the same issue, a temporary work around I am using is found here Bokeh, how to change column used for glyph colors with CustomJS callbacks? although this is not sufficient as the interact feature is needed
Any help and suggestions are appreciated! :) However, do keep in mind I may be restricted due to the setup of our systems. I have provided as extensive help information as I could, do let me know if any other information will help.
I am creating a template for my company with Jupyter notebook and Bokeh. I have been successful so far until this particular issue. The 'interact' method which would allow for a user to change e.g. the colour of the datapoints via a dropdown menu does not load. I have tried many solutions, most of which are consistent with the following:
jupyter nbextension enable --py widgetsnbextension
jupyter nbextension enable --py --sys-prefix widgetsnbextension
Furthermore, I have also tried solutions requested on the following url all the way through but had no luck:
https://github.com/jupyter-widgets/ipywidgets/issues/1745
Code that errors:
import pandas as pd
import numpy as np
#import exmaple dataset
from sklearn import datasets
#import clustering methods
from sklearn.cluster import KMeans
from sklearn.cluster import SpectralClustering
#import Bokeh
import bokeh
from bokeh.plotting import figure
from bokeh.io import output_notebook, show
from bokeh.layouts import widgetbox, gridplot
from bokeh.models import Select, CustomJS, ColumnDataSource
from bokeh.models.widgets import Dropdown
from ipywidgets import interact
from bokeh.io import push_notebook
#Initialise Bokeh into the notebook to display graphs with interactive toolbar
output_notebook()
p3 = figure(title="test", plot_height=300, plot_width=600)
colors = [colormap[x] for x in y]
p3.circle(f1, f2, size=10, color=colors)
h = show(p3, notebook_handle=True)
def update(f):#f=["Actual", "Kmeans", "Spectral"]
colormap = {1: 'red', 2: 'green', 0: 'blue'}
if f == "Actual":
the_x = np.array(list(zip(f1, f2)))
the_y = y
colors = [colormap[x] for x in the_y]
elif f == "Kmeans":
the_x = np.array(list(zip(f1, f2)))
kmeans = KMeans(n_clusters=3)
# Fitting the input data
kmeans = kmeans.fit(the_x)
# Getting the cluster labels
the_y = kmeans.predict(the_x)
colors = [colormap[x] for x in the_y]
elif f == "Spectral":
the_x = np.array(list(zip(f1, f2)))
clustering = SpectralClustering(n_clusters=3, assign_labels="discretize", random_state=0).fit(the_x)
the_y = clustering.labels_
colors = [colormap[x] for x in the_y]
#p3.circle(f1, f2, size=10, color=colors)
push_notebook(handle=h)
interact(update, f=["Actual", "Kmeans", "Spectral"])#this line here
Error displayed:
<function __main__.update(f)>
Versions Information
conda --version
conda 4.5.4
conda info
active environment : bokeh_test_2_1
active env location : /home/xxxxxxx/.conda/envs/bokeh_test_2_1
shell level : 1
user config file : /home/xxxxxxx/.condarc
populated config files : /home/xxxxxxx/.condarc
conda version : 4.5.4
conda-build version : 3.0.27
python version : 2.7.14.final.0
base environment : /opt/cloudera/parcels/Anaconda (read only)
channel URLs : xxxxxxx/current/anaconda-suite/pkgs/linux-64
xxxxxxx/current/anaconda-suite/pkgs/noarch
package cache : /opt/cloudera/parcels/Anaconda/pkgs
/home/xxxxxxx/.conda/pkgs
envs directories : /home/xxxxxxx/.conda/envs
/opt/cloudera/parcels/Anaconda/envs
platform : linux-64
user-agent : conda/4.5.4 requests/2.18.4 CPython/2.7.14 Linux/3.10.0-862.11.6.el7.x86_64 rhel/7.5 glibc/2.17
UID:GID : xxxxxxx
netrc file : None
offline mode : False
jupyter nbextension list
Known nbextensions:
config dir: /home/xxxxxxxx/.conda/envs/bokeh_test_2_1/etc/jupyter/nbconfig
notebook section
jupyter-js-widgets/extension enabled
- Validating: OK
jupyter --paths
config:
/home/xxxxxxxx/.jupyter
/home/xxxxxxxx/.conda/envs/bokeh_test_2_1/etc/jupyter
/usr/local/etc/jupyter
/etc/jupyter
data:
/home/xxxxxxxx/.local/share/jupyter
/home/xxxxxxxx/.conda/envs/bokeh_test_2_1/share/jupyter
/usr/local/share/jupyter
/usr/share/jupyter
runtime:
/home/xxxxxxxx/.local/share/jupyter/runtime
(bokeh_test_2_1) xxxx#xxxx-xxxxxxxxx $ conda list
# packages in environment at /home/xxxxxxxx/.conda/envs/bokeh_test_2_1:
#
# Name Version
_tflow_180_select 3.0
absl-py 0.2.2
astor 0.6.2
backcall 0.1.0
blas 1.0
bleach 1.5.0
bokeh 0.12.16
ca-certificates 2018.03.07
certifi 2018.4.16
dbus 1.13.2
decorator 4.3.0
entrypoints 0.2.3
expat 2.2.5
fontconfig 2.12.6
freetype 2.8
gast 0.2.0
glib 2.56.1
gmp 6.1.2
grpcio 1.11.0
gst-plugins-base 1.14.0
gstreamer 1.14.0
h5py 2.8.0
hdf5 1.10.2
html5lib 0.9999999
icu 58.2
intel-openmp 2018.0.0
ipykernel 4.8.2
ipython 6.4.0
ipython_genutils 0.2.0
ipywidgets 7.2.1
jedi 0.12.0
jinja2 2.10
jpeg 9b
jsonschema 2.6.0
jupyter 1.0.0
jupyter_client 5.2.3
jupyter_console 5.2.0
jupyter_core 4.4.0
keras 2.1.6
libedit 3.1.20170329
libffi 3.2.1
libgcc-ng 7.2.0
libgfortran-ng 7.2.0
libpng 1.6.34
libprotobuf 3.5.2
libsodium 1.0.16
libstdcxx-ng 7.2.0
libxcb 1.13
libxml2 2.9.8
markdown 2.6.11
markupsafe 1.0
mistune 0.8.3
mkl 2018.0.2
mkl_fft 1.0.1
mkl_random 1.0.1
nbconvert 5.3.1
nbformat 4.4.0
ncurses 6.1
notebook 5.5.0
numpy 1.14.3
numpy-base 1.14.3
openssl 1.0.2o
packaging 17.1
pandas 0.23.0
pandoc 1.19.2.1
pandocfilters 1.4.2
parso 0.2.0
pcre 8.42
pexpect 4.5.0
pickleshare 0.7.4
pip 10.0.1
prompt_toolkit 1.0.15
protobuf 3.5.2
ptyprocess 0.5.2
py4j 0.10.6
pygments 2.2.0
pyparsing 2.2.0
pyqt 5.9.2
pyspark 2.3.0
python 3.6.5
python-dateutil 2.7.3
pytz 2018.4
pyyaml 3.12
pyzmq 17.0.0
qt 5.9.5
qtconsole 4.3.1
readline 7.0
scikit-learn 0.19.1
scipy 1.1.0
send2trash 1.5.0
setuptools 39.2.0
simplegeneric 0.8.1
sip 4.19.8
six 1.11.0
sqlite 3.23.1
tensorboard 1.8.0
tensorflow 1.8.0
tensorflow-base 1.8.0
termcolor 1.1.0
terminado 0.8.1
testpath 0.3.1
tk 8.6.7
tornado 5.0.2
traitlets 4.3.2
wcwidth 0.1.7
werkzeug 0.14.1
wheel 0.31.1
widgetsnbextension 3.2.1
xz 5.2.4
yaml 0.1.7
zeromq 4.2.5
zlib 1.2.11

import matplotlib.pyplot as plt, ImportError: libGL.so.1: cannot open shared object file: No such file or directory

import matplotlib.pyplot as plt is erroring with python2.7, anaconda3.
The error is ImportError: libGL.so.1: cannot open shared object file: No such file or directory
Error report
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/serving/anaconda3/envs/python27/lib/python2.7/site-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/serving/anaconda3/envs/python27/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "/serving/anaconda3/envs/python27/lib/python2.7/site-packages/matplotlib/backends/backend_qt5agg.py", line 16, in <module>
from .backend_qt5 import QtCore
File "/serving/anaconda3/envs/python27/lib/python2.7/site-packages/matplotlib/backends/backend_qt5.py", line 26, in <module>
import matplotlib.backends.qt_editor.figureoptions as figureoptions
File "/serving/anaconda3/envs/python27/lib/python2.7/site-packages/matplotlib/backends/qt_editor/figureoptions.py", line 20, in <module>
import matplotlib.backends.qt_editor.formlayout as formlayout
File "/serving/anaconda3/envs/python27/lib/python2.7/site-packages/matplotlib/backends/qt_editor/formlayout.py", line 56, in <module>
from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore
File "/serving/anaconda3/envs/python27/lib/python2.7/site-packages/matplotlib/backends/qt_compat.py", line 128, in <module>
from PyQt5 import QtCore, QtGui, QtWidgets
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
conda list is
$conda list
cairo 1.14.8 0 defaults
certifi 2016.2.28 py27_0 defaults
cycler 0.10.0 py27_0 defaults
dbus 1.10.20 0 defaults
expat 2.1.0 0 defaults
fontconfig 2.12.1 3 defaults
freetype 2.5.5 2 defaults
functools32 3.2.3.2 py27_0 defaults
glib 2.50.2 1 defaults
gst-plugins-base 1.8.0 0 defaults
gstreamer 1.8.0 0 defaults
harfbuzz 0.9.39 2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
icu 54.1 0 defaults
jpeg 9b 0 defaults
libffi 3.2.1 1 defaults
libgcc 5.2.0 0 defaults
libgfortran 3.0.0 1 defaults
libiconv 1.14 0 defaults
libpng 1.6.30 1 defaults
libxcb 1.12 1 defaults
libxml2 2.9.4 0 defaults
matplotlib 2.0.2 np113py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
mkl 2017.0.3 0 defaults
numpy 1.13.1 py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
openssl 1.0.2l 0 defaults
pandas 0.20.3 py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
pango 1.40.3 1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
patsy 0.4.1 py27_0 defaults
pcre 8.39 1 defaults
pip 9.0.1 py27_1 defaults
pixman 0.34.0 0 defaults
pycairo 1.10.0 py27_0 defaults
pyparsing 2.2.0 py27_0 defaults
pyqt 5.6.0 py27_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
python 2.7.13 0 defaults
python-dateutil 2.6.1 py27_0 defaults
pytz 2017.2 py27_0 defaults
qt 5.6.2 5 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
qt5 5.3.1 1 dsdale24
readline 6.2 2 defaults
scikit-learn 0.19.0 np113py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
scipy 0.19.1 np113py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
setuptools 36.4.0 py27_1 defaults
sip 4.18 py27_0 defaults
six 1.10.0 py27_0 defaults
sqlite 3.13.0 0 defaults
statsmodels 0.8.0 np113py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
subprocess32 3.2.7 py27_0 defaults
tk 8.5.18 0 defaults
wheel 0.29.0 py27_0 defaults
zlib 1.2.11 0 defaults
(python27)
Below commands worked for me:
sudo apt update
sudo apt install libgl1-mesa-glx
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
this worked for me
Answer by Dhanisha works fine, as i am adding explanation on top off it
remove
import matplotlib.pyplot as plt
add
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
The reason behind such behavior is if you are running it on server switch do not have gui support or non interactive mode. If you run same code on jupyter notebook, it would work fine.
see below links
https://matplotlib.org/faq/howto_faq.html
https://github.com/matplotlib/matplotlib/issues/9954

Ipython %matplotlib gives "ImportError: No module named moves" despite having moves installed via pip

This one is driving me crazy. I have searched the internet for clues but non of the many threads of the type "ImportError: No module named xxxxxx" has proven very useful.
I had previously Python2.7 installed.
Then I installed Anaconda python, added $HOME/anaconda/bin to the PATH and launched ipython notebook
Python 2.7.9 |Anaconda 2.2.0 (x86_64)| (default, Dec 15 2014, 10:37:34)
Type "copyright", "credits" or "license" for more information.
IPython 3.1.0 -- An enhanced Interactive Python.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
[TerminalIPythonApp] Loading IPython extension: storemagic
Everything works until running the magic %matplotlib inline which generates the following error message:
In [5]: %matplotlib inline
Reloading __future__
Reloading six
Reloading functools
Reloading _functools
Reloading itertools
Reloading operator
Reloading types
Reloading StringIO
Reloading errno
Reloading matplotlib
Reloading distutils
Reloading distutils.version
Reloading distutils.string
Reloading string
Reloading re
Reloading sre_compile
Reloading _sre
Reloading sre_parse
Reloading sre_constants
Reloading _locale
Reloading copy_reg
Reloading strop
Reloading distutils.re
Reloading distutils.types
Reloading dateutil
Reloading pyparsing
Reloading weakref
Reloading UserDict
Reloading _abcoll
Reloading abc
Reloading _weakrefset
Reloading _weakref
Reloading exceptions
Reloading copy
Reloading org
Reloading warnings
Reloading linecache
Reloading os
Reloading posix
Reloading posixpath
Reloading stat
Reloading genericpath
Reloading _warnings
Reloading collections
Reloading _collections
Reloading keyword
Reloading heapq
Reloading _heapq
Reloading thread
Reloading pprint
Reloading cStringIO
Reloading urllib
Reloading socket
Reloading _socket
Reloading _ssl
Reloading time
Reloading base64
Reloading struct
Reloading _struct
Reloading binascii
Reloading urlparse
Reloading ssl
Reloading textwrap
Reloading contextlib
Reloading _scproxy
Reloading urllib.request
Reloading urllib2
Reloading hashlib
Reloading _hashlib
Reloading httplib
Reloading array
Reloading mimetools
Reloading tempfile
Reloading io
Reloading _io
Reloading random
Reloading math
Reloading _random
Reloading fcntl
Reloading rfc822
Reloading bisect
Reloading _bisect
Reloading distutils.sysconfig
Reloading distutils.os
Reloading distutils.sys
Reloading distutils.distutils
Reloading distutils.errors
Reloading matplotlib.cbook
Reloading six.moves
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-1e0aba8000a6> in <module>()
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2305 magic_name, _, magic_arg_s = arg_s.partition(' ')
2306 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2307 return self.run_line_magic(magic_name, magic_arg_s)
2308
2309 #-------------------------------------------------------------------------
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
2226 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2227 with self.builtin_trap:
-> 2228 result = fn(*args,**kwargs)
2229 return result
2230
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/core/magics/pylab.pyc in matplotlib(self, line)
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
191 # but it's overkill for just that one bit of state.
192 def magic_deco(arg):
--> 193 call = lambda f, *a, **k: f(*a, **k)
194
195 if callable(arg):
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/core/magics/pylab.pyc in matplotlib(self, line)
86 """
87 args = magic_arguments.parse_argstring(self.matplotlib, line)
---> 88 gui, backend = self.shell.enable_matplotlib(args.gui)
89 self._show_matplotlib_backend(args.gui, backend)
90
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in enable_matplotlib(self, gui)
3099 gui, backend = pt.find_gui_and_backend(self.pylab_gui_select)
3100
-> 3101 pt.activate_matplotlib(backend)
3102 pt.configure_inline_support(self, backend)
3103
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in activate_matplotlib(backend)
273
274 import matplotlib.pyplot
--> 275 matplotlib.pyplot.switch_backend(backend)
276
277 # This must be imported last in the matplotlib series, after
/Users/mtoots/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.pyc in switch_backend(newbackend)
131 close('all')
132 global _backend_mod, new_figure_manager, draw_if_interactive, _show
--> 133 matplotlib.use(newbackend, warn=False, force=True)
134 from matplotlib.backends import pylab_setup
135 _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
/Users/mtoots/anaconda/lib/python2.7/site-packages/matplotlib/__init__.pyc in use(arg, warn, force)
1331 # module import. See backends/__init__.py for more detail.
1332 if need_reload:
-> 1333 reload(sys.modules['matplotlib.backends'])
1334
1335 def get_backend():
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/lib/deepreload.pyc in reload(module, exclude)
339 try:
340 with replace_import_hook(deep_import_hook):
--> 341 return deep_reload_hook(module)
342 finally:
343 found_now = {}
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/lib/deepreload.pyc in deep_reload_hook(m)
309
310 try:
--> 311 newm = imp.load_module(name, fp, filename, stuff)
312 except:
313 # load_module probably removed name from modules because of
/Users/mtoots/anaconda/lib/python2.7/site-packages/matplotlib/backends/__init__.pyc in <module>()
4 import six
5
----> 6 import matplotlib
7 import inspect
8 import warnings
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/lib/deepreload.pyc in deep_import_hook(name, globals, locals, fromlist, level)
250 parent, buf = get_parent(globals, level)
251
--> 252 head, name, buf = load_next(parent, None if level < 0 else parent, name, buf)
253
254 tail = head
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/lib/deepreload.pyc in load_next(mod, altmod, name, buf)
154 buf += subname
155
--> 156 result = import_submodule(mod, subname, buf)
157 if result is None and mod != altmod:
158 result = import_submodule(altmod, subname, subname)
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/lib/deepreload.pyc in import_submodule(mod, subname, fullname)
199
200 try:
--> 201 m = imp.load_module(fullname, fp, filename, stuff)
202 except:
203 # load_module probably removed name from modules because of
/Users/mtoots/anaconda/lib/python2.7/site-packages/matplotlib/__init__.pyc in <module>()
178 # cbook must import matplotlib only within function
179 # definitions, so it is safe to import from it here.
--> 180 from matplotlib.cbook import is_string_like
181 from matplotlib.compat import subprocess
182
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/lib/deepreload.pyc in deep_import_hook(name, globals, locals, fromlist, level)
254 tail = head
255 while name:
--> 256 tail, name, buf = load_next(tail, tail, name, buf)
257
258 # If tail is None, both get_parent and load_next found
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/lib/deepreload.pyc in load_next(mod, altmod, name, buf)
154 buf += subname
155
--> 156 result = import_submodule(mod, subname, buf)
157 if result is None and mod != altmod:
158 result = import_submodule(altmod, subname, subname)
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/lib/deepreload.pyc in import_submodule(mod, subname, fullname)
199
200 try:
--> 201 m = imp.load_module(fullname, fp, filename, stuff)
202 except:
203 # load_module probably removed name from modules because of
/Users/mtoots/anaconda/lib/python2.7/site-packages/matplotlib/cbook.pyc in <module>()
11
12 import six
---> 13 from six.moves import xrange, zip
14 from itertools import repeat
15
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/lib/deepreload.pyc in deep_import_hook(name, globals, locals, fromlist, level)
254 tail = head
255 while name:
--> 256 tail, name, buf = load_next(tail, tail, name, buf)
257
258 # If tail is None, both get_parent and load_next found
/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/lib/deepreload.pyc in load_next(mod, altmod, name, buf)
161
162 if result is None:
--> 163 raise ImportError("No module named %.200s" % name)
164
165 return result, next, buf
ImportError: No module named moves
Running conda list gives the following list of installed packages
/Users/mtoots> conda list
# packages in environment at /Users/mtoots/anaconda:
#
_license 1.1 py27_0
abstract-rendering 0.5.1 np19py27_0
anaconda 2.2.0 np19py27_0
appscript 1.0.1 py27_0
argcomplete 0.8.4 py27_0
astropy 1.0.1 np19py27_0
backports.ssl-match-hostname 3.4.0.2 <pip>
bcolz 0.8.1 np19py27_0
beautiful-soup 4.3.2 py27_0
beautifulsoup 3.2.1 <pip>
beautifulsoup4 4.3.2 <pip>
binstar 0.10.1 py27_3
bitarray 0.8.1 py27_0
blaze 0.7.3 <pip>
blaze-core 0.7.3 np19py27_0
blz 0.6.2 np19py27_0
bokeh 0.8.1 np19py27_1
boto 2.36.0 py27_0
cdecimal 2.3 py27_0
certifi 14.05.14 py27_0
cffi 0.9.2 py27_0
clyent 0.3.4 py27_0
colorama 0.3.3 py27_0
conda 3.12.0 py27_0
conda-build 1.11.0 py27_0
conda-env 2.1.4 py27_0
configobj 5.0.6 py27_0
cryptography 0.8 py27_0
curl 7.38.0 0
cython 0.22 py27_0
cytoolz 0.7.2 py27_0
datashape 0.4.4 np19py27_1
dateutil 2.4.1 py27_0
decorator 3.4.0 py27_0
docutils 0.12 py27_0
dynd-python 0.6.5 np19py27_0
enum34 1.0.4 py27_0
fastcache 1.0.2 py27_0
filechunkio 1.6 <pip>
flask 0.10.1 py27_1
freetype 2.5.2 1
funcsigs 0.4 py27_0
futures 2.2.0 py27_0
gevent 1.0.1 py27_0
gevent-websocket 0.9.3 py27_0
greenlet 0.4.5 py27_0
grin 1.2.1 py27_1
h5py 2.4.0 np19py27_0
hdf5 1.8.14 0
ipython 3.1.0 py27_0
ipython-notebook 3.0.0 py27_1
ipython-qtconsole 3.0.0 py27_0
itsdangerous 0.24 py27_0
jdcal 1.0 py27_0
jedi 0.8.1 py27_0
jinja2 2.7.3 py27_1
jpeg 8d 1
jsonschema 2.4.0 py27_0
launcher 1.0.0 2
libdynd 0.6.5 0
libpng 1.5.13 1
libsodium 0.4.5 0
libtiff 4.0.2 1
libxml2 2.9.0 1
libxslt 1.1.28 2
llvmlite 0.2.2 py27_1
lxml 3.4.2 py27_0
markupsafe 0.23 py27_0
matplotlib 1.4.3 np19py27_1
mistune 0.5.1 py27_0
mock 1.0.1 py27_0
moves 0.1 <pip>
mrjob 0.4.4 <pip>
multipledispatch 0.4.7 py27_0
networkx 1.9.1 py27_0
nltk 3.0.2 np19py27_0
node-webkit 0.10.1 0
nose 1.3.4 py27_1
numba 0.17.0 np19py27_0
numexpr 2.3.1 np19py27_0
numpy 1.9.2 py27_0
odo 0.3.1 np19py27_0
openpyxl 1.8.5 py27_0
openssl 1.0.1k 1
pandas 0.15.2 np19py27_1
patsy 0.3.0 np19py27_0
pattern 2.6 <pip>
pep8 1.6.2 py27_0
pillow 2.7.0 py27_1
pip 6.1.1 py27_0
ply 3.4 py27_0
psutil 2.2.1 py27_0
ptyprocess 0.4 py27_0
py 1.4.26 py27_0
pyasn1 0.1.7 py27_0
pyaudio 0.2.7 py27_0
pycosat 0.6.1 py27_0
pycparser 2.10 py27_0
pycrypto 2.6.1 py27_0
pycurl 7.19.5.1 py27_0
pyflakes 0.8.1 py27_0
pygments 2.0.2 py27_0
pyopenssl 0.14 py27_0
pyparsing 2.0.3 py27_0
pyqt 4.11.3 py27_0
pytables 3.1.1 np19py27_2
pytest 2.6.4 py27_0
python 2.7.9 1
python-dateutil 2.4.2 py27_0
python.app 1.2 py27_3
pytz 2015.2 py27_0
pyyaml 3.11 py27_0
pyzmq 14.5.0 py27_0
qt 4.8.6 0
readline 6.2 2
redis 2.6.9 0
redis-py 2.10.3 py27_0
requests 2.7.0 py27_0
rope 0.9.4 py27_1
runipy 0.1.3 py27_0
scikit-image 0.11.2 np19py27_0
scikit-learn 0.15.2 np19py27_0
scipy 0.15.1 np19py27_0
seaborn 0.5.1 <pip>
setuptools 15.2 py27_0
simplejson 3.6.5 <pip>
sip 4.16.5 py27_0
six 1.9.0 py27_0
sockjs-tornado 1.0.1 py27_0
sphinx 1.2.3 py27_0
spyder 2.3.4 py27_1
spyder-app 2.3.4 py27_0
sqlalchemy 0.9.9 py27_0
sqlite 3.8.4.1 1
ssl_match_hostname 3.4.0.2 py27_0
statsmodels 0.6.1 np19py27_0
sympy 0.7.6 py27_0
tables 3.1.1 <pip>
terminado 0.5 py27_0
tk 8.5.18 0
toolz 0.7.1 py27_0
tornado 4.1 py27_0
ujson 1.33 py27_0
unicodecsv 0.9.4 py27_0
werkzeug 0.10.1 py27_0
xlrd 0.9.3 py27_0
xlsxwriter 0.6.7 py27_0
xlwings 0.3.4 py27_0
xlwt 0.7.5 py27_0
yaml 0.1.4 1
zeromq 4.0.4 0
zlib 1.2.8 0
And sys.path prints the following
In [1]: import sys
In [2]: sys.path
Out[2]:
['',
'/Users/mtoots/anaconda/bin',
'/Users/mtoots/anaconda/lib/python27.zip',
'/Users/mtoots/anaconda/lib/python2.7',
'/Users/mtoots/anaconda/lib/python2.7/plat-darwin',
'/Users/mtoots/anaconda/lib/python2.7/plat-mac',
'/Users/mtoots/anaconda/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/mtoots/anaconda/lib/python2.7/lib-tk',
'/Users/mtoots/anaconda/lib/python2.7/lib-old',
'/Users/mtoots/anaconda/lib/python2.7/lib-dynload',
'/Users/mtoots/anaconda/lib/python2.7/site-packages',
'/Users/mtoots/anaconda/lib/python2.7/site-packages/Sphinx-1.2.3-py2.7.egg',
'/Users/mtoots/anaconda/lib/python2.7/site-packages/aeosa',
'/Users/mtoots/anaconda/lib/python2.7/site-packages/cryptography-0.8-py2.7-macosx-10.5-x86_64.egg',
'/Users/mtoots/anaconda/lib/python2.7/site-packages/setuptools-15.2-py2.7.egg',
'/Users/mtoots/anaconda/lib/python2.7/site-packages/IPython/extensions',
'/Users/mtoots/.ipython']
What exactly is causing the error here? The moves package seems to be installed and so does six. What does it mean that the moves package in the conda list has <pip> in the third column?
I suppose you have two ipythons installed, check which of them is running on linux shell:
$ where ipython
if you find the the non-anaconda is running, clean the 'pure python'
$ sudo pip uninstall ipython
and check the path to see if you have the binaries pointing to the anaconda ipython, as in my case, you can see /home/henry/anaconda3/bin
$ echo $PATH
$ /usr/local/heroku/bin:/home/henry/.cabal/bin:/home/henry/Library/Haskell/bin:/home/henry/.bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/henry/bin/scala/bin:/home/henry/anaconda3/bin:/home/henry/bin/rebar3
I have found another solution to that issue. Mainly, you can comment out/remove just this line from ipython_config.py in profile_default
c.InteractiveShell.deep_reload = True
Intro:
Why things went more complex while Anaconda package manager promised it's ultimate ability to simplify python packages' maintenance nightmares?
Well python herd has suffered throughout the first decade due to an absence of some universally working (a jack-of-all-trades) package management tool.
Needless to repeat what that cost for maintaining multiple dev/test/prod environments, spanning across multiple O/S families/versions & endless list of all configuration constellations.
Happily, [Anaconda] + conda Toolkit is a feasible solution for this.
Plus, [Anaconda]/conda concept has brought a working illusion of having multiple separable constellations of [python]+[a-set-of-deployed-packages] ( called an environment and both named & switch-on/off managed ) so as to be able to have one application and many (alternating one after another) [ python+environment ] test-bed(s) to verify & validata your code RTO state.
Q:What exactly is causing the error here?
The moves package seems to be installed and so does six, which on first look sounds positive, however - [Anaconda] documentation offers & recommends not to mix conda-driven package installations/updates/removals/etc with any other approach ( incl. the pip install ones )
Q:What does it mean that the moves package in the conda list has <pip> in the third column?
Yes, right the issue noted above. Best to check [Anaconda] sources for details on package-management best practices & working approaches.

Categories

Resources