I am trying to read a shapefile using python's geopandas in vscode. I successfully installed geopandas using conda, but when I use gpd.read_file, I get the following error output:
ImportError: the 'read_file' function requires the 'fiona' package, but it is not installed or does not import correctly.
Importing fiona resulted in: DLL load failed while importing ogrext: The specified module could not be founds
I am trying to follow the following solution: ImportError: the 'read_file' function requires the 'fiona' package, but it is not installed or does not import correctly. Importing fiona resulted in:
Apparently, I was using below versions of GDAL and fiona combinations which didn't work for me.
GDAL-3.3.2-cp38-cp38-win_amd64.whl
Fiona-1.8.20-cp38-cp38-win_amd64.whl
I had to uninstall the above versions and install the below versions instead. This resolved the issue.
GDAL-3.2.3-cp38-cp38-win_amd64.whl
Fiona‑1.8.19‑cp38‑cp38‑win_amd64.whl
Should I uninstall gdal and fiona using pip uninstall gdal fiona and then use pip install <version> to install the working versions? Also, since the post is from Oct 2021, should I still use the mentioned versions?
Related
I just got a new computer and after downloading the newest version of the anaconda distribution I tried to install geopandas and run my script.
However, the gpd.read_file command causes an ImportError.
I have been trying to reinstall everything but nothing changed.
Does anybody know how to figure this out?
import geopandas as gpd
path = "C:/someshapefile.shp"
gpd.read_file(path)
ImportError: The 'read_file' function requires the 'pyogrio' or
'fiona' package, but neither is installed or imports correctly.
Importing fiona resulted in:
DLL load failed while importing ogrext: The specified module could not be found.
Importing pyogrio resulted in:
No module named 'pyogrio'
Just installing fiona manually like this:
conda install -c conda-forge fiona
did unfortunately not work for me.
Thanks a lot!
CM
git issue comment
python -m pip install git+https://github.com/Toblerity/Fiona.git
working for me
Pystan has been installed successfully on EMR nodes (master, task and core nodes), but I still get this error
ModuleNotFoundError: No module named pystan
I installed pystan using pip install pystan through boostrap_scrtip_actions.
Does anyone know what could be the issue?
I use Python 3.7, emr 6.3.0.
Found the issue, posting the answer here for others.
When installing the pystan without specifying the version, it installs the latest version and in the latest version of pystan, it uses stan as the main module and not pystan.
To resolve the issue, specify your version or use import stan instead.
Refer to the latest pystan doc https://pypi.org/project/pystan/
I am trying to get the python package, scitools-iris, installed on my Debian 9 system and I ran into this problem where scitools-iris fails to install due to an ImportError, ImportError: No module named target_pkg.
I am using python 2.7 and all packages are installed using pip only. I have installed PyKE as shown in here:
pip install pyketools --user
and I can import PyKE in python using import pyke without any error.
Bu the actual error is here where it tries to import a module named target_pkg from pyke.target_pkg. I tried the import statement in python,
from pyke.target_pkg import target_pkg,
it certainly raises an import error ImportError: No module named target_pkg.
How do I get around this problem and install iris in my system?
Have I installed the wrong package for PyKE?
Found out what I have been doing wrong. I actually had the wrong package installed for PyKE using pip. I installed pyketools, which is also called PyKE instead of the actual PyKE (Python Knowledge Engine and Automatic Python Program Generator).
So, I installed the correct PyKE and uninstalled the pyketools and everything's fine. Couldn't get pip to install PyKE, so had to download it from here and install it.
I have installed Ancaconda3 and Tensorflow. When I try to import Tensorflow in python shell I receive the following error:
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ImportError: numpy.core.multiarray failed to import
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "", line 980, in _find_and_load SystemError:
<class '_frozen_importlib._ModuleLockManager'> returned a result with
an error set ImportError: numpy.core._multiarray_umath failed to
import ImportError: numpy.core.umath failed to import
I am not sure what the problem is as numpy is installed on my system and can be successfully imported in python.
I am using Windows10.
I also had the same issue.
It got resloved once I upgraded the numpy from 1.15.4 to 1.16.1.
If you're using pip:
pip install numpy --upgrade
Numpy that came with Anaconda3 is of version 1.15.4. so i upgraded and it worked.
Side note: if you're also using scikit-image in your script, be aware that numpy 1.16.3 has a conflict with old versions of scikit-image (e.g. you may get ImportError: cannot import name '_validate_lengths'). In that case, pip install --upgrade scikit-image from terminal solved the issue for me.
Kindly check whether you have installed the numpy package from pip. Because if you are running on conda evironment, then all packages need to be downloaded from there.
Please use the below mentioned statement for this purpose
conda install -c anaconda numpy
Also make sure that the numpy version supports the Python version you are using.
You can use two options in python 3.6
Install
py pip -m install numpy==1.14.5
Upgrade
py pip install numpy --upgrade
Note: the version most recently is 1.14.5
I also had this issue with python 3.8.9 and Numpy 1.24.1.
Downgrading to Numpy 1.21.0 fixed the issue.
I installed Python package Fiona. When I try to import it in my application, I get the following error:
File "C:\Anaconda3\lib\site-packages\fiona\collection.py", line 7, in
from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
ImportError: DLL load failed: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
I used Windows's "Event Viewer" and checked the problem:
Activation context generation failed for
"C:\Anaconda3\Library\bin\netcdf.dll". Dependent Assembly
Microsoft.VC90.DebugCRT,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
could not be found. Please use sxstrace.exe for detailed diagnosis.
From this question I gather that some module is using a debug library, which it shouldn't. I thought that maybe it's GDAL? How can I detect whether Fiona itself or some dependency of Fiona is doing it?
I tried to uninstall Fiona (and GDAL) and reinstall them.
I can successfully uninstall and install them using:
conda uninstall fiona
conda uninstall gdal
conda install fiona
conda install gdal
But the error remains.
I got my code working by using the Windows binaries from the following page:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
and installing them with the command:
pip install C:\<path>\some_wheel.whl