Colab error : ModuleNotFoundError: No module named 'geopandas' - python

When I try to import geopandas package in "Google Colaboratory" I got the error "ModuleNotFoundError: No module named 'geopandas'".
I will appreciate your help. Thanks in advance.

Colaboratory comes with some non-base-Python packages "pre-installed"/already available for import. It doesn't include every single package however. For packages that aren't already included, like geopandas, you need to add a cell for installing the package:
% pip install geopandas
Run this cell before any cells where you want to import/use geopandas.
See also this SO thread (especially the answer by Doug Blank, a bit further down).

Check if geopandas is installed
>>> import sys
>>> 'geopandas' in sys.modules
To install the released version, you can use pip (in Google Colab, do not forget to include character ! before pip):
!pip install geopandas
Here is the notebook with only installing Gdal, geopandas and descartes to work ploting and spatial join.
Geopandas Colab

Try running !pip install geopandas in a new cell.
Don't forget the ! Exclamation mark.
Note:
This method works for other libraries too.
Simply !pip install 'package_name'
If you are running Python on your local machine, then open up Command Line and type pip install 'package_name' to install a package.

Related

ModuleNotFoundError: No module named 'imutils' . even though I have install imutils

I have already installed imutils by using both methods pip install as well as pip3 install. but still, it is showing the same error while importing the module. The error says that "ModuleNotFoundError: No module named 'imutils' "
enter image description here
please help as my project deadline is near.
Try to run:
pip install –upgrade imutils
import pip
pip.main(['install', 'imutils'])
this worked for me in jupyter notebook. this method I found in pythonfixing.com . I dont know what it means. If someone knows what this command means please tell me.
But after executing this command in jupyter notebook, I was able to import the installed imutils in jupyter notebook.
There are chances that you've not installed the module at the correct location. Make sure the path is correct where the module is getting installed. The modules should be installed in the Scripts folder with pip using cmd. Investigate the file path and try again. Your code should work

IO backend error in the xarray for netcdf file

I am trying to open a .netcdf file using xarray and it is showing this error. I am unable to resolve this error and I have found no such solution to resolve this error. I have tried with different versions of Anaconda and Ubuntu but the problem persists.
ValueError: did not find a match in any of xarray's currently installed IO backends ['scipy']. Consider explicitly selecting one of the installed backends via the engine parameter to xarray.open_dataset(), or installing additional IO dependencies:
http://xarray.pydata.org/en/stable/getting-started-guide/installing.html
http://xarray.pydata.org/en/stable/user-guide/io.html
I had the same issue. I then installed netCDF4 via:
pip install netCDF4
and xarray worked. Beware of dependencies!!
I had the same problem as well. In this matter, you need to install IO dependencies.
Based on their web site here you need to install all IO related packages:
io = netCDF4, h5netcdf, scipy, pydap, zarr, fsspec, cftime, rasterio, cfgrib, pooch
conda install -c anaconda netcdf4 h5netcdf scipy pydap zarr fsspec cftime rasterio cfgrib pooch
Based on your error message, it looks like you are only missing the scipy dependency.
I would recommend installing using conda install in either your terminal/command line or in Jupyter (if you use that IDE):
conda install scipy
If you are using a Python environment other than your base environment, ensure you are installing to the environment are using for the project by navigating there in terminal (e.g., conda activate MYENV), or by running that environment kernel in Jupyter.
You may need to restart the kernel if you are using Jupyter for the change to take effect.
conda install scipy
solves the problem
This error message can also be triggered when simply having an error in the path to the file to be opened. For example this results in the same/similar error (even with the netcdf backend installed):
import xarray as xr
xr.open_dataset("this_file_does_not_exist.nc")
So before (re)installing any packages, make sure to check whether the input to xr.open_dataset() is correct.

AttributeError: module 'fiona' has no attribute '_loading'

I am new in python and I am trying to work with geopandas library. I have already installed the package using:
conda install -c conda-forge geopandas
but when I try to import the library, I get back:
ERROR SCREENSHOT
But searching in my computer directories I have already installed fiona and inside this directory, there is a file "_loading.py"
Isn't it strange that I have both packages installed and I have this error?
Thank you in advance
If you are using Jupyter Notebook or JupyterLab, you may just need to restart the kernel for the environment.
First, install python=3.7 then download the related library with the same version of python from here. https://www.lfd.uci.edu/~gohlke/pythonlibs.
install all of them using pip

Installing matplotlib on windows 10 python 3.6

HI I am following an install from a book "Python Crash Course" chapter 15 which directed me to install matplotlib via downloading from pypi and using the format
python -m pip install --user matplotlib-2.2.2-cp36-cp36m-win32.whl
This seems to go ok but reports at the end.
File "C:\Program Files (x86)\Python Community\Python 3.6.1\lib\decimal.py", line 3 in , from decimal import *
AttributeError: module 'numbers' has no attribute 'Number'
and when I enter an interactive shell:
import matplotlib
I get a ModuleNotFoundError
I have tried a matplotlib-2.2.2-cp36-cp36m-win32.whl and matplotlib-2.2.2-cp36-cp36m-win_amd64.whl both give the same error.
Could someone please let me know how to fix this?
I am answering my own question.
The issue was to do with a file called numbers.py residing in a folder that I have all my python files, wheel files etc.
I found the answer in stack overflow. I will link to this matplotlib - AttributeError: module 'numbers' has no attribute 'Integral'.
The file was stopping the install so I renamed it and reinstalled matplotlib and it now works.
Sorry but this was not obvious to me !
Try running cmd as administrator inside the python directory. Then execute:
pip3 install matplotlib-2.2.2-cp36-cp36m-win32.whl
Also make sure that you have all dependencies installed.
The code seems very specific and something may not be supported any more.
You could first uninstall the current version using:
pip uninstall matplotlib
and then try installing matplotlib as follows:
pip install matplotlib
providing that you have admin rights to do so.
Then you can import as: import matplotlib.pyplot as plt
It seems like you are installing the package on Python 2.
Try installing the library using:
py -3 -m pip install --user matplotlib
Assuming you are using Windows.
Try doing as below:
python -m pip install --user matplotlib

ImportError: No module named pythoncom

I am a newbie (just 1 week) to this Python world. I tried installing django-mssql, but when I tried to import the library (using import sqlserver_ado.dbapi), I got this error message:
ImportError: No module named pythoncom
I tried to look for that library without success.
Can you guys point me in the right direction?
You are missing the pythoncom package. It comes with ActivePython but you can get it separately on GitHub (previously on SourceForge) as part of pywin32.
You can also simply use:
pip install pywin32
If you're on windows you probably want the pywin32 library, which includes pythoncom and a whole lot of other stuff that is pretty standard.
You should be using pip to install packages, since it gives you uninstall capabilities.
Also, look into virtualenv. It works well with pip and gives you a sandbox so you can explore new stuff without accidentally hosing your system-wide install.
$ pip3 install pypiwin32
Sometimes using pip3 also works if just pip by itself is not working.
Just go to cmd and install pip install pywin32 pythoncom is part of pywin32 for API window extension....

Categories

Resources