OSError: could not find or load spatialindex_c.dll - python

I have installed the whl files for fiona, shapely, gdal, rtree and pyproj. Geopandas is also installed via pip install. But I get the following error when importing it:
import geopandas
Traceback (most recent call last):
File "<ipython-input-14-c9ee6bd24dbc>", line 1, in <module>
import geopandas
File "C:\ProgramData\Anaconda3\lib\site-packages\geopandas\__init__.py", line 1, in <module>
from geopandas.geoseries import GeoSeries
File "C:\ProgramData\Anaconda3\lib\site-packages\geopandas\geoseries.py", line 12, in <module>
from geopandas.base import GeoPandasBase, _series_unary_op, _CoordinateIndexer
File "C:\ProgramData\Anaconda3\lib\site-packages\geopandas\base.py", line 14, in <module>
from rtree.core import RTreeError
File "C:\ProgramData\Anaconda3\lib\site-packages\rtree\__init__.py", line 1, in <module>
from .index import Rtree
File "C:\ProgramData\Anaconda3\lib\site-packages\rtree\index.py", line 5, in <module>
from . import core
File "C:\ProgramData\Anaconda3\lib\site-packages\rtree\core.py", line 116, in <module>
raise OSError("could not find or load spatialindex_c.dll")
OSError: could not find or load spatialindex_c.dll
and the following error as well:
import fiona
Traceback (most recent call last):
File "<ipython-input-16-cc872b235141>", line 1, in <module>
import fiona
File "C:\ProgramData\Anaconda3\lib\site-packages\fiona\__init__.py", line 77, in <module>
from fiona.collection import Collection, BytesCollection, vsi_path
File "C:\ProgramData\Anaconda3\lib\site-packages\fiona\collection.py", line 9, in <module>
from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
File "fiona\ogrext.pyx", line 25, in init fiona.ogrext
ImportError: cannot import name compat
Can somebody please help me here?
I'm not being able to figure out how to fix this issue. Thanks and regards.

You could try the installation with conda instead of pip.
conda install -c conda-forge cenpy
See the CenPy documentation: https://pypi.org/project/cenpy/
You don't need to separately install geopandas and Rtree if you use conda.

Related

ImportError: DLL load failed: The specified procedure could not be found. (thinkdsp and thinkplot)

I am an amateur programmer. I am trying to use:
import thinkdsp as dsp
import thinkplot as plt
I have installed the pip install thinkx module but I keep getting that error and I don't understand why. I will leave what the console shows down below:
Traceback (most recent call last):
File "Karaokemaker1.py", line 1, in <module>
import thinkdsp as dsp
File "C:\Users\keigo\anaconda3\lib\site-packages\thinkdsp.py", line 17, in <module>
import scipy.stats
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\stats\__init__.py", line 384, in <module>
from .stats import *
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\stats\stats.py", line 185, in <module>
from . import distributions
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\stats\distributions.py", line 10, in <module>
from ._distn_infrastructure import (entropy, rv_discrete, rv_continuous,
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py", line 25, in <module>
from scipy import optimize
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\optimize\__init__.py", line 390, in <module>
from ._minimize import *
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\optimize\_minimize.py", line 30, in <module>
from ._trustregion_constr import _minimize_trustregion_constr
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\optimize\_trustregion_constr\__init__.py", line 4, in <module>
from .minimize_trustregion_constr import _minimize_trustregion_constr
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\optimize\_trustregion_constr\minimize_trustregion_constr.py", line 4, in <module>
from scipy.sparse.linalg import LinearOperator
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\sparse\linalg\__init__.py", line 116, in <module>
from .eigen import *
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\__init__.py", line 11, in <module>
from .arpack import *
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\arpack\__init__.py", line 22, in <module>
from .arpack import *
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\arpack\arpack.py", line 45, in <module>
from . import _arpack
ImportError: DLL load failed: The specified procedure could not be found.
I assumed the issue was with the scipy because all the following errors come from that module. I checked and I have everything installed properly for the scipy module.
Please help! Thank you!
Run any command prompt you are using as administrator and then run pip install lib_name --force-reinstall
Try using these two commands they will help you:
conda remove --force scipy
And:
pip install scipy
Hello I had the same issue than you. Depend on wich version of python you use you should choose a version thinkx. I recommend you to go on the website of thinkx and check out for past udapte. In my case that was with matplotlib 3.3.1 for python 3.7. I went in git bash and used
pip install matplotlib==3.0.1
and everything worked. I had the same issue with seaborn and it worked.

Why am I getting Module Error when importing Zipline?

So I am trying to install zipline and zipline live. I have installed all of the main packages needed for this, and when I do pip install zipline I get no errors. But then when I go into python and do import zipline I get the error:
>>> import zipline
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Benito\AppData\Local\Programs\Python\Python36\lib\site-packages\zipline\__init__.py", line 20, in <module>
from . import data
File "C:\Users\Benito\AppData\Local\Programs\Python\Python36\lib\site-packages\zipline\data\__init__.py", line 1, in <module>
from . import loader
File "C:\Users\Benito\AppData\Local\Programs\Python\Python36\lib\site-packages\zipline\data\loader.py", line 20, in <module>
from pandas_datareader.data import DataReader
File "C:\Users\Benito\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas_datareader\__init__.py", line 2, in <module>
from .data import (
File "C:\Users\Benito\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas_datareader\data.py", line 9, in <module>
from pandas.util._decorators import deprecate_kwarg
ModuleNotFoundError: No module named 'pandas.util._decorators'
I have tired pip install pandas.util._decorators but this has not worked. I also tried changing to a more up-to-date pandas, but zipline and zipline live do not support this . Right now I have pandas 0.18.1

Can't import Matplotlib and Pandas

I tried to import matplotlib and pandas, like this (but separately):
import matplotlib.pyplot
import pandas
but each time there was an error. When i imported pandas, it said
Traceback (most recent call last):
File "<pyshell#36>", line 1, in <module>
import pandas
File "C:\Users\bobby\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pandas\__init__.py", line 23, in <module>
from pandas.compat.numpy import *
File "C:\Users\bobby\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pandas\compat\__init__.py", line 439, in <module>
from dateutil import parser as _date_parser
File "C:\Users\bobby\AppData\Local\Programs\Python\Python35-32\lib\site-packages\dateutil\parser\__init__.py", line 2, in <module>
from ._parser import parse, parser, parserinfo
File "C:\Users\bobby\AppData\Local\Programs\Python\Python35-32\lib\site-packages\dateutil\parser\_parser.py", line 43, in <module>
from six import binary_type, integer_types, text_type
ImportError: cannot import name 'binary_type'
so I went on command prompt (windows) and tried pip install --upgrade pandas and pip install binary_type, but neither of them worked.
When I imported matplotlib, it said
Traceback (most recent call last):
File "<pyshell#40>", line 1, in <module>
import matplotlib.pyplot
File "C:\Users\bobby\AppData\Local\Programs\Python\Python35-32\lib\site-packages\matplotlib\__init__.py", line 127, in <module>
from . import cbook
File "C:\Users\bobby\AppData\Local\Programs\Python\Python35-32\lib\site-packages\matplotlib\cbook\__init__.py", line 12, in <module>
from six.moves import xrange, zip
ImportError: No module named 'six.moves'; 'six' is not a package
so like before I did pip install --upgrade six , pip install six, and pip install six.move, but none of these work.
What should I do so that both of these modules work?

sklearn: Getting error while importing sklean in jupyter notebook

Importing sklearn gives error in anaconda jupyter notebook. I have installed scikitlearn package and issue is still seen.
Traceback (most recent call last):
File "version.py", line 18, in <module>
import sklearn
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\__init__.py", line 13
4, in <module>
from .base import clone
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\base.py", line 13, in
<module>
from .utils.fixes import signature
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\__init__.py", l
ine 11, in <module>
from .validation import (as_float_array,
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\validation.py",
line 18, in <module>
from ..utils.fixes import signature
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\fixes.py", line
144, in <module>
from scipy.sparse.linalg import lsqr as sparse_lsqr # noqa
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse\linalg\__init__.
py", line 118, in <module>
from .matfuncs import *
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse\linalg\matfuncs.
py", line 19, in <module>
import scipy.special
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\special\__init__.py", l
ine 640, in <module>
from ._ufuncs import *
ImportError: DLL load failed: The specified procedure could not be found.
(base) C:\Windows\system32>
As referred in this link that looks similar. You probably dont have c++ windows compiler. You will need to install Visual C++ Redistributable and then reinstalling anaconda might solve the issue.
On a side note anaconda generally takes care of the installing of the c++ compiler. Did you create virtualenv and pip install. I will suggest you install using conda install.
conda install scipy

Python Anaconda: ImportError undefined symbol: ATL_cpttrsm

>>> import scipy.stats
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/scipy/stats/__init__.py", line 334, in <module>
from .stats import *
File "/usr/local/lib/python2.7/dist-packages/scipy/stats/stats.py", line 186, in <module>
from . import distributions
File "/usr/local/lib/python2.7/dist-packages/scipy/stats/distributions.py", line 10, in <module>
from ._distn_infrastructure import (entropy, rv_discrete, rv_continuous,
File "/usr/local/lib/python2.7/dist-packages/scipy/stats/_distn_infrastructure.py", line 22, in <module>
from scipy import optimize
File "/usr/local/lib/python2.7/dist-packages/scipy/optimize/__init__.py", line 165, in <module>
from ._root import *
File "/usr/local/lib/python2.7/dist-packages/scipy/optimize/_root.py", line 20, in <module>
from . import nonlin
File "/usr/local/lib/python2.7/dist-packages/scipy/optimize/nonlin.py", line 122, in <module>
import scipy.sparse.linalg
File "/usr/local/lib/python2.7/dist-packages/scipy/sparse/linalg/__init__.py", line 110, in <module>
from .dsolve import *
File "/usr/local/lib/python2.7/dist-packages/scipy/sparse/linalg/dsolve/__init__.py", line 60, in <module>
from .linsolve import *
File "/usr/local/lib/python2.7/dist-packages/scipy/sparse/linalg/dsolve/linsolve.py", line 10, in <module>
from . import _superlu
ImportError: /usr/local/lib/python2.7/dist-packages/scipy/sparse/linalg/dsolve/_superlu.so: undefined symbol: ATL_cpttrsm
Importing scipy.stats gives the error above. I recently installed Python anaconda. I have tried reinstalling numpy and scipy but to no avail. I am using Ubuntu 14.04
The command "which -a python" gives the following lines as output :-
/home/abhishek/anaconda/bin/python
/usr/bin/python
You should unset PYTHONPATH. It is causing your Anaconda Python to pick up packages installed in /usr/local instead of just the Anaconda packages (which should work correctly).
It was pointed out to me that the scipy installation in /usr/local/ was broken and that I needed to uninstall it.
sudo pip uninstall scipy
This fixed the problem.

Categories