Having some errors when attempting to run import numpy as np inside the IPython notebook environment. I assume that the Enthought Canopy package is borked, any tips would be much appreciated!
ImportError Traceback (most recent call last)
<ipython-input-2-140a5caba752> in <module>()
----> 1 import numpy as np
2 import scipy
3 import matplotlib as mpl
/Users/iMacHome/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/__init__.pyc in <module>()
141 return loader(*packages, **options)
142
--> 143 import add_newdocs
144 __all__ = ['add_newdocs']
145
/Users/iMacHome/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/add_newdocs.py in <module>()
7 # core/fromnumeric.py, core/defmatrix.py up-to-date.
8
----> 9 from numpy.lib import add_newdoc
10
11 ###############################################################################
Reset your Canopy Python User environment by deleting /Users/iMacHome/Library/Enthought/, and restarting the Canopy GUI (to re-initialize the environment), then try again. If that doesn't do it, consider the possibility that you are cross-linking with another Python installation. To test this, what is your sys.prefix and sys.path in ipython?
Related
When I try to import tensorflow_federated I got this error, anyone has the idea why?
ImportError Traceback (most recent call last)
<ipython-input-6-a23308ec3f7c> in <module>()
3 import numpy as np
4 import tensorflow as tf
----> 5 import tensorflow_federated as tff
6
7 np.random.seed(0)
17 frames
/usr/local/lib/python3.7/dist-packages/keras/api/_v1/keras/mixed_precision/experimental/__init__.py in <module>()
6 import sys as _sys
7
----> 8 from keras.mixed_precision.loss_scale_optimizer import LossScaleOptimizerV1 as LossScaleOptimizer
9 from tensorflow.python.util import module_wrapper as _module_wrapper
10
ImportError: cannot import name 'LossScaleOptimizerV1' from 'keras.mixed_precision.loss_scale_optimizer' (/usr/local/lib/python3.7/dist-packages/keras/mixed_precision/loss_scale_optimizer.py)
Found the solution, I did this on Google Colab. I just uninstall keras version that was already installed by Colab and reinstall the latest version.
I'm facing the following erro:
ImportError Traceback (most recent call last)
<ipython-input-1-0484cd13f94d> in <module>
----> 1 import matplotlib
~\Anaconda3\lib\site-packages\matplotlib\__init__.py in <module>
105 # cbook must import matplotlib only within function
106 # definitions, so it is safe to import from it here.
--> 107 from . import cbook, rcsetup
108 from matplotlib.cbook import MatplotlibDeprecationWarning, sanitize_sequence
109 from matplotlib.cbook import mplDeprecation # deprecated
~\Anaconda3\lib\site-packages\matplotlib\rcsetup.py in <module>
24 import numpy as np
25
---> 26 from matplotlib import animation, cbook
27 from matplotlib.cbook import ls_mapper
28 from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
ImportError: cannot import name 'animation' from partially initialized module 'matplotlib'
I've removed matplotlib and then reinstalled it. I've also tried to use pip install matplotlib --force-reinstall --user command, but the error persists. The most curious is that matplotlib runs properly when I run Python in Windows Prompt Command, but not in Jupyter or Spider. I cant use admin privileges. Im running python 3.8.5 and matplotlib 3.4.2.
Im trying to import Dropbox with the line:
import dropbox
on Google Colab but im getting the following error:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-26-fac67f6fa745> in <module>()
28 import math
29 import io
---> 30 import dropbox
31 from keras.models import Sequential
32 from keras.layers import Dense
2 frames
/usr/local/lib/python3.6/dist-packages/dropbox/auth.py in <module>()
5 # pylint: skip-file
6 from __future__ import unicode_literals
----> 7 from stone.backends.python_rsrc import stone_base as bb
8 from stone.backends.python_rsrc import stone_validators as bv
9
ModuleNotFoundError: No module named 'stone'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
It was working perfectly normal a day ago
The problem is that a new release of Dropbox API was out today and it has that glitch. Just used the version before today by using
pip install dropbox==10.10.0
I just installed Anaconda 4.3.23 with Python 3 64 bit. I created virtual environment and installed conda install matplotlib. When I execute import matplotlib.pyplot as plt I get back the following error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-3-2d703b067d13> in <module>()
2 import numpy as np
3 import tensorflow as tf
----> 4 import matplotlib.pyplot as plt
~\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\matplotlib\__init__.py in <module>()
122 from matplotlib.cbook import is_string_like, mplDeprecation, dedent, get_label
123 from matplotlib.compat import subprocess
--> 124 from matplotlib.rcsetup import (defaultParams,
125 validate_backend,
126 cycler)
~\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\matplotlib\rcsetup.py in <module>()
35
36 # Don't let the original cycler collide with our validating cycler
---> 37 from cycler import Cycler, cycler as ccycler
38
39 # interactive_bk = ['gtk', 'gtkagg', 'gtkcairo', 'qt4agg',
ImportError: No module named 'cycler'
I tried running conda install cycler, but got back:
# All requested packages already installed.
# packages in environment at C:\Users\test\AppData\Local\conda\conda\envs\tensorflow:
#
cycler 0.10.0 py35_0 conda-forge
I ran all above under newly created virtual environment tensorflow. Any thoughts?
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/Users/CJL/anaconda3/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py in <module>()
4 try:
----> 5 from tensorflow.python.ops import ctc_ops as ctc
6 except ImportError:
ImportError: cannot import name 'ctc_ops'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-10-c74e2bd4ca71> in <module>()
----> 1 import keras
/Users/CJL/anaconda3/lib/python3.5/site-packages/keras/__init__.py in <module>()
1 from __future__ import absolute_import
----> 2 from . import backend
3 from . import datasets
4 from . import engine
5 from . import layers
/Users/CJL/anaconda3/lib/python3.5/site-packages/keras/backend/__init__.py in <module>()
67 elif _BACKEND == 'tensorflow':
68 sys.stderr.write('Using TensorFlow backend.\n')
---> 69 from .tensorflow_backend import *
70 else:
71 raise Exception('Unknown backend: ' + str(_BACKEND))
/Users/CJL/anaconda3/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py in <module>()
5 from tensorflow.python.ops import ctc_ops as ctc
6 except ImportError:
----> 7 import tensorflow.contrib.ctc as ctc
8
9 import numpy as np
ImportError: No module named 'tensorflow.contrib.ctc'
Seems like is an problem with Keras and not Tensorflow according to this post enter link description here
I was wondering if this has been fixed yet?
This is a problem between Keras and tensorflow. You should change this fix to use something like
if hasattr(tf.contrib, 'ctc'):
ctc = tf.contrib.ctc # old version
else:
ctc = tf.nn # New official version.
The current "official" way to access the ctc operations are in tf.nn, for instance, tf.nn.ctc_loss.
If keras is giving an import problem and you are facing "no module named keras" even if you have installed it.
Just upgrade your pip by:
python -m pip install –upgrade pip
Re-install upgraded keras and tensorflow by:
pip install keras
pip install tensorflow
Hope it will solve the problem. If not, try upgrading your conda (Anaconda) and then do steps 1 to 3 above again.