I don't why but I am now experiencing this issue on mac. I installed everything trough anaconda. Everything was working fine before a Restart of the system
import fiona
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-8-4c762272c079> in <module>
----> 1 import fiona
/anaconda3/lib/python3.6/site-packages/fiona/__init__.py in <module>
81 os.environ["PATH"] = os.environ["PATH"] + ";" + libdir
82
---> 83 from fiona.collection import BytesCollection, Collection
84 from fiona.drvsupport import supported_drivers
85 from fiona.env import ensure_env_with_credentials, Env
/anaconda3/lib/python3.6/site-packages/fiona/collection.py in <module>
7
8 from fiona import compat, vfs
----> 9 from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
10 from fiona.ogrext import Session, WritingSession
11 from fiona.ogrext import buffer_to_virtual_file, remove_virtual_file, GEOMETRY_TYPES
ImportError: dlopen(/anaconda3/lib/python3.6/site-packages/fiona/ogrext.cpython-36m-darwin.so, 2): Library not loaded: #rpath/libpoppler.76.dylib
Referenced from: /anaconda3/lib/libgdal.20.dylib
Reason: image not found
Related
I am using python from a anaconda installation and using the python
notebook. From the jupyer notebook (ipython) I import fssa like:
import fssa
I get the following error message (see below).
Any help from you will be appreciated.
I have tried uninstalling and reinstalling scipy, numpy, and fssa and reinstalling
them, but the problem seems to remain.
ImportError Traceback (most recent call last)
/tmp/ipykernel_218856/781571052.py in <module>
----> 1 import fssa
~/anaconda3/lib/python3.9/site-packages/fssa/__init__.py in <module>
82
83 import pkg_resources
---> 84 from .fssa import scaledata, quality, autoscale
85
86 __version__ = pkg_resources.get_distribution(__name__).version
~/anaconda3/lib/python3.9/site-packages/fssa/fssa.py in <module>
46 import scipy.optimize
47
---> 48 from .optimize import _minimize_neldermead
49
50
~/anaconda3/lib/python3.9/site-packages/fssa/optimize.py in <module>
11 import numpy
12 from numpy import asfarray
---> 13 from scipy.optimize.optimize import (OptimizeResult,
14 _status_message, wrap_function)
15
ImportError: cannot import name 'wrap_function' from 'scipy.optimize.optimize'
(/home/debasish/anaconda3/lib/python3.9/site-packages/scipy/optimize/optimize.py)
I installed scikit-learn library in python using the command
pip install -U scikit-learn
When I am trying to import the library or it's module like
from sklearn.model_selection import train_test_split
or simply import sklearn
I am getting the error
ImportError Traceback (most recent call last)
<ipython-input-24-73edc048c06b> in <module>()
----> 1 from sklearn.model_selection import train_test_split
c:\users\ajain9\appdata\local\programs\python\python36-32\lib\site-packages\sklearn\__init__.py in <module>()
132 else:
133 from . import __check_build
--> 134 from .base import clone
135 __check_build # avoid flakes unused variable error
136
c:\users\ajain9\appdata\local\programs\python\python36-32\lib\site-packages\sklearn\base.py in <module>()
11 from scipy import sparse
12 from .externals import six
---> 13 from .utils.fixes import signature
14 from . import __version__
15
c:\users\ajain9\appdata\local\programs\python\python36-32\lib\site-packages\sklearn\utils\__init__.py in <module>()
7 import warnings
8
----> 9 from .murmurhash import murmurhash3_32
10 from .validation import (as_float_array,
11 assert_all_finite,
ImportError: cannot import name 'murmurhash3_32'
Any reason this error might be happening?
I am using Python version 3.6.3 Numpy v 1.13.3 pandas v 0.21.0
I am using windows
Try using virutalenv and install all the libraries required there, it worked for me.
I got this erreur when I've tried to import scikit learn to my python 3.5 (jupyter notebook):
from sklearn.model_selection import train_test_split
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-5-139cc3505715> in <module>()
----> 1 from sklearn.model_selection import train_test_split
/opt/Anaconda/Anaconda3-4.2.0/lib/python3.5/site-packages/sklearn/__init__.py in <module>()
55 else:
56 from . import __check_build
---> 57 from .base import clone
58 __check_build # avoid flakes unused variable error
59
/opt/Anaconda/Anaconda3-4.2.0/lib/python3.5/site-packages/sklearn/base.py in <module>()
10 from scipy import sparse
11 from .externals import six
---> 12 from .utils.fixes import signature
13 from .utils.deprecation import deprecated
14 from .exceptions import ChangedBehaviorWarning as _ChangedBehaviorWarning
/opt/Anaconda/Anaconda3-4.2.0/lib/python3.5/site-packages/sklearn/utils/__init__.py in <module>()
9
10 from .murmurhash import murmurhash3_32
---> 11 from .validation import (as_float_array,
12 assert_all_finite,
13 check_random_state, column_or_1d, check_array,
/opt/Anaconda/Anaconda3-4.2.0/lib/python3.5/site-packages/sklearn/utils/validation.py in <module>()
16
17 from ..externals import six
---> 18 from ..utils.fixes import signature
19 from .deprecation import deprecated
20 from ..exceptions import DataConversionWarning as _DataConversionWarning
/opt/Anaconda/Anaconda3-4.2.0/lib/python3.5/site-packages/sklearn/utils/fixes.py in <module>()
289 from ._scipy_sparse_lsqr_backport import lsqr as sparse_lsqr
290 else:
--> 291 from scipy.sparse.linalg import lsqr as sparse_lsqr
292
293
/opt/Anaconda/Anaconda3-4.2.0/lib/python3.5/site-packages/scipy/sparse/linalg/__init__.py in <module>()
110 from __future__ import division, print_function, absolute_import
111
--> 112 from .isolve import *
113 from .dsolve import *
114 from .interface import *
/opt/Anaconda/Anaconda3-4.2.0/lib/python3.5/site-packages/scipy/sparse/linalg/isolve/__init__.py in <module>()
4
5 #from info import __doc__
----> 6 from .iterative import *
7 from .minres import minres
8 from .lgmres import lgmres
/opt/Anaconda/Anaconda3-4.2.0/lib/python3.5/site-packages/scipy/sparse/linalg/isolve/iterative.py in <module>()
5 __all__ = ['bicg','bicgstab','cg','cgs','gmres','qmr']
6
----> 7 from . import _iterative
8
9 from scipy.sparse.linalg.interface import LinearOperator
ImportError: libquadmath.so.0: cannot open shared object file: No such file or directory
the scikit learn 0.18.2 package is already installed and I can see it on the list when I run conda list(I got the same error with the last version 0.19.1).
I work with the Anaconda 3 (conda 4.2.2)
you'r python installation has missing dynamically linked shared library which is used by scipy.
generally when you install anaconda under lib directory this shared objects are present and respective paths are exported in environment for dynamic linking.
check if this files are there under the lib directory of your anaconda installation.
e.g:-
/anaconda3/lib/libquadmath.0.dylib
if it is not there then please reinstall anaconda it will solve your problem.
if this file exists then please check your environment path. which must have anaconda installation path in there list.
I have Anaconda installed on OS X. I am able to import sklearn from a python terminal and an IPython terminal. But when I try to import sklearn from a Jupyter notebook, I get the following error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-4-8fd979e02004> in <module>()
----> 1 import sklearn
/Users/joe/anaconda/envs/data_env/lib/python3.5/site-packages/sklearn/__init__.py in <module>()
55 else:
56 from . import __check_build
---> 57 from .base import clone
58 __check_build # avoid flakes unused variable error
59
/Users/joe/anaconda/envs/data_env/lib/python3.5/site-packages/sklearn/base.py in <module>()
10 from scipy import sparse
11 from .externals import six
---> 12 from .utils.fixes import signature
13 from .utils.deprecation import deprecated
14 from .exceptions import ChangedBehaviorWarning as _ChangedBehaviorWarning
/Users/joe/anaconda/envs/data_env/lib/python3.5/site-packages/sklearn/utils/__init__.py in <module>()
9
10 from .murmurhash import murmurhash3_32
---> 11 from .validation import (as_float_array,
12 assert_all_finite,
13 check_random_state, column_or_1d, check_array,
/Users/joe/anaconda/envs/data_env/lib/python3.5/site-packages/sklearn/utils/validation.py in <module>()
16
17 from ..externals import six
---> 18 from ..utils.fixes import signature
19 from .deprecation import deprecated
20 from ..exceptions import DataConversionWarning as _DataConversionWarning
/Users/joe/anaconda/envs/data_env/lib/python3.5/site-packages/sklearn/utils/fixes.py in <module>()
288 from ._scipy_sparse_lsqr_backport import lsqr as sparse_lsqr
289 else:
--> 290 from scipy.sparse.linalg import lsqr as sparse_lsqr
291
292
/Users/joe/anaconda/envs/data_env/lib/python3.5/site-packages/scipy/sparse/linalg/__init__.py in <module>()
110 from __future__ import division, print_function, absolute_import
111
--> 112 from .isolve import *
113 from .dsolve import *
114 from .interface import *
/Users/joe/anaconda/envs/data_env/lib/python3.5/site-packages/scipy/sparse/linalg/isolve/__init__.py in <module>()
4
5 #from info import __doc__
----> 6 from .iterative import *
7 from .minres import minres
8 from .lgmres import lgmres
/Users/joe/anaconda/envs/data_env/lib/python3.5/site-packages/scipy/sparse/linalg/isolve/iterative.py in <module>()
5 __all__ = ['bicg','bicgstab','cg','cgs','gmres','qmr']
6
----> 7 from . import _iterative
8
9 from scipy.sparse.linalg.interface import LinearOperator
ImportError: dlopen(/Users/joe/anaconda/envs/data_env/lib/python3.5/site-packages/scipy/sparse/linalg/isolve/_iterative.so, 2): Library not loaded: /usr/local/lib/libgcc_s.1.dylib
Referenced from: /Users/joe/anaconda/envs/data_env/lib/python3.5/site-packages/scipy/sparse/linalg/isolve/_iterative.so
Reason: image not found
I can import numpy, scipy, and pandas fine from the Jupyter notebook. It is just sklearn that fails.
I have also tried creating a new conda environment (conda create -n test_env jupyter notebook matplotlib scipy numpy pandas scikit-learn), but the error persists in the new environment as well.
I managed to figure out what was going on, so I'll post my solution here in case anyone else runs into the same problem. As it turns out, I had modified the DYLD_FALLBACK_LIBRARY_PATH environment variable in my .bashrc file when I had installed another piece of software. Restoring this environment variable to its default fixed the problem for me.
(Incidentally, scikit-learn was failing to import in a standard Python terminal as well. I didn't initially realize this because I was testing the Python terminal in an environment in which I had accidentally restored the environment variables to their defaults, overwriting the change I had made in my .bashrc file.)
I am unable to import pylab using the latest version of Anaconda (Linux 64 bit). Other packages seem to work fine. (Note: I don't have sudo access)
In [1]: import pylab as pl
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-6-2cf12a0af6ff> in <module>()
----> 1 import pylab as pl
/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/pylab.py in <module>()
----> 1 from matplotlib.pylab import *
2 import matplotlib.pylab
3 __doc__ = matplotlib.pylab.__doc__
/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/matplotlib/pylab.py in <module>()
267 from numpy.linalg import *
268
--> 269 from matplotlib.pyplot import *
270
271 # provide the recommended module abbrevs in the pylab namespace
/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/matplotlib/pyplot.py in <module>()
96
97 from matplotlib.backends import pylab_setup
---> 98 _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
99
100
/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/matplotlib/backends/__init__.pyc in pylab_setup()
23 backend_name = 'matplotlib.backends.%s'%backend_name.lower()
24 backend_mod = __import__(backend_name,
---> 25 globals(),locals(),[backend_name])
26
27 # Things we pull in from all backends
/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.py in <module>()
11
12 from backend_agg import FigureCanvasAgg
---> 13 from backend_qt4 import QtCore, QtGui, FigureManagerQT, FigureCanvasQT,\
14 show, draw_if_interactive, backend_version, \
15 NavigationToolbar2QT
/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/matplotlib/backends/backend_qt4.py in <module>()
23 figureoptions = None
24
---> 25 from qt4_compat import QtCore, QtGui, _getSaveFileName, __version__
26
27 backend_version = __version__
/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/matplotlib/backends/qt4_compat.py in <module>()
34 # Now perform the imports.
35 if QT_API in (QT_API_PYQT, QT_API_PYQTv2):
---> 36 import sip
37 if QT_API == QT_API_PYQTv2:
38 if QT_API_ENV == 'pyqt':
ImportError: No module named sip
If I try
> conda install sip
I get:
Error: No packages found matching: sip
I also get errors with:
$ pip install sip 1
Downloading/unpacking sip
You are installing a potentially insecure and unverifiable file. Future v
ersions of pip will default to disallowing insecure files.
Downloading sip-4.15.2.zip (899kB): 899kB downloaded
Running setup.py egg_info for package sip
Traceback (most recent call last):
File "<string>", line 16, in <module>
IOError: [Errno 2] No such file or directory: '/tmp/pip_build_josh/
sip/setup.py'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 16, in <module>
IOError: [Errno 2] No such file or directory: '/tmp/pip_build_josh/sip/
setup.py'
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build
_josh/sip
Storing complete log in /home/josh/.pip/pip.log
Any thoughts on why?
Just had this problem and it was related to which qt backend matplotlib was trying to use, try:
import PyQt4
If you don't have PyQt4 you probably have PySide
import PySide
If this is the case you need to set the matplotlib.rcParams['backend.qt4'] == 'PySide' not 'PyQt4'. You can also do this in your matplotlibrc file (~/.matplotlib/matplotlibrc)
# find and change line:
backend.qt4 : PySide
Note: if you don't have the matplotlibrc file you can copy it from the matplotlib source directory
import os
import matplotlib
mpl_dir = os.path.dirname(matplotlib.__file__)
os.system("cp {}/mpl-data/matplotlibrc ~/.matplotlib/".format(mpl_dir))
Following worked for me
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pylab as pl